PiotrMachowski / Home-Assistant-custom-components-Tauron-AMIplus

This sensor uses unofficial API to get energy usage and generation data from https://elicznik.tauron-dystrybucja.pl.
MIT License
128 stars 34 forks source link

Log Details (ERROR) #123

Closed adamj3000 closed 1 year ago

adamj3000 commented 1 year ago

Hi Piotr,

Can you help with below error? please

This error originated from a custom integration.

Logger: custom_components.tauron_amiplus.coordinator Source: custom_components/tauron_amiplus/connector.py:193 Integration: Tauron AMIplus (documentation, issues) First occurred: 04:03:46 (2 occurrences) Last logged: 04:04:00

Unexpected error fetching tauron_amiplus data: 'allData' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 250, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/tauron_amiplus/coordinator.py", line 29, in _async_update_data data = await self.hass.async_add_executor_job(self._update) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/tauron_amiplus/coordinator.py", line 40, in _update return self.connector.get_raw_data() File "/config/custom_components/tauron_amiplus/connector.py", line 103, in get_raw_data data.consumption = self.get_data_set(generation=False) File "/config/custom_components/tauron_amiplus/connector.py", line 115, in get_data_set dataset.json_daily, dataset.daily_date = self.get_values_daily(generation) File "/config/custom_components/tauron_amiplus/connector.py", line 193, in get_values_daily while offset <= CONST_MAX_LOOKUP_RANGE and (data is None or len(data["data"]["allData"]) < 24): KeyError: 'allData'

PiotrMachowski commented 1 year ago

Duplicate of #122

adamj3000 commented 1 year ago

Hi Piotr,

Thank you for your quick reply. I am sorry but I am new to this, you mean to delete line 122 from connector.py ?

image

the second question I have is regarding calculating energy as a prosument. Where do I copy below code ? and do I need to modify anything in below code ?

input_number:
  initial_energy_bank:
    min: 0
    max: 100000000
    step: 1
    mode: box
template:
  - sensor:
      - name: Tauron energy bank
        state_class: total
        device_class: energy
        unique_id: tauron_energy_bank
        icon: mdi:home-battery-outline
        state: "{{ (states('input_number.initial_energy_bank') | float(0) + states('sensor.tauron_amiplus_123_yearly_energy_generation') | float(0) * 0.8 - states('sensor.tauron_amiplus_123_yearly_energy_consumption') | float(0)) | round(3) }}"
        unit_of_measurement: "kWh"
        availability: "{{ states('sensor.tauron_amiplus_123_yearly_energy_generation') | is_number and states('sensor.tauron_amiplus_123_yearly_energy_consumption') | is_number }}"

Thank you again, AJ

PiotrMachowski commented 1 year ago

I am sorry but I am new to this, you mean to delete line 122 from connector.py ?

No, I mean that an issue for this problem has been already created here

the second question I have is regarding calculating energy as a prosument. Where do I copy below code ? and do I need to modify anything ?

You have to put it in configuration.yaml after adjusting entity ids (sensor.tauron_amiplus_123_yearly_energy_generation, sensor.tauron_amiplus_123_yearly_energy_consumption)

adamj3000 commented 1 year ago

Super, Dziękuję nie bylem pewien czy piszemy tu po PL. Wszystko masz napisane po ANG.

Trzymam kciuki bo integracja mega!

Pozdrawiam, AJ

PiotrMachowski commented 1 year ago

Piszemy tak, jak zostało zgłoszone issue 😉 ta integracja nie jest zbyt międzynarodowa, także nie wymagam pisania po angielsku