Emoncms Home Assistant

Tags: #<Tag:0x00007f56c0054560>

Nice work! This is really cool, I really like what you’re doing with HA. I wrote a blog post a while back when I experimented with HA running on our emonPi unit.

Do you have a link to the Emoncms > HA documentation page. I will list it on our integrations page: . I can’t seem to find emoncms listed under the ‘energy’ section ?

We have also based our user guide and blog on the same Oscalite theme that the HA website uses. Greatest form of flattery?! :wink:

Hi glyn,

It’s still a pull request, it hasn’t come live yet.
you can check the pull request for the code here and the pull request for the documentation here . I made the screenshots from running a preview of the website locally on my computer so it has not come live yet.

I’ll notify you once it does.

Previously i was also running ha integration through mqqt & mqqt sensors but the problem was that you had to send the data to mqqt from emoncms and for each value you wanted in home assistant you had to create an mqqt sensor. This component just needs one or a few configuration entries in home assistant and you don’t need to send the data through mqqt which makes it a bit easier to add multiple sensors at once and is not that time consuming.

another solution was using a feed api and a rest sensor but this had the same problem of needing to specify a new (rest) sensor for each value you wanted to see in home assistant

Also i managed to reduce my cpu usuage on my intel nuc running mosquito, hass and emoncms by 10-15% by not sending the mqqt messages anymore from emoncms and not using a mqqt sensor. My database disk usage went also down in home assistant.

The problem i had was that emoncms sent a new mqqt message whenever it had gotten data and reacted to it. Now this component i can specify an update interval for the sensor (default 30 secs) so it only updates then and not every time emoncms sends an mqqt message. The only downside which imo is not that big of a deal is you don’t see the last value immediatly while you did when using the mqqt system

1 Like

@glyn.hudson the Pull request as well as the documentation got accepted. It won’t be listed under energy though but under sensor. The latest version of the component is already availible using the dev branch of home assistant. As soon as there is a new home assistant version (that will include it) i’ll give you a private message with the link to the documentation. I don’t know their realease shedules though so not sure how long it would take

Great, thanks! Nice work

  • sent from my mobile device

@glyn.hudson someone using hass had a very nice idea … an extra history component for emons inside hass. There are a few other components like this for hass already like for example the one.

Basically a history component monitors for state changes of entities for example if a sensor’s value changes the component detects it. The emoncms_history component then uses the input api of emoncms to log a json value to a specific node value with the entityid as name and the changed value as input value for emoncms

In practise this would allow hass to send any sensor’s data ever being made to emoncms.

The use case of the person in question was that he has a “zwave energy meter sensors” and “ecobee temperature sensors” and then those devices data can be send to emoncms with the component acting as a bridge between the device and emoncms.

so if people have perhaps energy loggers that are supported in home assistant but there does not exist some kind of tool to submit the data to emoncms but there does exist a component in hass that displays numerical data, this new component can then be used as a bridge to get the values inside emoncms and do whatever you like with it afterwards in emoncms (creating feeds / graphs / dashboards etc)

If i had known about this myselve for example i wouldn’t had to create a tool in windows to send my nuc cpu use ram use disk use etc to emoncms as i could have used this component then :slight_smile:

same goes for wemo insight switches to send the power usuage data to emoncms.

it opens up a whole lot of possibilities

edt: pull request created:


figured something else out…

you can directly view the dashboards from emoncms inside home assistant by making them public and using an iframe panel comonent :slight_smile:

I tried linking to the dashboard without making it public but providing the readapikey but for some reason some of the widgets did not display then so i guess if you want to do this you’d have to make it public

a few example screenshots

1 Like

@glyn.hudson Home Assistant 29.1 just got released. The emoncms feeds sensor is included the history component is not yet, that will be for the next release once the pr gets accepted.

The documentation for the emon cms sensor is availible here

once the history component gets released i’ll report as well

A post was split to a new topic: Home Assistant emonSD

A post was merged into an existing topic: Home Assistant emonSD

Quick update the emoncms_history component for home assistant got accepted and is due to release in ha 0.31 (normally this weekend, guessing saturday)

Nice :thumbsup:

How does the Emoncms history component work in HA?

You specify the write api key, base url (like or your local installation), an input node id, optional scan interval and whitelisted entities in the config. Entities are like sensors for example temprature power meters etc

What it does then is every “Scan interval” seconds it will gather all whitelisted entities states (values) and try to convert it to a numeric value place it all in the json format like {entitiy1:entity1value,entitiy2:entity2value,…} and use http post using the data parameter (input api) to send the data to emoncms on the chosen input node id in the config.

That’s basically all it does and how it works.

The default scan interval is set at 30 seconds so every 30 seconds it would send data to emoncms but users can lower this value or make multiple emoncms_history sensor config’s each with their own scan interval (for example one with whitelisted entities that don’t change much with a higher scan interval and another with one that changes a lot with lower scan itnerval).

This makes it possible to send every (current) number value from components like sensors etc to emoncms to create feeds, graphs, dashboards etc for it afterwards.

So if somone has a zwave power reading outlet and uses home assistant to read its value they can send the power value to emoncms using this component. But it’s not just for power values any numeric value can be send and dashboards can be created for it or the data can be kept in feeds for historical data etc.

there currently is a bug in home assistant with the wemo insights so that it does not update the power value when it changes (it’s reported) but if that’s fixed you can create a template sensor that gets this power value and then you can add the (template) sensor to the whitelisted entities in emoncms_history component so then you can send power values from wemo insights to emoncms and don’t need any self made code to send the values to emoncms (like i did in the past).

or send the temprature data from open weather map to emoncms anything you can think of basically as long as home assistant supports it and it’s a numeric value it can be send to emoncms

1 Like

I am trying to bring in emonpi.local data in to my Home Assistant / hassio dashboard, which is running on a separate Raspberry Pi. I have been following the guide on but I keep getting an error. The Feed id of 106 is what I see when I hover over the Feed (Office Temp) within my emonpi.local

The error log states

Log Details (ERROR)
Mon Dec 09 2019 13:17:54 GMT+0000 (GMT)
HTTPConnectionPool(host='emonpi.local', port=80): Max retries exceeded with url: /feed/list.json?apikey=*my emonpi.local read API is redacted here* (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f86639e10>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

Does anyone know what I should use in place of http://emonpi.local which I think is what the issue is?

TIA, Julian

PS: This is what my config.yaml looks like …

  - platform: emoncms
    api_key: *my emonpi.local read API is redacted here*
    url: http://emonpi.local
    scan_interval: 300
    id: 1
    unit_of_measurement: "ºC"
      - 106


Mmmm, never found this component before and I use HA quite a lot!!!

HA has moved on a lot since this was created so it is very possible it is now broken.

Try the IP address?

I currently post everything from EmonCMS to an ‘output’ MQTT topic which I pick up in HA.

I’m about to (over Christmas) move my HA install to a new 4Gb RPi 4 with an HDD. I’ll have a play with the node then.

Just tried it, works fine with an IP such as

Thanks @borpin ; I have finally managed to get it to work - and for the possible benefit of others following in the future, this is what I needed to include…

  - platform: emoncms
    api_key: XXmyAPI_read_key_redactedXX
    id: 1
    unit_of_measurement: "C"
      - 106

For me, the inclusion of the trailing /emoncms made all the difference.

Yee Gads, this is all very exciting when I get it to work :grinning:

There have been some changes in the Apache config so yes, sometimes you need the trailing emoncms, depends on when the install was done. It is the same for the HTTP interfacer in emonhub.

1 Like