Community
OpenEnergyMonitor

Community

Home Assistant - Error

I am trying to get the Emoncms integration working with Home Assistant. Having been through the process of updating to the emonSD-17Oct19 image (which went flawlessly), I still can’t get Home Assistant to recognise Emoncms.

I have been through the logs and found the following, which seems to be the root of the problem. Does anyone know what this means? I am using the basic setup in configuration.yml (Read API Key, Emonpi ip address and id: 1) accessing my local emonpi.

File "/usr/src/homeassistant/homeassistant/components/emoncms/sensor.py", line 160, in __init__
self._state = round(float(elem["value"]), DECIMALS)
TypeError: float() argument must be a string or a number, not 'NoneType'

Interesting.

Can you post your yaml configuration please.

[edit]
Are any of the feed values in your feed list ‘Null’?

Source code https://github.com/home-assistant/core/blob/dev/homeassistant/components/emoncms/sensor.py

@bwduncan, as the resident Python expert :grin:, could you suggest what might be needed as a check to avoid this error?

Could you also post the result of

http://<your IP>/feed/list.json

I went through my feeds and found two NULL feeds, which I deleted. I had also not spotted that one of my EmonTHs had a flat battery so this might also have been producing NULLs, but I can’t remember now!

Having re-started Home Assistant, the feeds from EmonCMS are now discovered, so I can start playing with them now.

Thanks!

No bother, worth knowing and getting fixed.

I have raised an Issue

Sorry, I don’t know what mechanism HA uses to mark a sensor as unavailable, but checking for ValueError and TypeError would probably be the most appropriate exceptions to catch.

1 Like