firstof9 / ha-openei

OpenEI integration for Home Assistant
MIT License
15 stars 2 forks source link

[BUG] Adjustments not showing for Public Service Co of Colorado TOU rates #76

Closed phidauex closed 12 months ago

phidauex commented 12 months ago

Version of ha-openei

0.1.12 on HA Core 2023.11.0

Describe the bug

Adjustments to the rate are not added as a sensor, at least for Public Service Co of CO, Residential TOU rate. Current Energy rate is correctly retrieved. It looks like this feature was added in 0.1.8, but perhaps there has been a field name change since then?

TOU rate link: https://apps.openei.org/USURDB/rate/view/62f12eaa7a464314265d3c76#3__Energy

Rates on OpenEI:

image

Sensors in HA:

image

Expected result is a sensor sensor.public_service_co_of_colorado_Current Adjustment rate, and if possible, a sum of the Current Energy and Current Adjustment rates (though that could be done in a template later if needed).

Logs

Two error logs show up, though they are somewhat cryptic:

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:507
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 11:34:31 PM (1 occurrences)
Last logged: 11:34:31 PM
Error adding entities for domain sensor with platform openei

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 677, in _async_add_entity
    unit_of_measurement=entity.unit_of_measurement,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 485, in unit_of_measurement
    native_unit_of_measurement
TypeError: unhashable type: 'list'

and

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:367
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 11:34:31 PM (1 occurrences)
Last logged: 11:34:31 PM
Error while setting up openei platform for sensor

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 677, in _async_add_entity
    unit_of_measurement=entity.unit_of_measurement,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 485, in unit_of_measurement
    native_unit_of_measurement
TypeError: unhashable type: 'list'
firstof9 commented 12 months ago

Please see if the latest release solves your issue, looks like I mixed up the branches when doing a release a few releases back.

phidauex commented 12 months ago

Wow, that was fast! Yes, the adjustments sensor is loading now, and has the correct value for the time of day. Thanks!