Met Office Sensor not working

Is anyone else having problems the the new Met Office sensor in 0.42.2?
I just get lots of errors in the log I can post them if needed but thought I would ask first in case its a known problem.

The Met Office Weather platform works fine so my API key is ok.

1 Like

Iā€™ve just tried to set it up, and itā€™s not working for me either. In the logs I see the following message a few times:

AttributeError: ā€˜MetOfficeCurrentDataā€™ object has no attribute ā€˜lastupdateā€™


I also tried the Met Office weather platform, and that works fine with my API key.

1 Like

Since Iā€™m a newbie with HA, I may not be doing this right. I also have no experience of python (though I use C for most of my other programming)

I also had the captioned problem though the default yr was working fine.
Looking at the error ā€™
AttributeError: ā€˜MetOfficeCurrentDataā€™ object has no attribute ā€˜lastupdateā€™
I noted that in the file
/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/metoffice.py

that line 144 (attr[ā€˜Last Updateā€™] = self.data.lastupdate) is not accessible and probably does not get initialised anyway.

Now I have commented (#) out line 144 and hey-presto, the met office figures appear as per the component description.

Whether this is the right thing to do, Iā€™m not sure.

1 Like

I will give that a try later thanks for that.

This looks like itā€™s fixed in 46.1 canā€™t seem to download that for some reason!
This is the fix.

Thanks @daveyrb and @cyberjacob for the proper solution. I have modified my version of the above file as per 46.1 and all seems to be fine.

Further to my last missive, I have seen errors in the HomeAssistant log daily at about 01:23BST for a few minutes. It seems that Met Office goes offline for a while (presumably for their updates) and is not a specific fault, so far as I can tell, with the HomeAssistant metoffice component. I have posted this mornings log for this error for reference below.

If updates are 3hourly then Iā€™m probably just unlucky that the MO updates are unavailable. I donā€™t think that Iā€™m running into an update limit as has happened with the Wunderground component.

Is there a way to stop these error reports? For example by stopping HA/MO online updates for a period?

2017-06-13 01:23:36 ERROR (MainThread) [homeassistant.components.sensor] Error while update entity from metoffice in sensor Traceback (most recent call last): File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 437, in _update_entity_states yield from update_coro File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 238, in async_update_ha_state state = self.state File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/metoffice.py", line 122, in state if self._condition in self.data.data.__dict__.keys(): AttributeError: 'bool' object has no attribute '__dict__' 2017-06-13 01:23:36 ERROR (MainThread) [homeassistant.components.sensor] Error while update entity from metoffice in sensor Traceback (most recent call last): File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 437, in _update_entity_states yield from update_coro File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 238, in async_update_ha_state state = self.state File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/metoffice.py", line 122, in state if self._condition in self.data.data.__dict__.keys(): AttributeError: 'bool' object has no attribute '__dict__' 2017-06-13 01:23:36 ERROR (MainThread) [homeassistant.components.sensor] Error while update entity from metoffice in sensor Traceback (most recent call last): File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 437, in _update_entity_states yield from update_coro File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 238, in async_update_ha_state state = self.state File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/metoffice.py", line 122, in state if self._condition in self.data.data.__dict__.keys(): AttributeError: 'bool' object has no attribute '__dict__' 2017-06-13 01:23:36 ERROR (MainThread) [homeassistant.components.sensor] Error while update entity from metoffice in sensor Traceback (most recent call last): File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 437, in _update_entity_states yield from update_coro File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 238, in async_update_ha_state state = self.state File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/metoffice.py", line 122, in state if self._condition in self.data.data.__dict__.keys(): AttributeError: 'bool' object has no attribute '__dict__' 2017-06-13 01:23:36 ERROR (MainThread) [homeassistant.components.sensor] Error while update entity from metoffice in sensor Traceback (most recent call last): File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 437, in _update_entity_states yield from update_coro File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 238, in async_update_ha_state state = self.state File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/metoffice.py", line 122, in state if self._condition in self.data.data.__dict__.keys(): AttributeError: 'bool' object has no attribute '__dict__'