Message ON/OFF in case one sensor Stop working

I have 3 sensors to send data but I need that in case any stops sending data show a message in the dashboard for example when it is active show ON and when it is inactive show OFF, the ideia is create a alert message.
If you compare the current value with the previous one and if it is the same it is signal that the sensor is stopped and then it should send a message saying OFF but the current value is different from the previous one it should send message to say ON.
I have a Join node with this configuration

[{"id":"f9879ec5.a91d6","type":"join","z":"caaedfb9.ac4da","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"15","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1597.1000061035156,"y":314,"wires":[["a4a957e.0e191a8","bba2a16.1af466"]]}]

and i need compare the values of array

see - Trigger Email if Input not recevied since x minutes?

I tried the Trigger and I have the sensor active but I get an OFF, the Inject configuration is as follows:

[
    {
        "id": "20020f02.5964a",
        "type": "inject",
        "z": "caaedfb9.ac4da",
        "name": "Inject Inductive Sensor",
        "topic": "ns=2;s=SensorIndutivo",
        "payload": "",
        "payloadType": "num",
        "repeat": "10",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 143.00005340576172,
        "y": 741.0000114440918,
        "wires": [
            [
                "1d56aab1.c971c5"
            ]
        ]
    }
]

and Trigger configuration is:

[
    {
        "id": "1d56aab1.c971c5",
        "type": "trigger",
        "z": "caaedfb9.ac4da",
        "op1": "",
        "op2": "OFF",
        "op1type": "str",
        "op2type": "str",
        "duration": "10",
        "extend": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "",
        "x": 268.90002822875977,
        "y": 870.0000133514404,
        "wires": [
            [
                "647046d0.7b5b38",
                "eeea9976.35ecb8"
            ]
        ]
    }
]

and i receive in debug

image

The sensor is working and send a OFF in Trigger

maybe re-read the instructions...

the key part is to tick the box extend delay if new message arrives .

I do that and the result is the same

The trigger node is not going to look at a value to see if it has changed, it just looks to see msg's are coming in.

You say you need to monitor to see if a sensor is not sending data - but first some basic questions:

  1. What platform/os are you running on?
  2. what version of NR, node.js are you using? (look at NR start up log)
  3. how often are the sensors sending the data?
  4. how are you reading the data - i.e. are the sensors sending the data via MQTT?
  5. is it possible a sensor might validly send the same reading twice in a row? (i.e. temperature remains steady)

The platform i´m using is CompactRIO and Labview, the version of Node-Red is [v0.19.5], the sensors sending data every 10 seconds, i´m reading the data between topics of OPC UA (ex. ns=2;s=LM35), more or less the value of temperature is stable. I send the values to a database

image

and i need detect if the sensor is sending data or not sending data(like show a message ON or OFF
when one sensor stops sending data( in this case the LM335), in my database the value is undefined like this
image

I’m confused your last example where one sensor is undefined is a valid database entry.

What would you want the database to record? Or is it just your dashboard you want to change?

For Dasboard i only need to show in dashboard a message (text) that says ON or OFF when the sensor is active (ON) or inactive (OFF), is that i want show in dasboard.

so the Trigger node should be able to tell you when you don’t get a value when you expect it.
A switch node should be able to separate that from a true value
and a change node will be bale then to change msg.payload to On

I would suggest you set up some triggers with different values and have a play

Can you help me to construct this part with Trigger with switch and change?

I've tried use the Trigger but only send a zero when i defined a number

Not from the train on my phone!
Show us what you have done, you have all the pieces you need.
Start with the trigger node, configure it and attach a debug.
Confirm the messages in the debug, match what you expect.

I showed you in the other thread how to configure the trigger node to send On each time a good sample is received, and if the samples stop coming then to send Off.

I've done that way and the result is:


the Trigger Confiiguration

13/02/2019, 14:29:38[node: Output Tigger](http://10.6.4.101:1880/#)ns=2;s=SensorIndutivo : msg.payload : string[2]

"ON"

13/02/2019, 14:29:38[node: Output Tigger](http://10.6.4.101:1880/#)ns=2;s=SensorIndutivo : msg.payload : string[3]

"OFF"

Send ON and OFF together

You have the delay set to 500 milliseconds so it will send one then 0.5 seconds later it sends the other. You need to set the timeout larger than the normal time between samples.
Also you do not want to send ON or OFF to the Join node, that should still be connected direct to the sensor.

Moved to Show if sensor is ative or inactive