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

My Raspberry crashed and all flows are lost… Also no backup…
Good opportunity to start all over and make a new design, but i already bumped into the first problem.

When I look at the MQTT explorer i do not see any changes with my Fibaro units when controlling them via Homey. I do see the Sonoff (tasmota) units reflecting the actions i do via Homey. Below picture show my Fibaro (hallway) and my Sonoff (veranda wall)

Screen Shot 2022-02-14 at 9.48.10 AM

Does anybody has an idea why the Fibaro only shows 2 topics?

Edit: Problem solved, i needed to open the MQTT hub app and uncheck/checkk all devices.


How do I make the top part like this as shown in this image. Thanks

2 Likes

Perhaps even with Homey itself, when they do announce a native dashboard in their keynote next wednesday… :stuck_out_tongue_winking_eye:

1 Like

I REALLY hope so :smiley:

Any more example dashboards anyone can share here for inspiration?
I am planning to redo my dashboards so any good ideas are very welcome :slight_smile:
Thanks!

https://community.homey.app/search?expanded=true&q=dashboard

1 Like

Ah thanks!! But I should have been more specific. I have already investigated the dashboards around here. In fact I have personally provided some of the examples that show up in the results.
I am really looking for NEW inspiration :slight_smile:

1 Like

Here is some inspiration for you from the dashboard I made. I am showing this on a wall-mounted Samsung Galaxy Tab A8 tablet, but I also use it sometimes on a mobile phone because it loads faster than the Homey app.

Above you see the home page. It consists of the following main components:

  • Weather information from my Netatmo weather station
  • A chart with predicted rain from Buienradar (Dutch). Each 5 minute interval will have its own bar, if rain is predicted.
  • Overview of who is at home. This is derived from mobile phones connected to my Ubiquity Unifi wifi network. Next to it is a simple switch to enable guest mode. I use this to avoid the alarm from automatically switching on when we leave the house.
  • Notification area to which Homey can send notifications including icons.
  • All lights on the ground floor. I am using numeric inputs instead of sliders because they are much easier to use than a slider on a wall-mounted tablet. It also makes it simpler to set lights to an exact value. I am using steps of 10 and have put a delay of 1 second before it is sent to Homey, so that if you go from 90 to 50, it only sends 1 message.
  • Zappi is the charger for my EV that reports the status.
  • Lichtscenes is used to control light scenes by sending a MQTT command to Homey that is picked up by a flow.
  • Onkyo is a section that allows me to control my Onkyo receiver. It has several volume presets and uses two separate zones which can be controlled individually or together. The Spotify button starts a default playlist on my receiver and enables both zones.
  • Energie shows my electricity usage.
  • Temperatuur shows the current temperature as reported by Tado with the option to set a temperature. I am using different colors so that you can see in one glance if it is warm or cold. I am making the label orange if the system is actually heating at this time.
  • Luchtkwaliteit contains the CO2 level from Netatmo. I am using this to control my ventilation system with Homey.
  • Planten shows if my plants need water.
  • Buitensensors indicates if there is movement around the house.

The home page is what is normally shown on the tablet, but I also created a page for the rest of the house, so that you can control everything from one overview. This also shows the status of all sensors.

10 Likes

Awesome, thanks! Also to others - please keep the inspiration coming by posting your examples.

Node red EV charger pane:
image
For your inspiration :slight_smile:

Source below:

