Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic turn off AC when operating within homekit #35

Open
KangKai1982 opened this issue Aug 22, 2018 · 28 comments
Open

automatic turn off AC when operating within homekit #35

KangKai1982 opened this issue Aug 22, 2018 · 28 comments

Comments

@KangKai1982
Copy link

KangKai1982 commented Aug 22, 2018

Successfully added my acpartner.v2 device to the homekit.app with homeassistant native homekit component
but when operate the climate, it always send off signal right after any signal, so the ac can not be turned on
homekit component log as below

2018-08-22 22:34:34 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=Cool; current_temperature=27.3, min_temp=16, max_temp=30, temperature=27, target_temp_step=1, fan_mode=Low, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=Off, swing_list=['On', 'Off', 'Unknown'], ac_model=010500978022222102, load_power=407, fan_speed=Low, led=False, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-22T22:34:34.021713+08:00>
2018-08-22 22:34:34 DEBUG (SyncWorker_8) [pyhap.characteristic] set_value: CurrentTemperature to 27.3
2018-08-22 22:34:34 DEBUG (SyncWorker_8) [pyhap.characteristic] set_value: TargetTemperature to 27
2018-08-22 22:34:34 DEBUG (SyncWorker_8) [pyhap.characteristic] set_value: TemperatureDisplayUnits to 0
2018-08-22 22:34:34 DEBUG (SyncWorker_8) [pyhap.characteristic] set_value: CurrentHeatingCoolingState to 0
@syssi
Copy link
Owner

syssi commented Aug 22, 2018

If you don't use homekit does it work properly?

@KangKai1982
Copy link
Author

Yes, it works fine with home-assistant itself.

@syssi
Copy link
Owner

syssi commented Aug 22, 2018

Please enable the debug output of the custom component and python-miio, too:

logger:
  default: warn
  logs:
    custom_components.climate.xiaomi_miio: debug
    miio: debug

Please reproduce the issue and provide the log again. Thanks!

@KangKai1982
Copy link
Author

KangKai1982 commented Aug 22, 2018

OK, here it is.

2018-08-23 07:38:18 DEBUG (Thread-6) [homeassistant.components.homekit.type_thermostats] climate.mi_acpartner4: Set heat-cool to 2
2018-08-23 07:38:18 DEBUG (SyncWorker_7) [miio.device] 192.168.1.231:54321 >>: {'id': 315, 'method': 'set_power', 'params': ['on']}
2018-08-23 07:38:18 DEBUG (SyncWorker_6) [miio.device] 192.168.1.231:54321 >>: {'id': 316, 'method': 'send_cmd', 'params': ['018022222101011BA2']}
2018-08-23 07:38:18 DEBUG (SyncWorker_7) [miio.device] 192.168.1.231:54321 (ts: 1970-01-12 17:34:32, id: 315) << {'result': ['ok'], 'id': 315}
2018-08-23 07:38:18 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Response received: ['ok']
2018-08-23 07:38:18 DEBUG (SyncWorker_1) [miio.device] 192.168.1.231:54321 >>: {'id': 316, 'method': 'get_model_and_state', 'params': []}
2018-08-23 07:38:18 DEBUG (SyncWorker_6) [miio.device] 192.168.1.231:54321 (ts: 1970-01-12 17:34:32, id: 316) << {'result': ['ok'], 'id': 316}
2018-08-23 07:38:18 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Response received: ['ok']
2018-08-23 07:38:18 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=Cool; current_temperature=27.3, min_temp=16, max_temp=30, temperature=27, target_temp_step=1, fan_mode=Low, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=Off, swing_list=['On', 'Off', 'Unknown'], ac_model=010500978022222102, load_power=1, fan_speed=Low, led=False, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-23T07:38:18.717809+08:00>
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.device] Retrying with incremented id, retries left: 3
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.device] Got a response: Container:
    data = Container:
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x03\x90\xe4\x15\x00\x0fw\xad' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x03\x90\xe4\x15' (total 4)
            ts = 1970-01-12 17:34:37
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b')\n&\xc2\xb6\xa4XF0\xb7\x8c\xc0l\x1d\xe4\x0e' (total 16)
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.device] Discovered 0390e415 with ts: 1970-01-12 17:34:37, token: b'token---token'
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.device] 192.168.1.231:54321 >>: {'id': 417, 'method': 'get_model_and_state', 'params': []}
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.device] 192.168.1.231:54321 (ts: 1970-01-12 17:34:37, id: 417) << {'result': ['010500978022222102', '0101011BA280222221', '1'], 'id': 417}
2018-08-23 07:38:23 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, load_power=1, air_condition_model=010500978022222102, model_format=1, device_type=5,air_condition_brand=97,air_condition_remote=80222221,state_format=2,air_condition_configuration=01011BA2,led=False, target_temperature=27, swing_mode=SwingMode.Off, fan_speed=FanSpeed.Low, mode=OperationMode.Cool>
2018-08-23 07:38:23 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=off; current_temperature=27.3, min_temp=16, max_temp=30, temperature=27, target_temp_step=1, fan_mode=Low, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=Off, swing_list=['On', 'Off', 'Unknown'], ac_model=010500978022222102, load_power=1, fan_speed=Low, led=False, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-23T07:38:23.706849+08:00>

