core: Fritz component errors in log after installing 2021.8.0b0

The problem

Some components seem to be incorretly provided with data like the DECT temperature sensor which tell me -3 C now. Many more new errors in log.

What is version of Home Assistant Core has the issue?

2021.8.0b0

What was the last working version of Home Assistant Core?

2021.7.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

fritzbox

Link to integration documentation on our website

https://www.home-assistant.io/integrations/fritzbox/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Source: components/fritzbox/sensor.py:124
Integration: Sensor (documentation, issues)
First occurred: 9:04:46 (2 occurrences)
Last logged: 9:04:46


Error adding entities for domain sensor with platform fritzbox
Error while setting up fritzbox platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 711, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/fritzbox/sensor.py", line 124, in state
    return self.device.power / 1000  # type: ignore [no-any-return]
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Logger: homeassistant Source: components/fritzbox/sensor.py:124 First occurred: 9:05:20 (8 occurrences) Last logged: 9:09:06

Error doing job: Task exception was never retrieved
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 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/fritzbox/sensor.py", line 124, in state
    return self.device.power / 1000  # type: ignore [no-any-return]
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'


### Additional information

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

Exactly there it is ^^ will try later and edit the results in here then. Not at home right now

Result looks good. The temperature problem was my own template looking at the temperature which was coming from the switch entity in the past and now no more. Soo all fine here ^^ Thanks!

@dreimer1986 may I ask you to please test the code from #53809 if the fritzbox integration now works as expected, even device “XMAS #1” is not present/available (I guess it lays in a box near the Christmas tree decorations 🙂)

Something seems quite wrong here:

<temperature><celsius>235</celsius><offset>0</offset></temperature>

Simone

No, thats okay, the device reports the temperature in 0,1°C. That gets divided by 10 by the pyfritzhome lib, so in this example it should show 23.5°C in HA.

I think the crash in the issue description happens because the device “XMAS #1” is unavailable and the power returns None.

OK, first the log: https://pastiebin.com/610497773668d Regarding the Sensor I am talking about. It happens for all 4 FRITZ!DECT 200 I have.

Sorry, fixed accordingly