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

Is someone already working on an nod-red-homey plugin? :grinning:
That would simplify a lot of things!

3 Likes

But if Homey has à flow that turns somerhing on for a example on a time or a flow with a lux value, i must in that flow also send a mqtt message that It’s turnes on? I wonder if there is a way to monitor a state of a switch/lamp

I mean when Homey itself, not by MQTT.
Schedules and other triggers inside homey dont send mqtt messages or have I missed that feature?
I have Mosquitto running on a Ubuntu server togehter with node-red.
Only have the MQTT client on my Homey

No it shouldn’t be necessary to send a MQTT message inside the flow. If a light gets switched (or adjusted) Homey (the MQTT hub app) should automatically sent MQTT messages about the state of the light. Just monitor the MQTT stream and see what happens if you activate a light from a flow.

It works fine in my scenery. If I start a flow that adjusts all the lights, all the switches in the node red dashboard are set accordingly. I’m using lots of mi-lights over here, maybe other brands wont work? Maybe restart the MQTT Hub? (also, look in the hub settings, for a list of devices coupled to the MQTT stream)

I dont use the Homey mqtt hub. Only mqtt client

I like it, thanks. One question, how did you manage those “big” icons in the buttons? When I try to use a separate icon it ends up small.

Homey itself (without an app) doesn’t publish anything over MQTT, you need the “hub” app for that.

I like it, thanks. One question, how did you manage those “big” icons in the buttons? When I try to use a separate icon it ends up small.

If you put fa-2x or fa-4x before the icon it scales it.
Like: fa-4x fa-snowflake-o
Sadly, works only for Font Awesome icons

I dont use the Homey mqtt hub. Only mqtt client

Well… that explains why you cant get the state of the light in Node-red :wink:
You need the Client and the hub for two way communication. (Allthough I dont understand how you created these bold items without the hub:

…and got switches, gauges and diagrams to work.

Unless the gauges and diagrams are feed outside of homey

1 Like

Some values like lux, temp and hum comes with mqtt from other devices and post on my mosquitto. And then Homey reads them.
If I install hub on my Homey. Does every flow I have that turns things on and off then also sends mqtt message. Or do I have to implemnt that myself?

It sends MQTT data from every device by default, unless you uncheck that device in the Hub settings. (So you might uncheck these lux and temp devices otherwise MQTT data gets send twice) It doesn’t send MQTT data if a flow starts, but the devices that are controlled by the flow will send MQTT data…

Maybe you should just try it? :wink:

You can essentially enable and disable MQTT on a per device basis.

Installed the Hub and now I have setup a couple of devices to send mqtt data.
Works perfect, thanks !!
But I dont know how to setup a Switch so it changes if the value of the device changes.
I have experimented with a motion detector that sends true or false.
I added a “text” and I can see that when motion is detected it says True.
But my switch wont move, probaly me that dont know what I am doing

You need to convert the string to a boolean. I’ve made an exact example (With exactly this kind of usage) including example code in the first post about this. Please take a look at that.

1 Like

Thanks for your support and your patiance !!!
Works perfect !

Sorry more questions…
I have a group in Homey that includes 8 lamps.
When I turn that group on, I can see that every lamp sends a mqtt message that it on.
How can I on my dashboard see this group and know its on ?
Is there a way to just send a group mqtt message or do I have to do all 8 lamps seperat?

I’m not familiar with “groups” inside of homey. Is this just a flow you activate inside of homey (And switch all the lights one by one inside the flow)? Or can a group activate a flow (Like “If group gets activated” or something). If so you could just send a custom MQTT message out of a Homey-flow and act accordingly inside of Node red.

You could also just keep track of every light inside of Node red (save state on change inside a global variable) and check on light activity if all other lights are switched on. if so, you know if this group is on.

You could do the same inside Homey with flows.

Thanks for the answer regarding the icons. I now have it working so I can use one button to switch lamps on/off an change to color of the button the show the status :
image

This is the flow:

and the JSON

[{"id":"9ded892e.48f678","type":"mqtt out","z":"b3baee84.acbf2","name":"MQTT transmit","topic":"","qos":"","retain":"","broker":"828cde87.7b584","x":1020,"y":360,"wires":[]},{"id":"3a1530a8.90784","type":"ui_button","z":"b3baee84.acbf2","name":"Hoeklamp","group":"e13b23ee.8a5d9","order":7,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"{{color}}","icon":"fa-2x fa-power-off","payload":"state","payloadType":"flow","topic":"homie/homey-topic/hoeklamp/onoff/set","x":740,"y":360,"wires":[["9ded892e.48f678"]]},{"id":"cf7444fc.a20248","type":"function","z":"b3baee84.acbf2","name":"State2Color","func":"if (msg.payload === \"true\"){\n    msg.color = \"green\";    \n    flow.set(\"state\", \"false\");\n}\nelse {\n    msg.color = \"#C0C0C0\";\n    flow.set(\"state\", \"true\");\n    }\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":360,"wires":[["3a1530a8.90784"]]},{"id":"88b5ddcd.c9f11","type":"mqtt in","z":"b3baee84.acbf2","name":"","topic":"homie/homey-topic/hoeklamp/onoff","qos":"2","datatype":"auto","broker":"828cde87.7b584","x":340,"y":360,"wires":[["cf7444fc.a20248"]]},{"id":"828cde87.7b584","type":"mqtt-broker","z":"","name":"Homey MQTT","broker":"yourbroker","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"e13b23ee.8a5d9","type":"ui_group","z":"","name":"Group 2","tab":"cf91514e.cbeaf","order":2,"disp":false,"width":"6","collapse":false},{"id":"cf91514e.cbeaf","type":"ui_tab","z":"","name":"Homey Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
1 Like

switch
You can also use a “switch node” and assign different icons and colors based on on or off status. Like I did for the locks

Nice tutorial @Satoer !
I’m trying to get the presence of my family to show in the dashboard, but I can’t find a way to fetch the status.
How did you make get that to work for you and your wife in your Dashboard?

image

Thanx!

Hello,

i’m unfamiliar with programming so this is very difficult for me but I think with a lot of reading and following examples I will learn.

My equipment :

  • Homey (Early 2016) v2.5.2
  • MQTT client v2.2.2 from Menno van Grinsven
  • MQTT Hub v2.2.5 from Harrie de Groot

Apple Mac Mini (mid 2011, acts also as Plex media server)

  • MQTT Broker installed

This is working okay, I can control my lights.
But I need a little hint for my next challenge…

I also have a HomeWizard with an Energy Link and want to display the data in the Dashboard (node-red-dashboard 2.17.1)
Through this information, http://wiki.td-er.nl/index.php?title=Homewizard#Energy_Link, I can fetch the data when I use http:///password/el/graph/u/week for example :
{“status”: “ok”, “version”: “3.403”, “request”: {“route”: “/el” }, “response”: [{ “t”: “2019-10-01 00:00”, “u”: 9.44, “a”: 9.44, “s1”: 0.00, “s2”: 0.00, “g”: 0.17}
, { “t”: “2019-10-02 00:00”, “u”: 12.49, “a”: 12.49, “s1”: 0.00, “s2”: 0.00, “g”: 0.69}

In Node-Red I started a flow with HTTP Request (GET) but I don’t have any idea what to do next. Tried http post -> cauge, tried json, but actually I have no clue. Google is not my friend in this case also…
Can someone help me?
Thanks in advance.