At the moment, this will be just battery_soc, but could be any numeric value from home_assistant in the future so that I can graph everything in one place/
I have emonpi (with mqtt) and also emoncms.
I have local home assistant and a separate local mqtt broker and node-red installation.
What is the easiest way to get some values out of home assistant into emoncms?
Is there any way to create a virtual entity/feed that can be populated with an API call?
Maybe this could be local call from emonpi to home assistant, then forward the input onto emoncms
I have been playing with MQTT and do have my local broker pulling the value that I want from home assistant on a trigger automation. Based on a HA post that @borpin was involved in!
But it’s the then getting it into emoncms bit that i’m struggling with. I’m no expert with node-red or mqtt AT ALL.
Do I create new feeds/inputs on emonpi? Then poke node-red into emon/something/something?
Or make an API call into emoncms?
Hope some of that makes sense?
Any help or pointers would be appreciated.
If the data is travelling via your LAN, I think I’m right in saying it completely bypasses emonHub, and goes straight into emonCMS.
And that’s puzzling me - that screenshot looks like the Inputs page of emonCMS, so the data must be getting into emonCMS.
Do you mean the list on the Feeds page or on the Inputs page?
If that really is the Inputs page (“Inputs” is in big letters at the top), then your next step is to add some processing to it using the spanner icon and save the data to a Feed. Only then will it appear on the Feeds page. (A “Feed” is the storage mechanism - all the processing on the Inputs page is transient, if it is not logged to a Feed, the data evaporates.)
I suggest installing the Node-RED Addon to HA (assuming you are running Supervisor). This then gives you a whole load of nodes that interact with HA and reduce the need for automations for publishing stuff to MQTT.
Then, 2 ways,
Use the emoncms Node-RED node
Publish the values to the MQTT topic your local emoncms subscribes to (my preferred method).
Either will automatically create the Input which you then process to create the Feed.
By ‘emoncms’ do you mean emoncms.org? Both are EmonCMS just one is local and one is in ‘the cloud’.
An MQTT Broker doesn’t ‘pull’ anything. You Publish values to a Topic on the Broker which then makes them available to other resources that have ‘Subscribed’ to those topics.
If the topic your local emoncms subscribes to is emon/ (the default) then publish the value from NR to a topic such as emon/Battery_SOC and (as you see) an Input is then created. You then need to create a Process to create the Feed (just like you do for any other Input).
I think then there is a settng somewhere to mirror that info to emoncms.org.
You could alternatively use the emoncms NR node and publish the data directly to emoncms.org.
Thanks @borpin , yep i’m getting to this point.
(HA to local MQTT, being picked up by my local NR and pushed to my local emoncms MQTT). Probably over complicated, but it’s working and i’m happy to keep the NR/MQTT instances separate from HA install.
The bit I’m missing is that I can’t see the input created below (from my local emonpi/emoncms) being replicated on my emoncms.org account.
You mentioned ‘a setting’. Can anyone advise where that could be?
I see no reference to battery_0100 or remote in the Emonhub log (on local emonpi/emoncms)
Do I have to put the input on my local emonpi/emoncms into a feed for the input to then pass over to cloud emoncms.org? (where i’d have to do a cloud ‘log to feed’?)
The only route that I know of is if the input is coming via emonHub. EmonHub is capable of forwarding the data to emoncms.org, but if it’s arriving via your LAN and bypassing emonHub, then your source needs to send duplicate sets of data to both the local emonCMS and to emoncms.org. Then it appears on the Inputs page of both emonCMS’s, and you arrange the same processing thereafter in both. That’s if I understand it correctly.
As I wrote - it cannot. emonHub knows nothing about it:
As I understand it, emonHub only handles data arriving via the handlers that it has - the serial interfacers, which are either the TTY port from the emonPI’s Atmel ATMega 328P (power & radio from outlying nodes) or the other Serial inputs like RS485 via the USB serial ports.