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

xiaomi_miio switch stop working after 0.112 #37342

Closed
fufar opened this issue Jul 2, 2020 · 6 comments · Fixed by #37422
Closed

xiaomi_miio switch stop working after 0.112 #37342

fufar opened this issue Jul 2, 2020 · 6 comments · Fixed by #37422

Comments

@fufar
Copy link

fufar commented Jul 2, 2020

The problem

I have 2 xiaomi swithes, one working after updateing to 0.112, second stop working

Environment

  • Home Assistant Core release with the issue: 0.112
  • Last working Home Assistant Core release (if known): 0.111
  • Operating environment (OS/Container/Supervised/Core): synology docker installation
  • Integration causing this issue: xiaomi_miio
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml

switch:
  - platform: xiaomi_miio
    host: 192.168.1.XX
    token: XXXXXXXXXXXXXXXXXXXXXXXXXXXX
    name: Розетка 1 - нагреватель
  - platform: xiaomi_miio
    host: 192.168.1.XX
    token: XXXXXXXXXXXXXXXXXXXXXXXXXXXX
    name: Розетка 2 - фумигатор

Traceback/Error logs

Error while setting up xiaomi_miio platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/switch.py", line 133, in async_setup_platform
    device_info = await hass.async_add_executor_job(miio_device.info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/miio/device.py", line 182, in info
    return DeviceInfo(self.send("miIO.info"))
  File "/usr/local/lib/python3.7/site-packages/miio/device.py", line 147, in send
    command, parameters, retry_count, extra_parameters=extra_parameters
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 150, in send
    self.send_handshake()
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 62, in send_handshake
    header = m.header.value
AttributeError: 'NoneType' object has no attribute 'header'

Additional information

chuangmi.plug.m3

@probot-home-assistant
Copy link

Hey there @rytilahti, @syssi, mind taking a look at this issue as its been labeled with an integration (xiaomi_miio) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@wbradmoore
Copy link

wbradmoore commented Jul 2, 2020

i'm getting the same thing since upgrading to 0.112 from both the xiaomi_miio.fan and xiaomi_miio.vacuum platforms.

2020-07-02 08:15:11 ERROR (MainThread) [homeassistant.helpers.entity] Update for vacuum.roborock_0 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 182, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    self.update  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/vacuum.py", line 470, in update
    state = self._vacuum.status()
  File "/usr/local/lib/python3.7/site-packages/miio/vacuum.py", line 197, in status
    return VacuumStatus(self.send("get_status")[0])
  File "/usr/local/lib/python3.7/site-packages/miio/device.py", line 147, in send
    command, parameters, retry_count, extra_parameters=extra_parameters
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 226, in send
    extra_parameters=extra_parameters,
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 150, in send
    self.send_handshake()
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 62, in send_handshake
    header = m.header.value
AttributeError: 'NoneType' object has no attribute 'header'

the vacuum is, however, reachable:

wbradmoore@habox:~$ docker exec -it homeassistant bash
bash-5.0# mirobo --ip 192.168.x.x --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
State: Charging
Battery: 100 %
Fanspeed: 90 %
Cleaning since: 0:20:00
Cleaned area: 20.5675 m²
Water box attached: False

@rytilahti
Copy link
Member

This happens when the device does not respond to the handshake request and has been fixed already in upstream (rytilahti/python-miio#731 ), so this will be fixed when new python-miio gets released and the dependency gets bumped (likely for 0.113).

@wbradmoore
Copy link

wbradmoore commented Jul 2, 2020

This happens when the device does not respond to the handshake request

it happens (the above failure) 100% of the time, for all my fans and vacuums - is that expected based on your understanding of the bug?

also curious if i can jump into the container and manually update python-miio...

@accelle17
Copy link

accelle17 commented Jul 3, 2020

I tried to update /usr/local/lib/python3.7/site-packages/miio/miioprotocol.py using https://raw.githubusercontent.com/rytilahti/python-miio/master/miio/miioprotocol.py on the hassio container but my vacuum is still unavailable after restart. It responds to mirobo command command though.
EDIT: I just used the 0.111.4 xiaomi_miio as custom_components for now and it's working

@wbradmoore
Copy link

I tried to update /usr/local/lib/python3.7/site-packages/miio/miioprotocol.py using https://raw.githubusercontent.com/rytilahti/python-miio/master/miio/miioprotocol.py on the hassio container but my vacuum is still unavailable after restart. It responds to mirobo command command though.

i tried replacing the entire /usr/local/lib/python3.7/site-packages/miio/ dir with the current version, and got the same constant vacuum failures (it looks like a fan was working, though?)

using the HA 0.111.4 custom_component works though, good idea.

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

Successfully merging a pull request may close this issue.

6 participants