syssi / xiaomi_cooker

Xiaomi Mi Electric Rice Cooker integration for Home Assistant
Apache License 2.0
142 stars 37 forks source link

Rice cooker won't start preparing rice #52

Open hearttheart opened 2 years ago

hearttheart commented 2 years ago

Hi,

Rice cooker is integrated properly into HA, showing/updating current stats when starting to cook via the Xiaomi app. However, the switch to turn on the cooker from within HA is not working.

Logger: miio.miioprotocol Source: custom_components/xiaomi_miio_cooker/init.py:154 Got error when receiving: {'code': -9999, 'message': 'user ack timeout'}

Error executing service: <ServiceCall xiaomi_miio_cooker.start (c:01GDRY949SC6PH1SJNWQJXZJGE): profile=0001E10100000000000080026E10082B126E1412698CAA555555550014280A6E0C02050506050505055A14040A0C0C0D00040505060A0F086E6E20000C0A5A28036468686A0004040500000000000000010202020204040506070708001212180C1E2D2D37000000000000000000000099A5> Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 214, in send self._handle_error(payload["error"]) File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 274, in _handle_error raise RecoverableError(error) miio.exceptions.RecoverableError: {'code': -9999, 'message': 'user ack timeout'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 214, in send self._handle_error(payload["error"]) File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 274, in _handle_error raise RecoverableError(error) miio.exceptions.RecoverableError: {'code': -9999, 'message': 'user ack timeout'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 214, in send self._handle_error(payload["error"]) File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 274, in _handle_error raise RecoverableError(error) miio.exceptions.RecoverableError: {'code': -9999, 'message': 'user ack timeout'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 214, in send self._handle_error(payload["error"]) File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 274, in _handle_error raise RecoverableError(error) miio.exceptions.RecoverableError: {'code': -9999, 'message': 'user ack timeout'}

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1756, in catch_exceptions await coro_or_task File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service await self._hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) File "/config/custom_components/xiaomi_miio_cooker/init.py", line 154, in start_service cooker.start(profile) File "/usr/local/lib/python3.10/site-packages/miio/click_common.py", line 184, in _wrap return func(self, args, **kwargs) File "/usr/local/lib/python3.10/site-packages/miio/cooker.py", line 649, in start self.send("set_start", [profile]) File "/usr/local/lib/python3.10/site-packages/miio/device.py", line 107, in send return self._protocol.send( File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 248, in send return self.send( File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 248, in send return self.send( File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 248, in send return self.send( File "/usr/local/lib/python3.10/site-packages/miio/miioprotocol.py", line 256, in send raise DeviceException("Unable to recover failed command") from ex miio.exceptions.DeviceException: Unable to recover failed command

syssi commented 2 years ago

Thanks for your bug report. I will try to reproduce the issue.

hearttheart commented 2 years ago

Thank you! Please let me know if you need any more details.

syssi commented 2 years ago
# Decrypted traffic capture of HiHome app + chunmi.cooker.normal2 (fw 1.2.8)

miiocli devtools parse-pcap test.pcap c5b52562c4109fc06490a2d392e175e7
192.168.1.15    -> 192.168.1.112   {'result': ['waiting', '0a8e', 'null', '21', '60', '-1', '60', '0204', '050415', '0003001a', '0a8e', 'ffffffffffff011effff010000001518'], 'id': 4147}
192.168.1.15    -> 192.168.1.112   {'result': ['waiting', '0a8e', 'null', '21', '60', '-1', '60', '0204', '050415', '0003001a', '0a8e', 'ffffffffffff011effff010000001518'], 'id': 4147}
192.168.1.112   -> 192.168.1.15    {'id': 4148, 'method': 'set_start', 'params': ['0001e101000000420000000200a00069030103730000085a020000eb006b040103740000095a0400012d006e0501037400000a5a0401ffff00700601047600000c5a0401052d0a0f3c0a1e91ff820e01ff05ff78826eff10ff786e02690f0dff826eff691000ff826eff69100069ff5aff000000000000ae94']}
192.168.1.112   -> 192.168.1.15    {'id': 4148, 'method': 'set_start', 'params': ['0001e101000000420000000200a00069030103730000085a020000eb006b040103740000095a0400012d006e0501037400000a5a0401ffff00700601047600000c5a0401052d0a0f3c0a1e91ff820e01ff05ff78826eff10ff786e02690f0dff826eff691000ff826eff69100069ff5aff000000000000ae94']}
192.168.1.15    -> 192.168.1.112   {'result': ['ok'], 'id': 4148}
192.168.1.15    -> 192.168.1.112   {'result': ['ok'], 'id': 4148}
192.168.1.112   -> 192.168.1.15    {'id': 4149, 'method': 'get_prop', 'params': ['all']}
192.168.1.112   -> 192.168.1.15    {'id': 4149, 'method': 'get_prop', 'params': ['all']}
192.168.1.15    -> 192.168.1.112   {'result': ['running', '0001', 'null', '21', '60', '-1', '60', '0204', '050415', '0003001a', '0a8e', 'ffffffffffff011effff010000001518'], 'id': 4149}
192.168.1.15    -> 192.168.1.112   {'result': ['running', '0001', 'null', '21', '60', '-1', '60', '0204', '050415', '0003001a', '0a8e', 'ffffffffffff011effff010000001518'], 'id': 4149}
192.168.1.112   -> 192.168.1.15    {'id': 4152, 'method': 'get_prop', 'params': ['all']}
192.168.1.112   -> 192.168.1.15    {'id': 4152, 'method': 'get_prop', 'params': ['all']}
192.168.1.15    -> 192.168.1.112   {'result': ['running', '0001', '00000042ff', '0a011202', '60', '-1', '60', '0204', '050415', '0003001a', '0a8e', 'ffffffffffff011effff010000001618'], 'id': 4152}
192.168.1.15    -> 192.168.1.112   {'result': ['running', '0001', '00000042ff', '0a011202', '60', '-1', '60', '0204', '050415', '0003001a', '0a8e', 'ffffffffffff011effff010000001618'], 'id': 4152}
192.168.1.112   -> 192.168.1.15    {'id': 4153, 'method': 'set_func', 'params': ['end']}
192.168.1.112   -> 192.168.1.15    {'id': 4153, 'method': 'set_func', 'params': ['end']}
192.168.1.15    -> 192.168.1.112   {'result': ['ok'], 'id': 4153}
192.168.1.15    -> 192.168.1.112   {'result': ['ok'], 'id': 4153}

== stats ==
        miio_packets: 24
        results: 10
        empty_packets: 6

== dst_addr ==
        192.168.1.112: 10
        192.168.1.15: 8

== src_addr ==
        192.168.1.15: 10
        192.168.1.112: 8

== commands ==
        set_start: 2
        get_prop: 4
        set_func: 2
syssi commented 2 years ago

@hearttheart Could you try to start this profile instead:

0001e101000000420000000200a00069030103730000085a020000eb006b040103740000095a0400012d006e0501037400000a5a0401ffff00700601047600000c5a0401052d0a0f3c0a1e91ff820e01ff05ff78826eff10ff786e02690f0dff826eff691000ff826eff69100069ff5aff000000000000ae94

Does it work? My normal2 doesn't accept / start cooking if I use this profile:

0001E10100000000000080026E10082B126E1412698CAA555555550014280A6E0C02050506050505055A14040A0C0C0D00040505060A0F086E6E20000C0A5A28036468686A0004040500000000000000010202020204040506070708001212180C1E2D2D37000000000000000000000099A5
myhades commented 1 year ago

Hi, I have a normal2 to toy with. I can confirm that the profile works, and matches "Jingzhufan". Are there other profiles for normal2?

mejikomtv commented 2 months ago

thanks. you fix my problem