pawelhulek / pgnig-sensor

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

Add-on can't update invoice data #16

Closed MarcinJanCiesielski closed 2 years ago

MarcinJanCiesielski commented 2 years ago

Sensor can download gas usage but every singel time when it try to get invoice data I get error in HomeAssistant (v2022.4.7 but I noticed the problem in all 2022.04 versions, HACS v1.24.5):

pgnig_gas_sensor: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 735, in async_device_update await task File "/config/custom_components/pgnig_gas_sensor/sensor.py", line 164, in async_update self._state = await self.hass.async_add_executor_job(self.invoicesSummary) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/pgnig_gas_sensor/sensor.py", line 173, in invoicesSummary next_payment_item = min(filter(closestPaymentDate, self.api.invoices().invoices_list), key=lambda z: z) ValueError: min() arg is an empty sequence

pawelhulek commented 2 years ago

@MarcinJanCiesielski What is your PGNIG sensor version? This issues should be fixed in newest version

pawelhulek commented 2 years ago

The same problem was tackled here. https://github.com/pawelhulek/pgnig-sensor/issues/13

MarcinJanCiesielski commented 2 years ago

I read issue #13. In fact I have 1.02 version, but there is no update in hack. Version 1.03 needs to be installed manually?