hubtub2 / ha_custom_components

Custom components for Home Assistant
10 stars 7 forks source link

Error while setting up eta_heating platform for sensor #13

Closed markthebro closed 9 months ago

markthebro commented 9 months ago

Hi,

I have setup Home Assistant as a docker container on a Raspberry Pi 4 running Debian 11. Docker-Version: 25.0.3 Home Assistant Core: 2024.2.2 Home Assistant Frontend: 20240207.1 I'm using the ETA Twin 20kW - Version of REST API is 1.2

The /config is mounted locally on /home/pi/homeassistant-config - so the output of this directory looks like that:

root@raspberrypi:~# ll /home/pi/homeassistant-config /home/pi/homeassistant-config/custom_components/eta/
/home/pi/homeassistant-config:
total 984
-rw-r--r-- 1 root root      2 Feb 20 19:10 automations.yaml
drwxr-xr-x 4 root root   4096 Feb 20 19:10 blueprints
-rw-r--r-- 1 root root    408 Feb 20 19:47 configuration.yaml
drwxr-xr-x 3 root root   4096 Dec  7 16:20 custom_components
drwxr-xr-x 2 root root   4096 Feb 20 19:09 deps
-rw-r--r-- 1 root root   2220 Feb 20 20:00 home-assistant.log
-rw-r--r-- 1 root root   2220 Feb 20 19:50 home-assistant.log.1
-rw-r--r-- 1 root root      0 Feb 20 20:00 home-assistant.log.fault
-rw-r--r-- 1 root root 421888 Feb 20 20:00 home-assistant_v2.db
-rw-r--r-- 1 root root  32768 Feb 20 20:01 home-assistant_v2.db-shm
-rw-r--r-- 1 root root 515032 Feb 20 20:01 home-assistant_v2.db-wal
-rw-r--r-- 1 root root      0 Feb 20 19:10 scenes.yaml
-rw-r--r-- 1 root root      0 Feb 20 19:10 scripts.yaml
-rw-r--r-- 1 root root    161 Feb 20 19:10 secrets.yaml
drwxr-xr-x 2 root root   4096 Feb 20 19:10 tts

/home/pi/homeassistant-config/custom_components/eta/:
total 24
-rw-r--r-- 1 root root  139 Dec  7 16:20 __init__.py
-rw-r--r-- 1 root root  231 Dec  7 16:20 manifest.json
drwxr-xr-x 2 root root 4096 Feb 20 19:50 __pycache__
-rw-r--r-- 1 root root 5677 Dec  7 16:20 sensor.py
-rw-r--r-- 1 root root 1276 Dec  7 16:20 sensors_default.py
root@raspberrypi:~#

After starting the HA-Container I get the following error:

