The SmartEdge IIOT GatewaySmartEdge IIOT Gateway is a Raspberry Pi 3 Compute based industrial Linux box. It runs Raspbian with some additions. There's a set of industrial hardware extensions. In this 2nd Node-RED blog I show the industrial I/O status on a Node-RED dashboard. |
In the 1st Node-RED blog, I controlled the SmartEdge's industrial I/Os in a process flow.
Here, I'm extending that same flow, to show an input pin state on a Node-RED dashboard.
Let's pretend that we have a boiler on/off detector attached to input A I1.
The state is shown on 3 controls:
- a "button style" indicator
- a label
- a history of the last hour
This is easy. I replaced the debug output block of last post with the 3 controls.
Label
The state reader block, labeled DIGIO A I1, gives character 1 or 0, dependent on the state of SmrtEdge's DIGIO A input 1.
I just added a text node, connected the reader output to it. And gave it a name.
History Graph
This one is also directly connected. I changed some attributes to make it looks good.
I didn't find a way to just show 0 and 1 on the Y axis, without in-between ticks and labels
Indicator
This one expects a boolean input.
I put a conversion function between the reader output and the indicator:
Then, I made the switch read-only and told it to show the input status:
Keeping the View Up-to-date
The last task was to take care that the status is read regularly.
In the previous post, I used an Inhjection block. Every time it's clicked, the input pin's state is read.
I've kept that same block, but scheduled it:
You can choose the interval as you please. If you want a faster refresh than 1 second, you can use decimals.
That's it. These little additions give you a dashboard that you can view from a PC or tablet.