I’m experimenting with writing a simple entity that grabs the state of another entity. As an experiment I’ve started by modifying the generic temperature sensor to pull the temperature value out of the state of my heatpump entity. However, the code I’m currently testing returns None as the state value. See line 72 of the code posted here:
and the logs returned:
2018-03-11 04:05:23 WARNING (MainThread) [custom_components.sensor.heatpump_temp] hp name: climate.1st_fl_heatpump, state: None
2018-03-11 04:05:24 ERROR (MainThread) [homeassistant.components.sensor] Error on device update!
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 217, in async_add_entity
yield from entity.async_device_update(warning=False)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 304, in async_device_update
yield from self.async_update()
File "/usr/lib/python3.5/asyncio/coroutines.py", line 210, in coro
res = func(*args, **kw)
File "/home/homeassistant/.homeassistant/custom_components/sensor/heatpump_temp.py", line 75, in async_update
self._state = heatpump_states.attributes.get('current_temperature')
AttributeError: 'NoneType' object has no attribute 'attributes'
From the logs, when I try to output what I would hope would be a state object, I get None, then error out when I try to look for attributes in a None.
I’ve verified by cut and paste that climate.1st_fl_heatpump is an entity in my States > Entities page of HA.