Home-Assistant-custom-components-Tauron-AMIplus
Home-Assistant-custom-components-Tauron-AMIplus copied to clipboard
JSON data parsing error when data is not available
I have an access to Tauron meter. The problem is after configuration I get an error:
tauron_amiplus: 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 646, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 277, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/tauron_amiplus/sensor.py", line 209, in _update
self.update_configuration()
File "/config/custom_components/tauron_amiplus/sensor.py", line 245, in update_configuration
config = TauronAmiplusSensor.calculate_configuration(self.username, self.password, self.meter_id,
File "/config/custom_components/tauron_amiplus/sensor.py", line 167, in calculate_configuration
zones = json_data["dane"]["zone"]
KeyError: 'dane'
I double checked the login data and everything should be fine.
This is how my configuration looks like (integration installed via HACS):
sensor:
- platform: tauron_amiplus
name: Tauron AMIPlus
username: !secret tauron_amiplus.username
password: !secret tauron_amiplus.password
energy_meter_id: !secret tauron_amiplus.energy_meter_id
check_generation: true
monitored_variables:
- zone
- consumption_daily
- consumption_monthly
- consumption_yearly
- generation_daily
- generation_monthly
- generation_yearly
When trying to add an integration using Configuration > Integrations > Add integration
, I am confused. It wants me to add "Punkt poboru" which is different value from meter ID. So, when using YAML I set my meter ID taken from Licznik / HANplus > Numer licznika
, but when using UI I am asked for Punkt poboru
that is visible somewhere on the top?
The possible problem can be here. When I call https://elicznik.tauron-dystrybucja.pl/index/charts
(ofc being logged in) I get only:
{
"ok": 0
}
Maybe routing changed?
Please check out this issue: #21
Ok, so I understand I need to wait until the data is updated. Shouldn't it be handled in some way just not to throw any errors?
It should :D But who has time for that
I will try to make a PR in my spare time :)