# Emon and Home assistant integration

**URL:** <https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130>\
**Category:** Emoncms\
**Created:** [27 January 2020 12:41 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130 "2020-01-27T12:41:15Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxlees](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/f/59ef9b/32.png) [@foxlees](https://community.openenergymonitor.org/u/foxlees)\
**Post date:** [27 January 2020 12:41 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/1 "2020-01-27T12:41:16Z")

</div>

Hi, I have just installed a ecompi and a ecom TX I use Home assistant on a separate Ras Pi and have MQTT running on that device to intergrate with other devices, I would like to feed my Power usage from the Ecompi and TX into Home assistant, has nyone done this and if so can they give me a few pointers and maybe some example configs.  
Thanks in advance  
Simon

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [27 January 2020 14:11 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/2 "2020-01-27T14:11:30Z")

</div>

Hi, Welcome.

Under the Input processes, there is the ability to publish to MQTT. choose a suitable publish topic (not `emon`) and then configure HA to pick up that MQTT topic.

---

<div class="post-metadata">

**Author:** ![foxlees](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/f/59ef9b/32.png) [@foxlees](https://community.openenergymonitor.org/u/foxlees)\
**Post date:** [27 January 2020 16:27 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/3 "2020-01-27T16:27:50Z")

</div>

Thanks Brian, little confused, my MQTT broker is in HA has a separate Username and password,  
Do zi replace the one in Emonpi config with the HA broker details.  
Also you mention to create a separate topic not Emon, where is that done

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [27 January 2020 16:44 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/4 "2020-01-27T16:44:50Z")

</div>

> [@foxlees](#):
>
> my MQTT broker is in HA has a separate Username and password,

Emoncms will only publish/subscribe to one MQTT broker, by default the one installed on the EmonPi. You could get Emoncms to talk to just the HA MQTT broker instead. Change the settings in the `settings.ini` file in the `/var/www/emoncms/` folder. You will also need to edit `emonhub` (from the menu in Emoncms) to also use the HA MQTT Broker.

On the **Inputs** page, click on the spanner next to the input you want to export. Under the processes available you will find

![image](https://community.openenergymonitor.org/uploads/default/original/2X/3/31057047f1cc4d285175438645dff56b0ff60ebf.png)

You specify the published topic in the text box.

---

<div class="post-metadata">

**Author:** ![foxlees](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/f/59ef9b/32.png) [@foxlees](https://community.openenergymonitor.org/u/foxlees)\
**Post date:** [27 January 2020 20:17 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/5 "2020-01-27T20:17:23Z")

</div>

Thanks again, I have added the publish to MQTT in the input of one of the feeds.  
I understand where to change the settings in the config emonhub.  
I have a MAC is there a way to install SAMBA or simular so I can use the Finder window rather than through a terminal,  
also if I make these changes do the feeds and inputs still appear in emoncms local and online cloud?

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [28 January 2020 07:25 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/6 "2020-01-28T07:25:17Z")

</div>

> [@foxlees](#):
>
> I have a MAC is there a way to install SAMBA

SAMBA is a PITA IMHO! much easier to just SSH.

---

<div class="post-metadata">

**Author:** ![Bill.Thomson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/bill.thomson/32/1834_2.png) [@Bill.Thomson](https://community.openenergymonitor.org/u/Bill.Thomson)\
**Post date:** [28 January 2020 14:11 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/7 "2020-01-28T14:11:03Z")

</div>

> [@foxlees](#):
>
> is there a way to install SAMBA

Have you tried a Google (or your preferred search engine) search?

---

<div class="post-metadata">

**Author:** ![wyx087](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/wyx087/32/12653_2.png) [@wyx087](https://community.openenergymonitor.org/u/wyx087)\
**Post date:** [28 January 2020 15:34 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/8 "2020-01-28T15:34:39Z")

</div>

Home assistant already have emoncms integration.

> **[Emoncms](https://www.home-assistant.io/integrations/emoncms/)**
>
> Instructions on how to integrate Emoncms feeds as sensors into Home Assistant.

I’m using this integration with my new Emonpi setup, works great.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [28 January 2020 16:27 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/9 "2020-01-28T16:27:20Z")

</div>

> [@wyx087](#):
>
> Home assistant already have emoncms integration.

Every day a learning day.

I didn’t know that!

Cheers

[edit]  
OK my memory is definitely on the blink

> [@Emoncms Home Assistant](https://community.openenergymonitor.org/t/emoncms-home-assistant/1667/14):
>
> 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.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [28 January 2020 18:06 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/10 "2020-01-28T18:06:50Z")

</div>

I had another look at the component. The main limitation is you need to create a new sensor for each measurement type. This component was created by @joyrider3774 a while back before the API was changed (I suspect).

I’ve submitted an Issue for an enhancement. It is quite straight forward to do I suspect.

> <https://github.com/home-assistant/core/issues/31251>
>
> \<!-- READ THIS FIRST:
> - If you need additional help with this template, pleas…e refer to https://www.home-assistant.io/help/reporting\_issues/
> - Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
> - Do not report issues for integrations if you are using custom components or integrations.
> - Provide as many details as possible. Paste logs, configuration samples and code into the backticks.
> DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed without comment.
> \--\>
> \## The problem
> \<!-- 
> Describe the issue you are experiencing here to communicate to the
> maintainers. Tell us what you were trying to do and what happened instead.
> \--\>
> The Emoncms API has changed to include the 'unit' of the the data feed. Currently the component assumes a unit of W so several sensors need to be created for each feed with a different unit.
> 
> \## Environment
> \<!--
> Provide details about the versions you are using, which helps us to reproduce
> and find the issue quicker. Version information is found in the
> Home Assistant frontend: Developer tools -\> Info.
> \--\>
> \- Home Assistant release with the issue: N/A
> \- Last working Home Assistant release (if known): N/A
> \- Operating environment (Hass.io/Docker/Windows/etc.): Any
> \- Integration causing this issue: Emoncms
> \- Link to integration documentation on our website: https://www.home-assistant.io/integrations/emoncms/
> 
> \## Problem-relevant \`configuration.yaml\`
> \<!--
> An example configuration that caused the problem for you. Fill this out even
> if it seems unimportant to you. Please be sure to remove personal information
> like passwords, private URLs and other credentials.
> \--\>
> As per component help
> \`\`\`yaml
> 
> \`\`\`
> 
> \## Traceback/Error logs
> \<!--
> If you come across any trace or error logs, please provide them.
> \--\>
> 
> \`\`\`txt
> 
> \`\`\`
> 
> \## Additional information
> This line could be amended to get the data from the data JSON. The relevant element is 'unit'.
> 
> https://github.com/home-assistant/home-assistant/blob/03954be12df4a1a2357064cbf58978157d10a40e/homeassistant/components/emoncms/sensor.py#L147
> 
> Data format:
> \`\`\`
> {
> "id": "7",
> "userid": "1",
> "name": "Supply",
> "datatype": "1",
> "tag": "Helios",
> "public": "1",
> "size": "1802632",
> "engine": "5",
> "processList": "",
> "unit": "\\u00b0C",
> "value": 17,
> "time": 1580231227,
> "start\_time": 1543153800,
> "interval": 60
> }
> \`\`\`
> 
> The key question would be how to migrate this without breaking existing configs. It may need an additional configuration item such as "Use Feed Units" to allow the component to decide. This could default to false so should not break existing setups.

---

<div class="post-metadata">

**Author:** ![foxlees](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/f/59ef9b/32.png) [@foxlees](https://community.openenergymonitor.org/u/foxlees)\
**Post date:** [28 January 2020 19:34 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/11 "2020-01-28T19:34:11Z")

</div>

Thanks didn’t realise this have added and works well, easier than using MQTT.  
are you using any particular lovelace card, ie guage or graphs, also have you done anything else with the data

---

<div class="post-metadata">

**Author:** ![wyx087](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/wyx087/32/12653_2.png) [@wyx087](https://community.openenergymonitor.org/u/wyx087)\
**Post date:** [29 January 2020 14:17 UTC](https://community.openenergymonitor.org/t/emon-and-home-assistant-integration/13130/12 "2020-01-29T14:17:48Z")

</div>

> [@borpin](#):
>
> I’ve submitted an Issue for an enhancement. It is quite straight forward to do I suspect.

This enhancement will be greatly appreciated. I currently have to set up one sensor for W and another for daily kWh.

> [@foxlees](#):
>
> Thanks didn’t realise this have added and works well, easier than using MQTT.  
> are you using any particular lovelace card, ie guage or graphs, also have you done anything else with the data

On top of default graph card, I’m using Power wheel card to display instantons data:

> **[GitHub - gurbyz/power-wheel-card: An intuitive way to represent the power and...](https://github.com/gurbyz/power-wheel-card)**
>
> An intuitive way to represent the power and energy that your home is consuming or producing. (A custom card for the Lovelace UI of Home Assistant.) - GitHub - gurbyz/power-wheel-card: An intuitive ...

I’m also using solar generation as condition to hallway and stairs light automations. It’s a very nice sensor for ambient light levels 😄  
Eg. trigger: motion; condition: solar generation \<20W; action: turn on lights.
