pawelhulek / pgnig-sensor

This sensor is gathering gas usage data from PGNIG ebok page.
MIT License
31 stars 8 forks source link

unsupported operand type(s) for /: 'NoneType' and 'NoneType' #47

Closed n4ts closed 1 year ago

n4ts commented 1 year ago

Przy starcie HA zawsze mam taki komunikat:

[homeassistant.components.sensor] Error adding entities for domain sensor with platform pgnig_gas_sensor
Traceback (most recent call last):
File "/home/pi/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/home/pi/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 691, in _async_add_entity
await entity.add_to_platform_finish()
File "/home/pi/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 777, in add_to_platform_finish
self.async_write_ha_state()
File "/home/pi/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/home/pi/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/home/pi/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/home/pi/.homeassistant/custom_components/pgnig_gas_sensor/sensor.py", line 224, in state
return self._state.gross_amount / self._state.wear
TypeError: unsupported operand type(s) for /: 'NoneType' and 'NoneType'

Po jakimś czasie dane zaciągają się poprawnie, ale w logach zawsze komunikat zostaje :/

pawelhulek commented 1 year ago

@n4ts Jaka wersja integracji?

n4ts commented 1 year ago

@pawelhulek v2.3.3 hass 2022.10.3

n4ts commented 1 year ago

@pawelhulek może podrzucić jeszcze jakieś dane, które byłby pomocne?

pawelhulek commented 1 year ago

@n4ts Wybacz poslizg - ale polecam update do 2.3.4 - udostepnilem ja w kanale głównym juz.

Problem jaki natomiast masz to taki ze PGNIG nie daje Ci z jakiegos powodu danych potrzebnych do obliczenia wartosc dla sensorów ceny za m3. Niestety nie bedzie ona dla Ciebie dostepna - nie jestem w stanie zmatchowac faktur ze stanami licznika ;/

pawelhulek commented 1 year ago

https://github.com/pawelhulek/pgnig-sensor/issues/44

n4ts commented 1 year ago

@pawelhulek wcześniej te dane zaciągały się poprawnie. może da się to jednak wyciągnać? mogę Ci podesłać JSON czy inną zwrotkę którą potrzebujesz do analizy