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

ValueError: Sensor sensor.smart_meter_gas_import_today has device class energy, state class measurement unit kWh and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: unknown (<class 'str'>) #37

Open
watsonpaul80 opened this issue May 19, 2023 · 0 comments

Comments

@watsonpaul80
Copy link

First occurred: 5:46:20 PM (634 occurrences)
Last logged: 7:31:50 PM

Exception raised when updating state of sensor.smart_meter_gas_import_today, topic: 'glow/441793504B04/SENSOR/gasmeter' with payload: b'{"gasmeter":{"timestamp":"2023-05-19T18:29:14Z","energy":{"import":{"cumulative":87448.000,"day":0.000,"week":null,"month":null,"units":"kWh","cumulativevol":87448.000,"cumulativevolunits":"kWh","dayvol":0.000,"weekvol":null,"monthvol":null,"dayweekmonthvolunits":"kWh","mprn":"1288362102","supplier":"---","price":{"unitrate":0.10199,"standingcharge":0.28484}}}}}'
Exception raised when updating state of sensor.smart_meter_gas_import_today, topic: 'glow/441793504B04/SENSOR/gasmeter' with payload: b'{"gasmeter":{"timestamp":"2023-05-19T18:29:46Z","energy":{"import":{"cumulative":87448.000,"day":0.000,"week":null,"month":null,"units":"kWh","cumulativevol":87448.000,"cumulativevolunits":"kWh","dayvol":0.000,"weekvol":null,"monthvol":null,"dayweekmonthvolunits":"kWh","mprn":"1288362102","supplier":"---","price":{"unitrate":0.10199,"standingcharge":0.28484}}}}}'
Exception raised when updating state of sensor.smart_meter_gas_import_today, topic: 'glow/441793504B04/SENSOR/gasmeter' with payload: b'{"gasmeter":{"timestamp":"2023-05-19T18:30:18Z","energy":{"import":{"cumulative":87448.000,"day":0.000,"week":null,"month":null,"units":"kWh","cumulativevol":87448.000,"cumulativevolunits":"kWh","dayvol":0.000,"weekvol":null,"monthvol":null,"dayweekmonthvolunits":"kWh","mprn":"1288362102","supplier":"---","price":{"unitrate":0.10199,"standingcharge":0.28484}}}}}'
Exception raised when updating state of sensor.smart_meter_gas_import_today, topic: 'glow/441793504B04/SENSOR/gasmeter' with payload: b'{"gasmeter":{"timestamp":"2023-05-19T18:30:43Z","energy":{"import":{"cumulative":87448.000,"day":0.000,"week":null,"month":null,"units":"kWh","cumulativevol":87448.000,"cumulativevolunits":"kWh","dayvol":0.000,"weekvol":null,"monthvol":null,"dayweekmonthvolunits":"kWh","mprn":"1288362102","supplier":"---","price":{"unitrate":0.10199,"standingcharge":0.28484}}}}}'
Exception raised when updating state of sensor.smart_meter_gas_import_today, topic: 'glow/441793504B04/SENSOR/gasmeter' with payload: b'{"gasmeter":{"timestamp":"2023-05-19T18:31:16Z","energy":{"import":{"cumulative":87448.000,"day":0.000,"week":null,"month":null,"units":"kWh","cumulativevol":87448.000,"cumulativevolunits":"kWh","dayvol":0.000,"weekvol":null,"monthvol":null,"dayweekmonthvolunits":"kWh","mprn":"1288362102","supplier":"---","price":{"unitrate":0.10199,"standingcharge":0.28484}}}}}'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 579, in state
numerical_value = int(value)
ValueError: invalid literal for int() with base 10: 'unknown'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 270, in process_write_state_requests
entity.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 583, in state
raise ValueError(
ValueError: Sensor sensor.smart_meter_gas_import_today has device class energy, state class measurement unit kWh and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: unknown (<class 'str'>)

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

No branches or pull requests

1 participant