Emoncms integration not working after first update

Hi all.

I’m having an issue with my emonCMS integration with HA that I’ve been using for some time.

I’ve been updating various parts of my installation, so this may have triggered the problem, but I can’t work out how to diagnose it.

Basically, all of my emonCMS feeds into HA have stopped updating. If I restart HA all of the feeds in HA will update with a fresh value taken from emonCMS but will update no more. This is repeatable by restarting HA.

In the logs, I have the following appearing which I assume is related to the problem, but I don’t know what to do about it. Any thoughts?

Logger: homeassistant.components.sensor
Source: components/emoncms/sensor.py:224
Integration: Sensor (documentation, issues)
First occurred: 09:34:41 (2 occurrences)
Last logged: 09:34:41

Error adding entities for domain sensor with platform emoncms
Error while setting up emoncms platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 442, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 717, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 814, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 566, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 610, in _async_write_ha_state
    attr.update(self.extra_state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/emoncms/sensor.py", line 224, in extra_state_attributes
    ATTR_LASTUPDATETIMESTR: template.timestamp_local(float(self._elem["time"])),
TypeError: float() argument must be a string or a real number, not 'NoneType'

Well I have some progress on my own issue.

I have a large number of feeds in Emoncms. In my HA configuration it is importing everything by default.

I guessed that one of the feeds is disrupting the Emoncms HA component and causing it to crash, hence the log and no further updates.

So I have modified my HA configuration to import only specific feeds and thus far it is working again.

I think I have all the feeds I actually want in HA but if I get time I will work through the others to try and determine which one is causing the problem and if it’s appropriate I will raise a bug.

I have the same problem, out of the blue about three weeks ago my data from Emoncms stopped updating. After a reboot it recovers, but no more. In the second instance of HA, from another instance of Emoncms, everything is updated as it should be, but it’s only five values. I will try to limit only the feeds I need according to the advice.

After further testing, I found that the problem is not the number of feeds, but one feed from Emoncms reports the last value as “NULL” and this started to “break” the whole integration. I disabled the feed from loading using “exclude_feed_id” and everything works fine. I will also add a note that HA pulls 36 feeds from Emoncms.

Makes sense. Be worth listing that as a bug on the developer site if it’s not already.

Regarding the number of feeds you mentioned. Is that a limit you have hit or just a reference to how many you have integrated?

I haven’t reached my feed limit. But based on your post I tested if it exists. Now I’m fine with 36 channels. I didn’t report it as a bug. Until your post helped me understand that I’m not alone in this and at the same time directed me to research what to do with it :slight_smile: