core: Miio integration stopped working in 2021.12 (unsupported operand type(s) for -: 'NoneType' and 'int')
The problem
After updating to 2021.12 all my Xiaomi Miio lights stopped working in home assistant. Tried removing and readding them from the integration page, however no devices or entities are created, even if the process itself seems successful. Tried adding the lights both automatically and manually, but the results are the same.
What version of Home Assistant Core has the issue?
core-2021.12.0
What was the last working version of Home Assistant Core?
core-2021.11.5
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Xiaomi Miio
Link to integration documentation on our website
https://www.home-assistant.io/integrations/xiaomi_miio/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
2021-12-12 02:08:22 WARNING (SyncWorker_6) [miio.device] Found an unsupported model 'philips.light.downlight' for class 'PhilipsBulb'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2021-12-12 02:08:22 WARNING (SyncWorker_5) [miio.device] Found an unsupported model 'philips.light.downlight' for class 'PhilipsBulb'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2021-12-12 02:08:22 WARNING (SyncWorker_3) [miio.device] Found an unsupported model 'philips.light.downlight' for class 'PhilipsBulb'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2021-12-12 02:08:22 WARNING (SyncWorker_4) [miio.device] Found an unsupported model 'philips.light.downlight' for class 'PhilipsBulb'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2021-12-12 02:08:22 ERROR (MainThread) [homeassistant.components.light] xiaomi_miio: Error on device update!
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 502, in async_update
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 521, in translate
2021-12-12 02:08:22 ERROR (MainThread) [homeassistant.components.light] xiaomi_miio: Error on device update!
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 502, in async_update
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 521, in translate
2021-12-12 02:08:22 ERROR (MainThread) [homeassistant.components.light] xiaomi_miio: Error on device update!
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 502, in async_update
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 521, in translate
2021-12-12 02:08:22 ERROR (MainThread) [homeassistant.components.light] xiaomi_miio: Error on device update!
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 502, in async_update
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py", line 521, in translate
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 23 (6 by maintainers)
Confirming the issue.
That is a different error, so please keep it out from this issue. Looks like you are running an old python-miio version (maybe you have some custom component enabled which pins to the older version?) which is causing this.
Confirmed
Similar issue with ‘philips.light.candle2’ which no longer works since 2021.12 update:
2021-12-12 09:00:04 WARNING (SyncWorker_8) [miio.device] Found an unsupported model ‘philips.light.candle2’ for class ‘PhilipsBulb’. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/ 2021-12-12 09:00:04 ERROR (MainThread) [homeassistant.components.light] xiaomi_miio: Error on device update! Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 431, in _async_add_entity await entity.async_device_update(warning=False) File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 684, in async_device_update await task File “/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py”, line 502, in async_update self._color_temp = self.translate( File “/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py”, line 521, in translate value_scaled = float(value - left_min) / float(left_span) TypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘int’ 2021-12-12 09:00:09 ERROR (MainThread) [homeassistant.components.light] xiaomi_miio: Error on device update! Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 431, in _async_add_entity await entity.async_device_update(warning=False) File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 684, in async_device_update await task File “/usr/src/homeassistant/homeassistant/components/xiaomi_miio/light.py”, line 1008, in async_update state_dict = await self.hass.async_add_executor_job( File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run result = self.fn(*self.args, **self.kwargs) File “/usr/local/lib/python3.9/site-packages/miio/click_common.py”, line 186, in _wrap self._fetch_info() File “/usr/local/lib/python3.9/site-packages/miio/device.py”, line 149, in _fetch_info devinfo = DeviceInfo(self.send(“miIO.info”)) File “/usr/local/lib/python3.9/site-packages/miio/device.py”, line 103, in send return self._protocol.send( File “/usr/local/lib/python3.9/site-packages/miio/miioprotocol.py”, line 161, in send self.send_handshake() File “/usr/local/lib/python3.9/site-packages/miio/miioprotocol.py”, line 74, in send_handshake raise DeviceException(“Unable to discover the device %s” % self.ip) miio.exceptions.DeviceException: Unable to discover the device None
@fereehu I have the same problem as you. In version 12.2 the hbulb do not work, after downgrading to 11.5 everything works again. Did you manage to solve this problem?
Ok, I have found. It works with “philips.light.mono1”.
https://github.com/rytilahti/python-miio/issues/1231#issuecomment-995282665
Ouch, looks like github supports cross-repository issue closing now? That was not done on purpose…
Anyway, the fix requires a version bumping python-miio so I’m waiting for someone to confirm that the fix is indeed working. It makes no sense to prepare a release, bump the version etc. just to find out otherwise.
Same problem here with Xiaomi gateway chinese version
This is a duplicate of #61427 I think.
The
miio.exceptions.DeviceException: Unable to discover the device None
is related to gateways and is being fixed at https://github.com/rytilahti/python-miio/pull/1233 and is unrelated to this issue as far as I know.indeed, alarm_control_panel.xiaomi_gateway_alarm entity is “unavailable” for me too.
Hey there @rytilahti, @syssi, @starkillerog, @bieniu, mind taking a look at this issue as it has been labeled with an integration (
xiaomi_miio
) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)xiaomi_miio documentation xiaomi_miio source (message by IssueLinks)