There seems to be a small coding oversight that is generating 2 errors with the integration at the start-up of HA.
There is a reference to “previous state” which I expect doesn’t exist at start-up, and therefore a couple of errors are generated only at start-up time by the integration. Errors are below:
Error 1:
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:507
Integration: Sensor (documentation, issues)
First occurred: 18:00:58 (1 occurrences)
Last logged: 18:00:58
Error adding entities for domain sensor with platform linktap
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/config/custom_components/linktap/sensor.py", line 112, in state
if self.attribute == "volume" and self._state < previous_state:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'float' and 'NoneType'
Error 2:
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:368
Integration: Sensor (documentation, issues)
First occurred: 18:00:59 (1 occurrences)
Last logged: 18:00:59
Error while setting up linktap platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
await asyncio.gather(pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/config/custom_components/linktap/sensor.py", line 112, in state
if self.attribute == "volume" and self._state < previous_state:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'float' and 'NoneType'
There seems to be a small coding oversight that is generating 2 errors with the integration at the start-up of HA.
There is a reference to “previous state” which I expect doesn’t exist at start-up, and therefore a couple of errors are generated only at start-up time by the integration. Errors are below:
Error 1:
Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:507 Integration: Sensor (documentation, issues) First occurred: 18:00:58 (1 occurrences) Last logged: 18:00:58
Error adding entities for domain sensor with platform linktap Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/config/custom_components/linktap/sensor.py", line 112, in state if self.attribute == "volume" and self._state < previous_state: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'float' and 'NoneType'
Error 2:
Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:368 Integration: Sensor (documentation, issues) First occurred: 18:00:59 (1 occurrences) Last logged: 18:00:59
Error while setting up linktap platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform await asyncio.gather(pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/config/custom_components/linktap/sensor.py", line 112, in state if self.attribute == "volume" and self._state < previous_state: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'float' and 'NoneType'