bacco007 / sensor.opennem

OpenNEM Sensor for Home Assistant
MIT License
11 stars 5 forks source link

Unable to load region qld1 - KeyError: 'gas_wcmg' #6

Closed purcell-lab closed 2 years ago

purcell-lab commented 2 years ago

Version of the custom_component

custom component version: 2021.12.0 HA core-2021.12.0b3

Configuration


- platform: opennem
  region: qld1
  monitored_conditions:
    - battery_charging
    - battery_discharging
    - biomass
    - coal_black
    - coal_brown
    - exports
    - demand
    - distillate
    - fossilfuel
    - renewables
    - generation
    - hydro
    - imports
    - price
    - pumps
    - solar_rooftop
    - solar_utility
    - temperature
    - wind

Describe the bug

I tried to switch from region nsw1 to qld1 reporting KeyError: 'gas_wcmg'

When I switch back to nsw1 everything works fine.

Debug log


Logger: homeassistant.components.sensor
Source: custom_components/opennem/sensor.py:218
Integration: Sensor (documentation, issues)
First occurred: 8:44:57 PM (1 occurrences)
Last logged: 8:44:57 PM

Error while setting up opennem platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/opennem/sensor.py", line 104, in setup_platform
    opennem_data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 195, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/opennem/sensor.py", line 218, in update
    DATA[ftype][2] = units
KeyError: 'gas_wcmg'
purcell-lab commented 2 years ago

Found the issue, upstream have changed some key names, need to include:

bioenergy_biomass gas_wcmg

I'll raise a PR shortly