Closed mouth4war closed 5 years ago
I think the library is reporting power=off. Maybe there are different attributes for power for AC mode and Plug mode.
I picked a special property called socket_power
for the device state:
https://github.com/syssi/xiaomiplug/blob/develop/custom_components/switch/xiaomi_miio.py#L544
This property (socket_power
) isn't exposed from AirConditioningCompanionStatus.repr() at the moment. Could you enable the debug output of the component and library by:
# configuration.yaml
logger:
default: warn
logs:
custom_components.switch.xiaomi_miio: debug
miio: debug
And provide some logs? I'm interested in the response of:
power_socket = self.send("get_device_prop", ["lumi.0", "plug_state"])
https://github.com/rytilahti/python-miio/blob/master/miio/airconditioningcompanion.py#L482
It should be "on" and "off".
OK with your updated code, I get this after turn_on
[custom_components.switch.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, power_socket=['on'], load_power=829, air_condition_model=00000000ffffffff00, model_format=0, device_type=0, air_condition_brand=0, air_condition_remote=4294967295, state_format=0, air_condition_configuration=01101900, led=True, target_temperature=25, swing_mode=SwingMode.On, fan_speed=FanSpeed.Medium, mode=OperationMode.Cool>
turn_off:
[custom_components.switch.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, power_socket=['off'], load_power=0, air_condition_model=00000000ffffffff00, model_format=0, device_type=0, air_condition_brand=0, air_condition_remote=4294967295, state_format=0, air_condition_configuration=01101900, led=True, target_temperature=25, swing_mode=SwingMode.On, fan_speed=FanSpeed.Medium, mode=OperationMode.Cool>
Perfect! This is a bug. Please update the custom component.
So now turn_on and turn_off work but soon after using turn_on, the switch loses sync by going off. The actual relay is still on.
status update is not working properly.
debug log for turn_on, new state shows power off and load power shows the load so its clearly on: