Status Text for many possible outcomes in one place

#1

Guys,

I have created a Tab with a seperate group - i want this group to display status information from a connected microcontroller (Arduino). I have the Arduino sending in MQTT streams fine.

This particular stream is a 3 digit number between 128 and 208 with each increment in 16. So there are values of 128, 144, 160, 176 etc etc

I am capturing this (which is obviously at point of capture being treated as a String, in the format of 128.00) as it was converted from a float at the Arduino end prior to sending

Each of the value is representing a certain State of various output pins on the Arduino - so 160 for example, might be Boiler on, Circulating pump off, Solar Off

I want to interpret each of these and then based on the value that is received place a value on the Dashboard along the lines of Boiler on, Circulating pump off, Solar Off, or another combination might be Solar on, Boiler Off, Circulating Pump on etc etc

I want the output to go into a Status box and for there to only be one output showing at any time (as they are mutually exclusive) - i started trying to do this with the Switch node and then each of the outputs from it putting a Text message onto the Group in the dashboard - but rather than them overwriting each other so only one is visible - they are all treated as being active and their text is displayed on the screen.

So my question is - is the switch Object the right one to use (and is there a way to achieve what i want) or should i just go build a case function (i am familiar with C++ but a babe in the wood with JS) (but happy to learn)

Craig

0 Likes

#2

You could look at doing it with the change node. Open up the change node and change the “Set” to “Change” and it should be self explanatory

0 Likes

#3

You seems to be on the right path. Could you possibly share your flow so as we can learn from this nice use case and perhaps propose some improvement (if needed at all) ?

0 Likes

#4

New to all of this - is there a “correct way” to share a flow etc ?

Craig

0 Likes

#5

I will have a look at that node - THANKS !!!

Craig

0 Likes

#6

You Sir are a Genius !! That worked perfectly and let me do exactly what i wanted. I have the Switch node that checks for the 6 possible values coming in - each outputs a specific value into one of 6 change nodes - those Nodes then set the text that i want on the dashboard and send that text onto a single shared Text Box display node.

BEAUTIFUL - thanks agaiin

Craig

0 Likes

#7

You can probably simplify that a lot. I've not tested this but you can add rules to the change node. So something like this should work...

1 Like

#8

Wow that does clean it up a bit - will have a go at that today to tidy it up more and report back - THANKS again !!

Craig

0 Likes