Counting and output on the Dashboard

Hello,

I am not yet very familiar with Node-Red and need your help for a project for university.
A parking server should be programmed and the number of occupied parking slots should increase or decrease by manual input. There should be a maximum of 20 regular, 15 hanicap and 10 vip slots.
I have imported this flow (https://flows.nodered.org/node/node-red-contrib-counter) and I want to output the number on the dashboard with the gauge. Behind the counter-node I have added a switch-node which either lets the gauge count up to 20 or shows occupied from 20 on.
Unfortunately nothing happens in my dashboard. Does anyone have any ideas how to implement this?

This is my flow:

[{"id":"21a2d51b.7859da","type":"inject","z":"3ea65e14.3e2f22","name":"decrement regular","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":130,"y":160,"wires":[["7c56f728.920dd8"]]},{"id":"197277fd.a9eb48","type":"inject","z":"3ea65e14.3e2f22","name":"increment regular","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":120,"y":120,"wires":[["516eea40.5901b4"]]},{"id":"57c982de.daaf1c","type":"inject","z":"3ea65e14.3e2f22","name":"reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":90,"y":200,"wires":[["b93f5b7f.772258"]]},{"id":"516eea40.5901b4","type":"function","z":"3ea65e14.3e2f22","name":"msg object","func":"msg.increment = 1;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":120,"wires":[["8f77e7f1.829588"]]},{"id":"b93f5b7f.772258","type":"function","z":"3ea65e14.3e2f22","name":"msg object","func":"msg.reset = 10;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":200,"wires":[["8f77e7f1.829588"]]},{"id":"7c56f728.920dd8","type":"function","z":"3ea65e14.3e2f22","name":"msg object","func":"msg.decrement = 1;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":160,"wires":[["8f77e7f1.829588"]]},{"id":"ba82d9e.781e928","type":"debug","z":"3ea65e14.3e2f22","name":"count","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":40,"wires":},{"id":"8f77e7f1.829588","type":"counter","z":"3ea65e14.3e2f22","name":"","init":"1","step":"1","lower":"0","upper":"20","mode":"increment","outputs":2,"x":560,"y":140,"wires":[["ba82d9e.781e928"],["4a9c5290.57742c"]]},{"id":"16abd925.d1f627","type":"inject","z":"3ea65e14.3e2f22","name":"normal msg without control parameter","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":210,"y":60,"wires":[["8f77e7f1.829588"]]},{"id":"4a9c5290.57742c","type":"switch","z":"3ea65e14.3e2f22","name":"","property":"payload","propertyType":"flow","rules":[{"t":"lte","v":"20","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":200,"wires":[["e8f96dc9.3fdb"],["af0b06f7.bd4648"]]},{"id":"af0b06f7.bd4648","type":"ui_text","z":"3ea65e14.3e2f22","group":"2c7dfe1d.b5ffc2","order":0,"width":0,"height":0,"name":"occupied","label":"Bitte warten Sie!","format":"{{msg.payload}}","layout":"row-spread","x":900,"y":240,"wires":},{"id":"876465f1.50fc98","type":"debug","z":"3ea65e14.3e2f22","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":80,"wires":},{"id":"e8f96dc9.3fdb","type":"ui_gauge","z":"3ea65e14.3e2f22","name":"","group":"1ac9c18d.ecd92e","order":2,"width":0,"height":0,"gtype":"gage","title":"Regular","label":"","format":"{{value}}","min":0,"max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"10","seg2":"15","x":900,"y":180,"wires":},{"id":"53a2e5f5.45b6ac","type":"ui_gauge","z":"3ea65e14.3e2f22","name":"","group":"d22d3c54.cb229","order":2,"width":0,"height":0,"gtype":"gage","title":"VIP","label":"","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"4","seg2":"8","x":890,"y":380,"wires":},{"id":"70a84dae.3a96e4","type":"ui_gauge","z":"3ea65e14.3e2f22","name":"","group":"8e1cc9b.f93d238","order":1,"width":0,"height":0,"gtype":"gage","title":"Handicap","label":"units","format":"{{value}}","min":0,"max":"15","colors":["#00b500","#e6e600","#ca3838"],"seg1":"7","seg2":"13","x":900,"y":320,"wires":},{"id":"2c7dfe1d.b5ffc2","type":"ui_group","z":"","name":"Parkplatz voll","tab":"fb71c1a6.2359f","order":5,"disp":true,"width":"6","collapse":false},{"id":"1ac9c18d.ecd92e","type":"ui_group","z":"","name":"Regular","tab":"fb71c1a6.2359f","order":1,"disp":true,"width":"6","collapse":false},{"id":"d22d3c54.cb229","type":"ui_group","z":"","name":"VIP","tab":"fb71c1a6.2359f","order":3,"disp":true,"width":"6","collapse":false},{"id":"8e1cc9b.f93d238","type":"ui_group","z":"","name":"Handicap","tab":"fb71c1a6.2359f","order":2,"disp":true,"width":"6","collapse":false},{"id":"fb71c1a6.2359f","type":"ui_tab","z":"","name":"Einfahrt","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

@MoMo Monika, welcome to the forum. There are a couple of things you should do when requesting help:

  1. provide the platform/os you are using Node-RED on
  2. what version of NR, node.js and dashboard (if the issue involves the dashboard) are you using - this can all be found in the NR start up log
  3. the full names of any 'extra' nodes you are using (node-red-contrib-xxxxxxx) Remember, it is unlikely someone else has installed all the same noes you have.
  4. when pasting a flow to a reply, follow the rules in this thread (How to share code or flow json ) so the flow will import.

Since this is your university project, I'll be happy to help you solve your issues yourself. My first suggestion is to make sure what you are sending to the gauge is what you think you are sending to the gauge. To do that, put a debug node (set to display the complete msg object) on the output of the node sending data to the gauge node.

Then show the data you are getting ask yourself,
"Why is this data not appearing on the gauge?"
"Did I format it corretly?'

Thanks for your reply.
Now here is my flow:

[{"id":"21a2d51b.7859da","type":"inject","z":"3ea65e14.3e2f22","name":"decrement regular","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":130,"y":160,"wires":[["7c56f728.920dd8"]]},{"id":"197277fd.a9eb48","type":"inject","z":"3ea65e14.3e2f22","name":"increment regular","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":120,"y":120,"wires":[["516eea40.5901b4"]]},{"id":"57c982de.daaf1c","type":"inject","z":"3ea65e14.3e2f22","name":"reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":90,"y":200,"wires":[["b93f5b7f.772258"]]},{"id":"516eea40.5901b4","type":"function","z":"3ea65e14.3e2f22","name":"msg object","func":"msg.increment = 1;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":120,"wires":[["8f77e7f1.829588"]]},{"id":"b93f5b7f.772258","type":"function","z":"3ea65e14.3e2f22","name":"msg object","func":"msg.reset = 10;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":200,"wires":[["8f77e7f1.829588"]]},{"id":"7c56f728.920dd8","type":"function","z":"3ea65e14.3e2f22","name":"msg object","func":"msg.decrement = 1;\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":160,"wires":[["8f77e7f1.829588"]]},{"id":"ba82d9e.781e928","type":"debug","z":"3ea65e14.3e2f22","name":"count","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":40,"wires":},{"id":"8f77e7f1.829588","type":"counter","z":"3ea65e14.3e2f22","name":"","init":"1","step":"1","lower":"0","upper":"20","mode":"increment","outputs":2,"x":560,"y":140,"wires":[["ba82d9e.781e928"],["4a9c5290.57742c"]]},{"id":"16abd925.d1f627","type":"inject","z":"3ea65e14.3e2f22","name":"normal msg without control parameter","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":210,"y":60,"wires":[["8f77e7f1.829588"]]},{"id":"4a9c5290.57742c","type":"switch","z":"3ea65e14.3e2f22","name":"","property":"payload","propertyType":"flow","rules":[{"t":"lte","v":"20","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":200,"wires":[["e8f96dc9.3fdb"],["af0b06f7.bd4648"]]},{"id":"af0b06f7.bd4648","type":"ui_text","z":"3ea65e14.3e2f22","group":"2c7dfe1d.b5ffc2","order":0,"width":0,"height":0,"name":"occupied","label":"Bitte warten Sie!","format":"{{msg.payload}}","layout":"row-spread","x":900,"y":240,"wires":},{"id":"876465f1.50fc98","type":"debug","z":"3ea65e14.3e2f22","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":80,"wires":},{"id":"e8f96dc9.3fdb","type":"ui_gauge","z":"3ea65e14.3e2f22","name":"","group":"1ac9c18d.ecd92e","order":2,"width":0,"height":0,"gtype":"gage","title":"Regular","label":"","format":"{{value}}","min":0,"max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"10","seg2":"15","x":900,"y":180,"wires":},{"id":"53a2e5f5.45b6ac","type":"ui_gauge","z":"3ea65e14.3e2f22","name":"","group":"d22d3c54.cb229","order":2,"width":0,"height":0,"gtype":"gage","title":"VIP","label":"","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"4","seg2":"8","x":890,"y":380,"wires":},{"id":"70a84dae.3a96e4","type":"ui_gauge","z":"3ea65e14.3e2f22","name":"","group":"8e1cc9b.f93d238","order":1,"width":0,"height":0,"gtype":"gage","title":"Handicap","label":"units","format":"{{value}}","min":0,"max":"15","colors":["#00b500","#e6e600","#ca3838"],"seg1":"7","seg2":"13","x":900,"y":320,"wires":},{"id":"2c7dfe1d.b5ffc2","type":"ui_group","z":"","name":"Parkplatz voll","tab":"fb71c1a6.2359f","order":5,"disp":true,"width":"6","collapse":false},{"id":"1ac9c18d.ecd92e","type":"ui_group","z":"","name":"Regular","tab":"fb71c1a6.2359f","order":1,"disp":true,"width":"6","collapse":false},{"id":"d22d3c54.cb229","type":"ui_group","z":"","name":"VIP","tab":"fb71c1a6.2359f","order":3,"disp":true,"width":"6","collapse":false},{"id":"8e1cc9b.f93d238","type":"ui_group","z":"","name":"Handicap","tab":"fb71c1a6.2359f","order":2,"disp":true,"width":"6","collapse":false},{"id":"fb71c1a6.2359f","type":"ui_tab","z":"","name":"Einfahrt","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

I use Node-Red locally on my PC. The Version of NR is 1.0.4 Maintenance Release. I've installed the node-red-contrib-counter and node-red-dashboard

So i don't know how the Counter works? Perhaps I may have to format the counters before I send it to the Gauge?

In order to get help, it is prudent to reply fully to the questions/suggestions asked.

Yes I did, but nothing happens with the Gauge:

2020-04-27 13_12_30-Node-RED Dashboard

so what is going into the gauges?

Put debug nodes EVERYWHERE.

Especially where they go into the gauge (i.e AFTER the switch, before the gauge)

Then try again. If it doest work look at the value that would have went into the gauge.

It finally works!! Thank you so much!!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.