[{"id":"8326a79c3f2cbebf","type":"mqtt in","z":"022d82e1027a0fe3","name":"mqttBroker4HomeyPro","topic":"#","qos":"2","datatype":"auto","broker":"91e88251.9a6fb","nl":false,"rap":false,"inputs":0,"x":160,"y":440,"wires":[["3079babf88f7e05e","816ae9ebd0f8a50b"]]},{"id":"3079babf88f7e05e","type":"switch","z":"022d82e1027a0fe3","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"homie/homeypro/ev-charger/measure-power","vt":"str"},{"t":"eq","v":"homie/homeypro/ev-charger/meter-power","vt":"str"},{"t":"eq","v":"homie/homeypro/ev-charger/devicecapabilities-text-custom-61text1","vt":"str"},{"t":"eq","v":"homie/homeypro/ev-charger/devicecapabilities-onoff-hide-buttonbutton1","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":510,"y":280,"wires":[["b95f288d1f069225","979aa0e7b3bf8165"],[],["baca3839f40dbcf5"],["4b72f9c60f93abf7"],[],[]]},{"id":"40ecb6607f42ef12","type":"comment","z":"022d82e1027a0fe3","name":"Most Recent Charging Session","info":"","x":430,"y":200,"wires":[]},{"id":"b95f288d1f069225","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"406abdd65ee90d8f","order":4,"width":2,"height":2,"name":"Current Power","icon":"fa-flash","label":"Vermogen","unit":"W","layout":"radial","decimals":"0","differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":5000,"col":"#66f5ff","t":"sec","dot":0},{"val":6500,"col":"#e60000","t":"sec","dot":0},{"val":7400,"col":"#e60000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":980,"y":200,"wires":[]},{"id":"4b72f9c60f93abf7","type":"function","z":"022d82e1027a0fe3","name":"","func":"var icnColor=\"#888888\";\nvar pl = \"\";\nvar icon=\"\";\n\n\nif (msg.payload==\"true\")\n{\n    icnColor=\"#FFAA00\"; \n    icon=\"material-icons ev_station\";\n    pl = \"Aan het laden\";\n}\nelse\n{\n    icnColor=\"#44AAFF\"; \n    icon=\"material-icons ev_station\";\n    pl = \"Laden gereed\";\n    \n    \n    // removed because causes issues:\n    // add current session kWh to the global history\n//    var chargeSessionsArray = Array(global.get(\"evChargeSessionsArray\"));\n//    chargeSessionsArray.unshift(ev_kWh_currentSession);\n//    global.set(chargeSessionsArray);\n    \n}\n\nmsg = {payload:pl, Iconcolor:icnColor, IconShape:icon};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":320,"wires":[["6c26b72794b95282"]]},{"id":"6c26b72794b95282","type":"ui_template","z":"022d82e1027a0fe3","group":"406abdd65ee90d8f","name":"nu laden janee","order":1,"width":6,"height":1,"format":" <span style=\"vertical-align:middle; font-size:25px; color: rgb(255, 255, 255); text-align: left; \" class=\"fr-class-transparency\">\n    <i style=\"color:{{msg.Iconcolor}}!important;\" class={{msg.IconShape}} aria-hidden=\"true\"></i>&nbsp;\n    <span>Laadactiviteit</span>\n </span>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":980,"y":320,"wires":[[]]},{"id":"979aa0e7b3bf8165","type":"ui_chart","z":"022d82e1027a0fe3","name":"","group":"406abdd65ee90d8f","order":2,"width":6,"height":4,"label":"Vermogen","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"7400","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#66f5ff","#b3d4ff","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1190,"y":200,"wires":[[]]},{"id":"baca3839f40dbcf5","type":"ui_template","z":"022d82e1027a0fe3","group":"406abdd65ee90d8f","name":"duurLaadsessie","order":8,"width":6,"height":1,"format":"<span style=\"vertical-align:middle; font-size:15px; color: rgb(255, 255, 255); text-align: left; \" class=\"fr-class-transparency\">\n<span><table width=\"100%\"><tr><td><B>Duur Laadsessie:</B></td><td width=\"40%\" align=\"right\"><span>{{msg.payload}} <b></b></span></td></tr></table></span>\n </span>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":980,"y":280,"wires":[[]]},{"id":"816ae9ebd0f8a50b","type":"switch","z":"022d82e1027a0fe3","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"homie/homeypro/smart-meter-ev-charger/meter-power","vt":"str"},{"t":"eq","v":"homie/homeypro/smart-meter-ev-charger/meter-powernumber2","vt":"str"},{"t":"eq","v":"homie/homeypro/smart-meter-ev-charger/meter-powernumber3","vt":"str"},{"t":"eq","v":"homie/homeypro/smart-meter-ev-charger/meter-powernumber4","vt":"str"},{"t":"eq","v":"homie/homeypro/smart-meter-ev-charger/meter-powernumber5","vt":"str"},{"t":"eq","v":"homie/homeypro/smart-meter-ev-charger/meter-powernumber6","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":510,"y":620,"wires":[["a0d315c2f0229ca0"],["02ce2d34d4ca5e7e"],["ed42f07a73291c85"],["9b51c01d185c1228"],["a3aa53c77f4becf0"],["d9ebe59d3645a110"]]},{"id":"7480e3dacc7d6882","type":"comment","z":"022d82e1027a0fe3","name":"Historic Values","info":"","x":480,"y":540,"wires":[]},{"id":"a0d315c2f0229ca0","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"ebc3f6ff640e3261","order":1,"width":6,"height":1,"name":"Current Energy Session Accum","icon":"fa-flash","label":"Energie [sessie]","unit":"kWh","layout":"linear","decimals":"1","differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":30,"col":"#66f5ff","t":"sec","dot":0},{"val":40,"col":"#e67a00","t":"sec","dot":0},{"val":50,"col":"#fa0000","t":"sec","dot":0},{"val":62,"col":"#fa0000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":910,"y":560,"wires":[]},{"id":"02ce2d34d4ca5e7e","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"ebc3f6ff640e3261","order":2,"width":6,"height":1,"name":"Previous Session Accum","icon":"fa-flash","label":"Energie [vorige sessie]","unit":"kWh","layout":"linear","decimals":"1","differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":30,"col":"#66f5ff","t":"sec","dot":0},{"val":40,"col":"#e67a00","t":"sec","dot":0},{"val":50,"col":"#fa0000","t":"sec","dot":0},{"val":62,"col":"#fa0000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":890,"y":600,"wires":[]},{"id":"ed42f07a73291c85","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"ebc3f6ff640e3261","order":3,"width":6,"height":1,"name":"Current Month Energy Session Accum","icon":"fa-flash","label":"Energie [huidige maand]","unit":"kWh","layout":"linear","decimals":0,"differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":150,"col":"#66f5ff","t":"sec","dot":0},{"val":250,"col":"#e67a00","t":"sec","dot":0},{"val":500,"col":"#fa0000","t":"sec","dot":0},{"val":650,"col":"#fa0000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":930,"y":640,"wires":[]},{"id":"9b51c01d185c1228","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"ebc3f6ff640e3261","order":4,"width":6,"height":1,"name":"Previous Month Energy Session Accum","icon":"fa-flash","label":"Energie [vorige maand]","unit":"kWh","layout":"linear","decimals":0,"differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":150,"col":"#66f5ff","t":"sec","dot":0},{"val":250,"col":"#e67a00","t":"sec","dot":0},{"val":500,"col":"#fa0000","t":"sec","dot":0},{"val":650,"col":"#fa0000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":940,"y":680,"wires":[]},{"id":"a3aa53c77f4becf0","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"ebc3f6ff640e3261","order":5,"width":6,"height":1,"name":"Current Year Energy Session Accum","icon":"fa-flash","label":"Energie [huidig jaar]","unit":"kWh","layout":"linear","decimals":0,"differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":1500,"col":"#66f5ff","t":"sec","dot":0},{"val":2500,"col":"#e67a00","t":"sec","dot":0},{"val":3500,"col":"#fa0000","t":"sec","dot":0},{"val":4500,"col":"#fa0000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":930,"y":720,"wires":[]},{"id":"d9ebe59d3645a110","type":"ui_artlessgauge","z":"022d82e1027a0fe3","group":"ebc3f6ff640e3261","order":6,"width":6,"height":1,"name":"Previous Year Energy Session Accum","icon":"fa-flash","label":"Energie [vorig jaar]","unit":"kWh","layout":"linear","decimals":0,"differential":false,"minmax":false,"colorTrack":"#555555","style":"","colorFromTheme":true,"property":"payload","secondary":"secondary","inline":false,"animate":true,"sectors":[{"val":0,"col":"#11ff00","t":"min","dot":0},{"val":1500,"col":"#66f5ff","t":"sec","dot":0},{"val":2500,"col":"#e67a00","t":"sec","dot":0},{"val":3500,"col":"#fa0000","t":"sec","dot":0},{"val":4500,"col":"#fa0000","t":"max","dot":0}],"lineWidth":3,"bgcolorFromTheme":true,"diffCenter":"","x":930,"y":760,"wires":[]},{"id":"91e88251.9a6fb","type":"mqtt-broker","name":"ds920 mqtt broker","broker":"192.168.1.36","port":"1883","clientid":"nodered","usetls":false,"compatmode":true,"keepalive":"60","cleansession":false,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"406abdd65ee90d8f","type":"ui_group","name":"Laadsessie","tab":"53b7f813777e6a6e","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"ebc3f6ff640e3261","type":"ui_group","name":"Historie","tab":"53b7f813777e6a6e","order":2,"disp":true,"width":"12","collapse":false,"className":""},{"id":"53b7f813777e6a6e","type":"ui_tab","name":"Electric Vehicle","icon":"dashboard","order":7,"disabled":false,"hidden":false}]
1 Like

Hi have set up MQTT as the instruction and put the javascript in the function. I can turn on/off a lamp or smart plug and i can see that debug is changing “true/false” if i change the status in homey. But when i change in homey the status in node-red dashboard is not changing status.
I use MQTT explorer and nothing wrong, i have uncheck the pass through. Whats can be wrong?

How did you manage to dim the lights with a numeric value? i am currently using sliders, but indeed, they dont work well on a tablet. Trying to figure out how to dim them with steps of 10%.

A flow to read the mqtt topic and switch it back (but only if state is different). And in node-red the function filter to block if it is the same message/state, otherwise it sings around.

For each light that is dimmable, I have two MQTT listeners. One for on/off and one for the dim level. For the dim level, I use the regular numeric input control of Node Red and then I set the step size to 10. When you want to adjust the dim level from 10 to 100, this means you tap 9 times. To avoid that I am sending each individual tap to Homey, I have added a delay node after it that waits 1 second and only sends the last value. This avoids that the numeric value goes down again when tapping because Homey just processed a value and sent it back to Node Red.

Here is some sample code from one of my lights:

[
    {
        "id": "d4dcaa7ae33c6de8",
        "type": "mqtt in",
        "z": "1d29d7f96f23c934",
        "name": "Lamp eettafel",
        "topic": "homie/homey/lamp-eettafel/dim",
        "qos": "2",
        "datatype": "auto",
        "broker": "d094d3b7.a558a8",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 270,
        "y": 720,
        "wires": [
            [
                "e2f6fb65d0cd912c"
            ]
        ]
    },
    {
        "id": "60a0b9a358ec2008",
        "type": "mqtt in",
        "z": "1d29d7f96f23c934",
        "name": "Lamp eettafel",
        "topic": "homie/homey/lamp-eettafel/onoff",
        "qos": "2",
        "datatype": "auto",
        "broker": "d094d3b7.a558a8",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 190,
        "y": 780,
        "wires": [
            [
                "1aedd3b920746785"
            ]
        ]
    },
    {
        "id": "566ebf827a7eae9b",
        "type": "ui_switch",
        "z": "1d29d7f96f23c934",
        "name": "Lamp eettafel switch",
        "label": "",
        "tooltip": "",
        "group": "e94e7155867f4434",
        "order": 7,
        "width": 1,
        "height": 1,
        "passthru": false,
        "decouple": "true",
        "topic": "homie/homey/lamp-eettafel/onoff/set",
        "topicType": "str",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "fa-lightbulb-o fa-2x",
        "oncolor": "black",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "fa-lightbulb-o fa-2x",
        "offcolor": "white",
        "animate": true,
        "className": "lightSwitchOff",
        "x": 610,
        "y": 780,
        "wires": [
            [
                "f0c8f16bd94496f0"
            ]
        ]
    },
    {
        "id": "1aedd3b920746785",
        "type": "function",
        "z": "1d29d7f96f23c934",
        "name": "Convert to boolean",
        "func": "if(msg.payload === \"true\"){ \n        msg.payload = true; \n        msg.className=\"lightSwitchOn\";\n    }\nelse{ \n    msg.payload = false; \n    msg.className=\"lightSwitchOff\";\n    \n} \nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 390,
        "y": 780,
        "wires": [
            [
                "566ebf827a7eae9b"
            ]
        ]
    },
    {
        "id": "e2f6fb65d0cd912c",
        "type": "ui_numeric",
        "z": "1d29d7f96f23c934",
        "name": "Lamp eettafel dim",
        "label": "Lamp eettafel",
        "tooltip": "",
        "group": "e94e7155867f4434",
        "order": 8,
        "width": 5,
        "height": 1,
        "wrap": false,
        "passthru": false,
        "topic": "homie/homey/lamp-eettafel/dim/set",
        "topicType": "str",
        "format": "{{value}} %",
        "min": 0,
        "max": "100",
        "step": "10",
        "className": "largeText",
        "x": 610,
        "y": 720,
        "wires": [
            [
                "9bcd6bcc361ddf58"
            ]
        ]
    },
    {
        "id": "9bcd6bcc361ddf58",
        "type": "trigger",
        "z": "1d29d7f96f23c934",
        "name": "Delay",
        "op1": "",
        "op2": "",
        "op1type": "nul",
        "op2type": "payl",
        "duration": "1",
        "extend": true,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 790,
        "y": 720,
        "wires": [
            [
                "f0c8f16bd94496f0"
            ]
        ]
    },
    {
        "id": "f0c8f16bd94496f0",
        "type": "mqtt out",
        "z": "1d29d7f96f23c934",
        "name": "Verzend naar Homey",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d094d3b7.a558a8",
        "x": 1300,
        "y": 680,
        "wires": []
    },
    {
        "id": "d094d3b7.a558a8",
        "type": "mqtt-broker",
        "name": "Homey MQTT",
        "broker": "192.168.x.x",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "e94e7155867f4434",
        "type": "ui_group",
        "name": "Verlichting",
        "tab": "b82fea3fc1ee4a61",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "b82fea3fc1ee4a61",
        "type": "ui_tab",
        "name": "Home",
        "icon": "fa-home fa-2x",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]
1 Like

Another thing that could be wrong is the indicator setting. Open the settings of your switch node and make sure that “Indicator” is set to “Switch icon shows the state of the input”. I also got this wrong a few times. If you would set this to output, then you can indeed control the light, but you will not see the data coming from Homey. An additional advantage is that you now directly get a confirmation that it works because your switch will not change if Homey did not process your command.

Thnx a lot for the feedback. i see that i was way overthinking this.
This really helped me a lot in te right direction.

great looking dash by the way.

1 Like

Thanks, but the indicator was not the problem. I change the script to
if (msg.payload === true) { msg.payload = “On”; } else { msg.payload = “Off”; }
return msg;
And now is working fine.