@syssi
Copy link
Owner

syssi commented Aug 23, 2018

I commented the log message:

[homeassistant.components.homekit.type_thermostats] climate.mi_acpartner4: Set heat-cool to 2
[miio.device] 192.168.1.231:54321 >>: {'id': 315, 'method': 'set_power', 'params': ['on']}  # turn the device on
[miio.device] 192.168.1.231:54321 >>: {'id': 316, 'method': 'send_cmd', 'params': ['018022222101011BA2']}  # send new configuration
[miio.device] 192.168.1.231:54321 >>: {'id': 316, 'method': 'get_model_and_state', 'params': []}  # retrieve the new state
[miio.device] 192.168.1.231:54321 (ts: 1970-01-12 17:34:37, id: 417) << {'result': ['010500978022222102', '0101011BA280222221', '1'], 'id': 417} # the new state
[custom_components.climate.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, load_power=1, air_condition_model=010500978022222102, model_format=1, device_type=5,air_condition_brand=97,air_condition_remote=80222221,state_format=2,air_condition_configuration=01011BA2,led=False, target_temperature=27, swing_mode=SwingMode.Off, fan_speed=FanSpeed.Low, mode=OperationMode.Cool>  # the device is turned off

I assume the target temperature is the problem:

2018-08-23 07:38:18 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=Cool; current_temperature=27.3, min_temp=16, max_temp=30, temperature=27, target_temp_step=1, fan_mode=Low, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=Off, swing_list=['On', 'Off', 'Unknown'], ac_model=010500978022222102, load_power=1, fan_speed=Low, led=False, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-23T07:38:18.717809+08:00>
2018-08-23 07:38:23 DEBUG (SyncWorker_1) [miio.device] 192.168.1.231:54321 >>: {'id': 417, 'method': 'get_model_and_state', 'params': []}

The current temperature (27.3 degree) and the target temperature (27 degree) is more or less equal. I assume if you change the target temperature to 22 degree the AC won't turn off immediately.

@KangKai1982
Copy link
Author

just tried with target temperature set to 17/19/20, it does not help.

@syssi
Copy link
Owner

syssi commented Aug 23, 2018

Could you provide additional logs with updated target temperature? Thanks!

@KangKai1982
Copy link
Author

KangKai1982 commented Aug 23, 2018

sure, here it is with target temperature set to 20

2018-08-23 15:28:45 DEBUG (Thread-7) [homeassistant.components.homekit.type_thermostats] climate.mi_acpartner4: Set heat-cool to 2
2018-08-23 15:28:45 DEBUG (SyncWorker_2) [miio.device] 192.168.1.231:54321 >>: {'id': 3, 'method': 'set_power', 'params': ['on']}
2018-08-23 15:28:45 DEBUG (SyncWorker_7) [miio.device] 192.168.1.231:54321 >>: {'id': 4, 'method': 'send_cmd', 'params': ['0100002970013014A1']}
2018-08-23 15:28:46 DEBUG (SyncWorker_2) [miio.device] 192.168.1.231:54321 (ts: 1970-01-13 01:25:43, id: 3) << {'result': ['ok'], 'id': 3}
2018-08-23 15:28:46 DEBUG (SyncWorker_7) [miio.device] 192.168.1.231:54321 (ts: 1970-01-13 01:25:44, id: 4) << {'result': ['ok'], 'id': 4}
2018-08-23 15:28:46 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Response received: ['ok']
2018-08-23 15:28:46 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Response received: ['ok']
2018-08-23 15:28:46 DEBUG (SyncWorker_9) [miio.device] 192.168.1.231:54321 >>: {'id': 5, 'method': 'get_model_and_state', 'params': []}
2018-08-23 15:28:46 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=Cool; current_temperature=26.9, min_temp=16, max_temp=30, temperature=20, target_temp_step=1, fan_mode=Auto, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=On, swing_list=['On', 'Off', 'Unknown'], ac_model=010500970000297001, load_power=2, fan_speed=Auto, led=False, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-23T15:28:46.840549+08:00>
2018-08-23 15:28:46 DEBUG (SyncWorker_9) [miio.device] 192.168.1.231:54321 (ts: 1970-01-13 01:25:44, id: 5) << {'result': ['010500970000297001', '01013014A100002970', '1'], 'id': 5}
2018-08-23 15:28:46 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=off, load_power=1, air_condition_model=010500970000297001, model_format=1, device_type=5,air_condition_brand=97,air_condition_remote=2970,state_format=1,air_condition_configuration=013014A1,led=False, target_temperature=20, swing_mode=SwingMode.On, fan_speed=FanSpeed.Auto, mode=OperationMode.Cool>
2018-08-23 15:28:46 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=off; current_temperature=26.9, min_temp=16, max_temp=30, temperature=20, target_temp_step=1, fan_mode=Auto, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=On, swing_list=['On', 'Off', 'Unknown'], ac_model=010500970000297001, load_power=1, fan_speed=Auto, led=False, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-23T15:28:46.868992+08:00>

@KangKai1982
Copy link
Author

I noticed if I operate in home-assistant webui, which works fine, the miio compontent only send 1 "set power" command instead of 2 "set power"&"send cmd"

below is the log when operating within webui, there is no "send_cmd" event for miio

2018-08-23 15:30:55 DEBUG (SyncWorker_2) [miio.device] 192.168.1.231:54321 >>: {'id': 8, 'method': 'set_power', 'params': ['on']}
2018-08-23 15:30:56 DEBUG (SyncWorker_2) [miio.device] 192.168.1.231:54321 (ts: 1970-01-13 01:27:53, id: 8) << {'result': ['ok'], 'id': 8}
2018-08-23 15:30:56 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Response received: ['ok']
2018-08-23 15:30:56 DEBUG (SyncWorker_7) [miio.device] 192.168.1.231:54321 >>: {'id': 9, 'method': 'get_model_and_state', 'params': []}
2018-08-23 15:30:56 DEBUG (SyncWorker_7) [miio.device] 192.168.1.231:54321 (ts: 1970-01-13 01:27:53, id: 9) << {'result': ['010500970000297001', '0111301A0100002970', '2'], 'id': 9}
2018-08-23 15:30:56 DEBUG (MainThread) [custom_components.climate.xiaomi_miio] Got new state: <AirConditioningCompanionStatus power=on, load_power=2, air_condition_model=010500970000297001, model_format=1, device_type=5,air_condition_brand=97,air_condition_remote=2970,state_format=1,air_condition_configuration=11301A01,led=True, target_temperature=26, swing_mode=SwingMode.On, fan_speed=FanSpeed.Auto, mode=OperationMode.Cool>
2018-08-23 15:30:56 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state climate.mi_acpartner4=Cool; current_temperature=26.9, min_temp=16, max_temp=30, temperature=26, target_temp_step=1, fan_mode=Auto, fan_list=['Low', 'Medium', 'High', 'Auto'], operation_mode=Cool, operation_list=['Heat', 'Cool', 'Auto', 'Dehumidify', 'Ventilate'], swing_mode=On, swing_list=['On', 'Off', 'Unknown'], ac_model=010500970000297001, load_power=2, fan_speed=Auto, led=True, unit_of_measurement=°C, friendly_name=书房空调, supported_features=4801 @ 2018-08-23T15:30:56.148352+08:00>

@syssi
Copy link
Owner

syssi commented Aug 23, 2018

Good catch! In this case we have to identify the services called by homekit.

@flexyneat
Copy link

Hi,
I noticed this same issue, I'm on latest HA 0.83.3 with lumi.acpartner.v3 on the latest firmware. every comand sent from homekit also sends a power off command

@flexyneat
Copy link

I also notice the same power off issue when i try to control the AC from Home assistant

@syssi
Copy link
Owner

syssi commented Dec 20, 2018

Could somebody provide the configuration.yaml for a simple homekit setup? I would like to reproduce the issue.

@mgbaozi
Copy link

mgbaozi commented Dec 20, 2018

There is only a homekit: for setup Homekit in my configuration.yaml.

@KangKai1982
Copy link
Author

same here.
Issue exists with home assistant native HomeKit .

@anhnvme
Copy link
Contributor

anhnvme commented Dec 21, 2018

same issue, automatic turn off :(

@KangKai1982
Copy link
Author

Just tried on the Dec. 31 version, sent 3 commands instead of 1 when change state in homekit.

@flexyneat
Copy link

Just tried the newest version that was updated as of 5 days ago, even within home assistant, it sends a power off command when changing the temperature.

This was previously the case with homekit, but now it affects controls from within HA. I also noticed the error below:

File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/homekit/type_thermostats.py", line 250, in update_state
if isinstance(target_temp, float) and current_temp > target_temp:
TypeError: unorderable types: NoneType() > float()

@flexyneat
Copy link

Issue still open, even temperature changes or any form of operation from lovelace turn off the AC

@tzm112
Copy link

tzm112 commented Jun 2, 2019

same problem,my AC is hisence and i control AC flawlessly in MiHome App but i can't control my AC in hass

@flexyneat
Copy link

same problem,my AC is hisence and i control AC flawlessly in MiHome App but i can't control my AC in hass

yea, me too. My AC is Hisense. I'm now running hass 0.93.2

@syssi
Copy link
Owner

syssi commented Jun 2, 2019

Are we still talking about Homekit here?

@flexyneat
Copy link

Are we still talking about Homekit here?

I believe originally the problem was only occurring in Homekit, but now any controls /commands issued from HA interface also turns off the AC

@syssi
Copy link
Owner

syssi commented Jun 2, 2019

Could you enable the debug log again and provide some commented logs?

@tzm112
Copy link

tzm112 commented Jun 2, 2019

ofcourse
image

@tzm112
Copy link

tzm112 commented Jun 2, 2019

my ac's ip is 192.168.50.40

@syssi
Copy link
Owner

syssi commented Jun 2, 2019

I need a log which illustrates the issue. For example: Turn the AC on, wait a few seconds and change the target temperature. The Status object should indicate power=off afterwards.

@tzm112
Copy link

tzm112 commented Jun 2, 2019

i will give it to you on tomorrow。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants