iMicknl / ha-tahoma

Custom component for Home Assistant to interact with smart devices via Somfy TaHoma or other OverKiz based API's.
MIT License
152 stars 30 forks source link

Error message when I change HVAC_mode with my heaters (type NoneType doesn't define __round__ method) #762

Closed tillstaff closed 2 years ago

tillstaff commented 2 years ago

Did you read the instructions?

The problem

Since the last update I do, I have some problems to set hvac_mode on my heaters. There is an error which interrupt all my automation tasks :

Error: type NoneType doesn't define __round__ method

According to the logs, the problem has start with the fix #523 . When I comment the following line, all is working well. https://github.com/iMicknl/ha-tahoma/blob/88bff1c15ec2c48160c0e1da85c4c6155b8a5c26/custom_components/tahoma/sensor.py#L249

I think that is my "Cozytouch Interface" which cause the problem. It's like a heater for Cozytouch but it doesn't have a temperature sensor.

image

What version of this integration (ha-tahoma) has the issue?

2.12.2

What version of Home Assistant Core has the issue?

2022.2.5

Which gateway / hub do you use?

Cozytouch

Device model

AtlanticElectricalHeater

Home Assistant log

Logs ``` Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 536, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 569, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 542, in _stringify_state if (state := self.state) is None: File "/config/custom_components/tahoma/sensor.py", line 394, in state return self.entity_description.native_value(state.value) File "/config/custom_components/tahoma/sensor.py", line 234, in native_value=lambda value: round(value, 2), TypeError: type NoneType doesn't define __round__ method ```

Additional information

No response

iMicknl commented 2 years ago

What was the last working version for you? Or did you just update it?

Since you link to a change from Aug 12, 2021.

tillstaff commented 2 years ago

Yes I just update it and I didn't get too much care on the logs after that. I don't remember which was the previous build installed.

But my wife was complaining about the heater not working in the morning and I finally catch this error.

iMicknl commented 2 years ago

Can you include your diagnostic information?

tillstaff commented 2 years ago

Hi @iMicknl I can't reproduce the problem with the latest release 2.13.0. I think the PR #768 has solved my issue. native_value=lambda value: round(cast(float, value), 2) Thanks for your help