bremor / bureau_of_meteorology

Custom component for retrieving weather information from the Bureau of Meteorology.
MIT License
190 stars 31 forks source link

Errors in log after, I think, update to latest version #156

Closed sddgit closed 2 years ago

sddgit commented 2 years ago

I just updated to 1.1.17, and see the following in the logs:

Logger: homeassistant.components.sensor
Source: custom_components/bureau_of_meteorology/sensor.py:176 
Integration: Sensor (documentation, issues) 
First occurred: 18:20:49 (2 occurrences) 
Last logged: 18:20:49

Error adding entities for domain sensor with platform bureau_of_meteorology
Error while setting up bureau_of_meteorology platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
    original_device_class=entity.device_class,
  File "/config/custom_components/bureau_of_meteorology/sensor.py", line 176, in device_class
    return SENSOR_NAMES[self.sensor_name][1]
KeyError: 'temp_max_observed'

I don’t believe this was there before the update, but can’t be certain. Running HA 2022.9.7.

Makin-Things commented 2 years ago

Thanks for reporting. I have had a quick look and it appears the BoM may have altered the format of the data being served up. The most recent change could not have caused this as it just changed a string format in a completely different part of the code.

I will look into it in more detail tomorrow. I suspect the fix will result in the sensors changing name :(

sddgit commented 2 years ago

Thank you for looking into this so quickly.

Makin-Things commented 2 years ago

Ok, I actually think I made a mistake when I first added those sensors in 1.1.15. I have released a pre-release 1.1.18b0 with a fix, can you test it. You will need to reconfigure the integration (just hit submit on each dialog, although the min/max observation options may be turned off, so turn them back on). Let me know if it works.

sddgit commented 2 years ago

Is there a way to get HACS to install this beta, rather than installing it manually?

Makin-Things commented 2 years ago

Yes. Click the hamburger and select redownload. image

sddgit commented 2 years ago

Sorry - should have known that!

I updated to the beta and restarted HA, then went through the configuration again. It got an error, but stupid me didn’t take note of it. I think it was to do with one of the temp sensors. So I deleted the Integration from HA (not from HACS), reinstalled it, and configured it. All is well, and no errors on the log. Thank you!

Makin-Things commented 2 years ago

Yep. I saw that error and removing the instance of the integration and recreating it is the simplest solution. I am about to release the non-beta version of 1.1.18 with the fix.