Node Red: A widget based dashboard working with Homey trough MQTT

I’ve created a basic Node-red flow for you which sets both the u-values to a gauge on your dashboard.
I don’t know which values you’d like to have on your dashboard?

You’d have to change the url in the second node (called Get Energy Link week data).
It updates every 10min (see timestamp node).
Change the gauge nodes to the dashboard you created.

You can copy below ‘code’ to import it into a new flow in Node-red:
https://nodered.org/docs/user-guide/editor/workspace/import-export

[{"id":"7a8cc078.2f21f","type":"inject","z":"c636d43a.eaa548","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":true,"onceDelay":0.1,"x":230,"y":320,"wires":[["486fd7a0.2a9d48"]]}]

Hello Robin,

first objective is to publish a value on the dashboard, like powerconsumption for a week so to learn how it works. Target is to publish the actual power- and gas consumption of more.

In my previous post I just copied two lines of output.
The total output of https:///password/el/graph/u/week is :

I created your flow, but honestly, I have nu clue what to fill in at switch / set.msg.payload / cauge…
Can you give me a hint?
And I set the return object ‘Get Enery Link…’ to a parse json object. Right?

Got result!
I discovered this topic : https://forum.athom.com/discussion/2964/tut-how-to-get-data-from-your-homewizard-and-use-it-in-homey-also-the-868-sensors

I installed the jsonpath module and change the flow :