[19:00:08] INFO: Home Assistant Core finish process exit code 0
[19:00:08] INFO: Home Assistant Core service shutdown
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun home-assistant (no readiness notification)
s6-rc: info: service legacy-services successfully started
2024-02-20 20:00:14.198 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration eta_heating which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-02-20 20:00:25.699 WARNING (MainThread) [homeassistant.const] TEMP_CELSIUS was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:00:25.705 WARNING (MainThread) [homeassistant.const] POWER_KILO_WATT was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.KILO_WATT instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:00:25.711 WARNING (MainThread) [homeassistant.const] MASS_KILOGRAMS was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfMass.KILOGRAMS instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:00:25.720 WARNING (MainThread) [homeassistant.const] ENERGY_KILO_WATT_HOUR was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfEnergy.KILO_WATT_HOUR instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:00:27.021 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up eta_heating platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eta/sensor.py", line 87, in setup_platform
    EtaSensor(config, hass, sensor.get('name'), sensor.get('uri'), sensor.get('unit'), sensor.get('state_class'),
  File "/config/custom_components/eta/sensor.py", line 140, in __init__
    serial1 = serial1['eta']['value']['@strValue']
              ~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'value'

I don't know if this helps, but please find attached the output of /user/menu of the API as well. menu.xml.txt

Thanks in advance for your help.

Best regards, Markus

markthebro commented 9 months ago

OK - After changing the lines 135+136 in sensor.py I get rid of this error message, but got now a new one...

Before:

        serial1 = requests.get(get_base_url(config, VAR_PATH) + "/40/10021/0/0/12489")
        serial2 = requests.get(get_base_url(config, VAR_PATH) + "/40/10021/0/0/12490")

After:

        serial1 = requests.get(get_base_url(config, VAR_PATH) + "/48/10391/0/0/12489")
        serial2 = requests.get(get_base_url(config, VAR_PATH) + "/48/10391/0/0/12490")

Based on the code / comment the serial number is needed - well, on the ETA Twin the serial number has a different URI. (ref. to attachment from orig. post).

Anyway - here are now the new messages....


2024-02-20 20:15:46.261 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration eta_heating which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-02-20 20:15:58.888 WARNING (MainThread) [homeassistant.const] TEMP_CELSIUS was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:15:58.894 WARNING (MainThread) [homeassistant.const] POWER_KILO_WATT was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.KILO_WATT instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:15:58.900 WARNING (MainThread) [homeassistant.const] MASS_KILOGRAMS was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfMass.KILOGRAMS instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:15:58.905 WARNING (MainThread) [homeassistant.const] ENERGY_KILO_WATT_HOUR was used from eta, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfEnergy.KILO_WATT_HOUR instead, please report it to the author of the 'eta' custom integration
2024-02-20 20:16:02.933 ERROR (MainThread) [homeassistant.components.sensor] Platform eta_heating does not generate unique IDs. ID eta_1.62508.unknown is already used by sensor.eta_unknown - ignoring sensor.eta_unknown
2024-02-20 20:16:02.933 ERROR (MainThread) [homeassistant.components.sensor] Platform eta_heating does not generate unique IDs. ID eta_1.62508.unknown is already used by sensor.eta_unknown - ignoring sensor.eta_unknown
2024-02-20 20:16:02.933 ERROR (MainThread) [homeassistant.components.sensor] Platform eta_heating does not generate unique IDs. ID eta_1.62508.unknown is already used by sensor.eta_unknown - ignoring sensor.eta_unknown
2024-02-20 20:16:02.935 ERROR (MainThread) [homeassistant.components.sensor] Platform eta_heating does not generate unique IDs. ID eta_1.62508.unknown is already used by sensor.eta_unknown - ignoring sensor.eta_unknown
2024-02-20 20:16:02.935 ERROR (MainThread) [homeassistant.components.sensor] Platform eta_heating does not generate unique IDs. ID eta_1.62508.unknown is already used by sensor.eta_unknown - ignoring sensor.eta_unknown
2024-02-20 20:16:32.974 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.eta_unknown fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1261, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eta/sensor.py", line 155, in update
    self._attr_native_value = round(int(data['eta']['value']['#text']) * self.factor / int(data['eta']['value']['@scaleFactor']), int(data['eta']['value']['@decPlaces']))
                                        ~~~~~~~~~~~^^^^^^^^^
KeyError: 'value'
2024-02-20 20:16:33.018 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.eta_gesamt_energieverbrauch fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1261, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eta/sensor.py", line 155, in update
    self._attr_native_value = round(int(data['eta']['value']['#text']) * self.factor / int(data['eta']['value']['@scaleFactor']), int(data['eta']['value']['@decPlaces']))
                                        ~~~~~~~~~~~^^^^^^^^^
KeyError: 'value'
2024-02-20 20:17:02.997 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.eta_unknown fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1261, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eta/sensor.py", line 155, in update
    self._attr_native_value = round(int(data['eta']['value']['#text']) * self.factor / int(data['eta']['value']['@scaleFactor']), int(data['eta']['value']['@decPlaces']))
                                        ~~~~~~~~~~~^^^^^^^^^
KeyError: 'value'
2024-02-20 20:17:03.049 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.eta_gesamt_energieverbrauch fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1261, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eta/sensor.py", line 155, in update
    self._attr_native_value = round(int(data['eta']['value']['#text']) * self.factor / int(data['eta']['value']['@scaleFactor']), int(data['eta']['value']['@decPlaces']))
                                        ~~~~~~~~~~~^^^^^^^^^
KeyError: 'value'
2024-02-20 20:17:32.989 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.eta_unknown fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1261, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eta/sensor.py", line 155, in update
    self._attr_native_value = round(int(data['eta']['value']['#text']) * self.factor / int(data['eta']['value']['@scaleFactor']), int(data['eta']['value']['@decPlaces']))
                                        ~~~~~~~~~~~^^^^^^^^^
KeyError: 'value'
markthebro commented 9 months ago

OK - Found another Repo (Fork) which seems to work: https://github.com/nigl/homeassistant_eta_integration