pawelhulek / pgnig-sensor

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

Brak odczytów - stan czujników "nieznany" #53

Closed DEF2-E86A closed 9 months ago

DEF2-E86A commented 9 months ago

Od jakiś paru tygodni stan czujników pokazuje się jako nieznany. Wydaje mi się, że stało się to w momencie kiedy dodałem drugi punkt odbioru ale może to tylko zbieg okoliczności. Wcześniej działało normalnie przez kilka miesięcy aż się wysypało.

W logach odnalazłem taki wpis:

Error while setting up pgnig_gas_sensor platform for sensor 19 października 2023 21:40:28 – (BŁĘDY) Sensor (niestandardowa integracja) - wiadomość pojawiła się po raz pierwszy 19 października 2023 19:45:25 i powtarzała się 7 razy

Jak wejdziemy w szczegóły to wygląda to tak:

Logger: homeassistant.components.sensor Source: custom_components/pgnig_gas_sensor/sensor.py:40 Integration: Sensor (documentation, issues) First occurred: 19 października 2023 19:45:25 (7 occurrences) Last logged: 19 października 2023 21:40:28

Error while setting up pgnig_gas_sensor platform for sensor Traceback (most recent call last): File "/config/custom_components/pgnig_gas_sensor/sensor.py", line 38, in async_setup_entry pgps = await hass.async_add_executor_job(api.meterList) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/pgnig_gas_sensor/PgnigApi.py", line 31, in meterList return ppg_list_from_dict(dictionary) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/pgnig_gas_sensor/PgpList.py", line 142, in ppg_list_from_dict return PpgList.from_dict(s) ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/pgnig_gas_sensor/PgpList.py", line 122, in from_dict ppg_list = from_list(PpgListElement.from_dict, obj.get("PpgList")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/pgnig_gas_sensor/PgpList.py", line 26, in from_list return [f(y) for y in x] ^^^^^^^^^^^^^^^^^ File "/config/custom_components/pgnig_gas_sensor/PgpList.py", line 26, in return [f(y) for y in x] ^^^^ File "/config/custom_components/pgnig_gas_sensor/PgpList.py", line 72, in from_dict reading_date_utc = from_datetime(obj.get("ReadingDateUtc")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/pgnig_gas_sensor/PgpList.py", line 16, in from_datetime return dateutil.parser.parse(x) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/dateutil/parser/_parser.py", line 1368, in parse return DEFAULTPARSER.parse(timestr, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/dateutil/parser/_parser.py", line 640, in parse res, skipped_tokens = self._parse(timestr, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/dateutil/parser/_parser.py", line 719, in _parse l = _timelex.split(timestr) # Splits the timestr into tokens ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/dateutil/parser/_parser.py", line 201, in split return list(cls(s)) ^^^^^^ File "/usr/local/lib/python3.11/site-packages/dateutil/parser/_parser.py", line 69, in init raise TypeError('Parser must be a string or character stream, not ' TypeError: Parser must be a string or character stream, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/pgnig_gas_sensor/sensor.py", line 40, in async_setup_entry raise ValueError ValueError

pawelhulek commented 9 months ago

@DEF2-E86A Wyglada na to ze brakuje jednego pola w odpowiedzi na liscie liczników.

Miałes juz odczyt tego nowego licznika. Mam wrazenie ze to powinno naprawic sytuacje.

Mimo tego przygotuje wersje beta z fixem. Czy chciałbys przetestowac?

pawelhulek commented 9 months ago

Wystawione w ramach @DEF2-E86A bardzo prosze o testy i feedback image

pawelhulek commented 9 months ago

Bardzo prosze o sprawdzenie: V2.3.5_beta_2

DEF2-E86A commented 9 months ago

image

Po wgraniu beta-2 dane pojawiły się jak na zdjęciu. Ciekawy jestem co się stanie jak dostanę rachunek z drugiego punktu odbioru. Póki co dziękuje! Dam znać jak przyjdą kolejne faktury.

pawelhulek commented 9 months ago

@DEF2-E86A To jak dziala to wupuszcze nowa wersje final - obecna to jest beta.

pawelhulek commented 9 months ago

Poprawione w https://github.com/pawelhulek/pgnig-sensor/releases/v2.3.5

pawelhulek commented 8 months ago

@DEF2-E86A Prawdopodobnie napotkałes na ten sam problem który ma część klientów PGNIG: https://github.com/pawelhulek/pgnig-sensor/issues/43 jeśli nie masz wartosc wear na endpoincie https://ebok.pgnig.pl/crm/get-invoices-v2?pageNumber=1&pageSize=12&api-version=3.0 to moze sie okazac ze nie bedziesz w stanie przeliczyc ceny gazu na m3

pawelhulek commented 8 months ago

DOdam tylko ze naprawienie tego wymaga przebudowania calego sensora. Pewnie kiedys sie za to zabiorę, ale nie jest to teraz moim priorytetem. Natomiast jak najbardziej zapraszam wszystkich chetnych do kontrybucji