[{"id":"5ef24d5a.f881cc","type":"tab","label":"Energy Link","disabled":false,"info":""},{"id":"3886dc6f.9bf22c","type":"http request","z":"5ef24d5a.f881cc","name":"Get Energylink Total Consumption","method":"GET","ret":"txt","paytoqs":false,"url":"http://<homewizard-ip>/<password>/el/get/0/readings","tls":"","persist":false,"proxy":"","authType":"","x":450,"y":200,"wires":[["dde3cb08.6741e8","f394e95f.1f1748","d04e6bcd.3d2848"]]},{"id":"16f05c76.a950a4","type":"inject","z":"5ef24d5a.f881cc","name":"","topic":"","payload":"","payloadType":"date","repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"x":150,"y":200,"wires":[["3886dc6f.9bf22c"]]},{"id":"5fcb5d03.9d32a4","type":"ui_gauge","z":"5ef24d5a.f881cc","name":"","group":"e6187cda.24cc2","order":2,"width":0,"height":0,"gtype":"gage","title":"Energie verbruik laag","label":"kWh","format":"{{value}}","min":0,"max":"5000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1060,"y":140,"wires":[]},{"id":"7a39567.1f7bfa8","type":"ui_gauge","z":"5ef24d5a.f881cc","name":"","group":"e6187cda.24cc2","order":1,"width":"0","height":"0","gtype":"gage","title":"Energieverbruik Hoog","label":"kWh","format":"{{value}}","min":0,"max":"5000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1060,"y":200,"wires":[]},{"id":"dde3cb08.6741e8","type":"jsonpath","z":"5ef24d5a.f881cc","expression":"$.response[?(@.tariff==1)].consumed","split":false,"name":"Verbruik laag","x":730,"y":140,"wires":[["5fcb5d03.9d32a4"]]},{"id":"f394e95f.1f1748","type":"jsonpath","z":"5ef24d5a.f881cc","expression":"$.response[?(@.tariff==2)].consumed","split":false,"name":"Verbruik hoog","x":740,"y":200,"wires":[["7a39567.1f7bfa8"]]},{"id":"d04e6bcd.3d2848","type":"jsonpath","z":"5ef24d5a.f881cc","expression":"$.response[?(@.type=='gas')].consumed","split":false,"name":"Verbruik gas","x":730,"y":260,"wires":[["49850eff.45f1a"]]},{"id":"49850eff.45f1a","type":"ui_gauge","z":"5ef24d5a.f881cc","name":"","group":"e6187cda.24cc2","order":4,"width":0,"height":0,"gtype":"gage","title":"Verbruik Gas","label":"m3","format":"{{value}}","min":0,"max":"2500","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1030,"y":260,"wires":[]},{"id":"e6187cda.24cc2","type":"ui_group","z":"","name":"Energie Monitor","tab":"d99238dd.18adb8","disp":true,"width":"6","collapse":false},{"id":"d99238dd.18adb8","type":"ui_tab","z":"","name":"Homey Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

This results in :

Next challenge, display live consumption.

1 Like

Nice, well done

Maybe a stupid questiion…
My diagrams are empty today, no values. I wonder how is that stored.
I gewt values from MQTT but do I need to have the dashboard running/viewing to let it create diagrams on the go? Seems like when closing the webpage /ipadress:1880/ui all diagrams get zero

https://flows.nodered.org/flow/09f81780458d23156b74bf3f1168bbd8

check this one out.
Change inputs to MQTT values from homey

Hello Stefan,

thanks but this works with HomeAssistant.
I’ve got a HomeWizard Energylink.

To get the latest data you can perform a http request : http://homewizard-ip/password/el/get/0/telegram

The output :

/KFM5KAIFA-METER
1-3:0.2.8(42)
0-0:1.0.0(191024213340S)
0-0:96.1.1(4530303235313030303635323633383136)
1-0:1.8.1(004740.032*kWh)
1-0:1.8.2(003867.271*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.473*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00001)
0-0:96.7.9(00000)
1-0:99.97.0(1)(0-0:96.7.19)(000101000001W)(2147483647*s)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(002*A)
1-0:21.7.0(00.473*kW)
1-0:22.7.0(00.000*kW)
0-2:24.1.0(003)
0-2:96.1.0(4730303332353631323931373231363137)
0-2:24.2.1(191024210000S)(01455.404*m3)
!94AB

I’m trying build a flow whhich executes Python script based on this article : http://domoticx.com/p1-poort-slimme-meter-data-naar-node-red-mqtt/

Currently using this :
HomeWizard EnergyLink has graphs for day/week/month/year. When I put http://homewizard-ip/password/el/graph/s1/day in the browser I noticed it’s poll’s every 5 minutes and count the values for a total that day.
So I use this http request in a flow and publish the last values of ‘a’ (netto consumption) and ‘g’ (gas consumption). Also executes every 5 minutes.

To get the last value I figured out that I have to use the Jsonpath and define that I want the latest value of the array.

Flow :

[{“id”:“37e7cbb6.b00ed4”,“type”:“inject”,“z”:“72f59c0b.65acf4”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:“300”,“crontab”:"",“once”:true,“onceDelay”:0.1,“x”:190,“y”:240,“wires”:[[“130da8ad.2cad77”]]},{“id”:“130da8ad.2cad77”,“type”:“http request”,“z”:“72f59c0b.65acf4”,“name”:“Get Energylink actueel verbruik”,“method”:“GET”,“ret”:“txt”,“paytoqs”:false,“url”:“http://<homewizard-ip>/<password>/el/graph/s1/day”,“tls”:"",“persist”:false,“proxy”:"",“authType”:"",“x”:490,“y”:240,“wires”:[[“7fa3b8b7.13eff8”,“a0a8d198.6d46c”]]},{“id”:“7fa3b8b7.13eff8”,“type”:“jsonpath”,“z”:“72f59c0b.65acf4”,“expression”:".response[-1:].[a]","split":false,"name":"Huidig energieverbruik","x":800,"y":200,"wires":[["eb844269.33059"]]},{"id":"a0a8d198.6d46c","type":"jsonpath","z":"72f59c0b.65acf4","expression":".response[-1:].[g]",“split”:false,“name”:“Huidig gasverbruik”,“x”:790,“y”:280,“wires”:[[“667b1a5b.48dce4”]]},{“id”:“eb844269.33059”,“type”:“ui_gauge”,“z”:“72f59c0b.65acf4”,“name”:"",“group”:“e6187cda.24cc2”,“order”:4,“width”:0,“height”:0,“gtype”:“gage”,“title”:“Energieverbruik”,“label”:“Watt”,“format”:"{{value}}",“min”:0,“max”:“3500”,“colors”:["#00b500","#e6e600","#ca3838"],“seg1”:"",“seg2”:"",“x”:1090,“y”:200,“wires”:},{“id”:“667b1a5b.48dce4”,“type”:“ui_gauge”,“z”:“72f59c0b.65acf4”,“name”:"",“group”:“e6187cda.24cc2”,“order”:5,“width”:0,“height”:0,“gtype”:“gage”,“title”:“Gasverbruik”,“label”:“m3”,“format”:"{{value}}",“min”:0,“max”:“1”,“colors”:["#00b500","#e6e600","#ca3838"],“seg1”:"",“seg2”:"",“x”:1080,“y”:279,“wires”:},{“id”:“e6187cda.24cc2”,“type”:“ui_group”,“z”:"",“name”:“Energie Monitor”,“tab”:“d99238dd.18adb8”,“disp”:true,“width”:“6”,“collapse”:false},{“id”:“d99238dd.18adb8”,“type”:“ui_tab”,“z”:"",“name”:“Homey Dashboard”,“icon”:“dashboard”,“order”:1,“disabled”:false,“hidden”:false}]

I have problem that some devices dont send 0 kw when nothing is consumption energy.
And when the device a couple of hours later turns on I get a line between the last consumption and now.
That becomes a problem when doing charts in node-red. Can I change the way charts draw that line ?

image

What kind of device is that? A smart plug and it’s turned off by Homey? Don’t you get a MQTT message if so?
If not, you can also start a timer inside node red triggered by an incoming message, and keep resetting it when a new message arrives. If no message arrives for X seconds, send a 0 to the graph.

I’m using the smart presence app and it’s sending a MQTT message when a person (name) leaves / arrives home.

Its z-wave from Cleverio. I think a timer is the right way to go. Will try that first

It was the app in Homey that was messing around. The app hasent “found” the z-wave device right.
So the app didnt send the values, didnt send anything.
But in z-wave I could see that values wore sent from the Device to Homey.
Removed/added device and restarted Homey, now it works and send a 0 when its 0 :slight_smile:

If I import you’re flow (to get the latest value) in Node Red I get an “SyntaxError: Unexpected token “ in JSON at position 2”

You have to replace all “smart quotation marks” (“ and ”) with “dumb quotation marks” (").

Then other errors pop up…

Thanks for the tip. I’ve tried Smart presence, but it don’t send any MQTT. Or at least i can’t see any in the debug window. I can see it works within Homey, cause i made a test flow to check that. But it doesn’t
work in Node red. Do you have an example code I can use. Or is it som setting in the MQTT Hub i’m missing?
Thank again for your time.

If you make a virtual switch that goes on when you’re at home and off when you are away. Then the switch will send the request

Thanx Marc!
I thought about that too, but I was hoping not also having to create virtual switches for every family member. I already created a Smart presence-device for every family member. So now I need them devices to make it possible. But if thats the only way I guess thats what it will be done.

I have another problem also. I can’t seem to get a slider for dimming lights to work both ways. I have made it receiveing values from Homey and show it in the dashboard-slider, but not the other way around.
Do you have any idea what i’m missing here?

Hello Marc,

did you solve it already?

Maybe something went wrong with posting the code… made a new copy (change homewizard-ip/password)

[{“id”:“d05f012d.bcf46”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:""},{“id”:“82545cad.b3eea”,“type”:“inject”,“z”:“d05f012d.bcf46”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:“300”,“crontab”:"",“once”:true,“onceDelay”:0.1,“x”:210,“y”:300,“wires”:[[“608b1e65.a04a6”]]},{“id”:“608b1e65.a04a6”,“type”:“http request”,“z”:“d05f012d.bcf46”,“name”:“Get Energylink actueel verbruik”,“method”:“GET”,“ret”:“txt”,“paytoqs”:false,“url”:“http://homewizard-ip/password/el/graph/s1/day",“tls”:"",“persist”:false,“proxy”:"",“authType”:"",“x”:510,“y”:300,“wires”:[[“8b5c74d3.7b3258”,“2498e39f.7b60dc”]]},{“id”:“8b5c74d3.7b3258”,“type”:“jsonpath”,“z”:“d05f012d.bcf46”,“expression”:".response[-1:].[a]","split":false,"name":"Huidig energieverbruik","x":820,"y":260,"wires":[["d8040eef.a9988"]]},{"id":"2498e39f.7b60dc","type":"jsonpath","z":"d05f012d.bcf46","expression":".response[-1:].[g]”,“split”:false,“name”:“Huidig gasverbruik”,“x”:810,“y”:340,“wires”:[[“e85c6229.9985e”]]},{“id”:“d8040eef.a9988”,“type”:“ui_gauge”,“z”:“d05f012d.bcf46”,“name”:"",“group”:“e6187cda.24cc2”,“order”:4,“width”:0,“height”:0,“gtype”:“gage”,“title”:“Energieverbruik”,“label”:“Watt”,“format”:"{{value}}",“min”:0,“max”:“3500”,“colors”:["#00b500","#e6e600","#ca3838"],“seg1”:"",“seg2”:"",“x”:1110,“y”:260,“wires”:},{“id”:“e85c6229.9985e”,“type”:“ui_gauge”,“z”:“d05f012d.bcf46”,“name”:"",“group”:“e6187cda.24cc2”,“order”:5,“width”:0,“height”:0,“gtype”:“gage”,“title”:“Gasverbruik”,“label”:“m3”,“format”:"{{value}}",“min”:0,“max”:“1”,“colors”:["#00b500","#e6e600","#ca3838"],“seg1”:"",“seg2”:"",“x”:1100,“y”:339,“wires”:},{“id”:“e6187cda.24cc2”,“type”:“ui_group”,“z”:"",“name”:“Energie Monitor”,“tab”:“d99238dd.18adb8”,“disp”:true,“width”:“6”,“collapse”:false},{“id”:“d99238dd.18adb8”,“type”:“ui_tab”,“z”:"",“name”:“Homey Dashboard”,“icon”:“dashboard”,“order”:1,“disabled”:false,“hidden”:false}]

Nope it is not working. Replaced all the quotes didn’t do the trick. But halve not much time to see where it went wrong, will try later further. Thanks by the way…

I’ve looked into my code, and I’m sorry; you are right. MQTT Hub does not send Smart Presence data. The way I solved it, is to create a flow triggered by Smart Presence, and send a MQTT message with MQTT Client:

1 Like