Node suited to my scenario.

Hi everyone, I need some guidance on the following problem:. I have a node that represents a presence sensor, and when activated, it checks if there is someone at home, this verification is done in two steps. First a HomeAssistant node that checks if there is someone in the house, if it is true, another node does a ping to the person's device and checks if it is true. Then a snapshot is taken and sent to a group on the Telegram. If any checks return false a snapshot is taken and also sent and the alarm siren is activated. everything works as expected until there are more people checking in, because if some of them are out and about then the flow understands that it should set off the alarm. Which node would be more suitable to check all residents, if the condition of any returns true at home, then the alarm does not go off.

What kind of device is this, and how does it check if the person is in the house?

From your description of the problem it sounds like you just need to loop round all the people who could be at home and sound the alarm if none of them are.

Hello Molesworth,
Pinging is done by one node, I have implemented two stages of verification as security. Yes it's exactly what you described I need.
But I don't know exactly which knot would be suitable for this. Thank you in advance for your attention.

I think I understand what you're trying to do, but what for instance do you mean by "pinging"? Is it sending a message to someone's phone (using Telegram or SMS?) and waiting for a reply? Or something more direct, like checking an RFID tag?

You would need to explain what messages are sent and received for the "ping", and how you might want to deal with devices which don't respond etc.

Ping is the command to check whether a device responds on the network whether internal or external. Ex (# ping Hence if there is response from the command and returns true. As for the message sent to the group on the Telegram, it's just a photo taken at the time the motion sensor was triggered, that is, this part is ok. I just need to have a node that assesses if there is anyone at home, if there is at least one person at home, take path A, if there is no one at home, take path B

Ah, you mean an actual "ping" :slight_smile: I thought you were using it in a general sense of checking if a device is active. There are several ping nodes available, but probably the simplest is node-red-node-ping (node) - Node-RED which allows the IP address to be passed in msg.topic.

For the checking process, I think that if you're checking e.g. mobile phones of people likely to be in the building, then you would have to be sure that they were always set to connect to the local network, and that they were given fixed IP addresses, rather than dynamically from DHCP, so you knew which ones to ping.

By checking a table of expected IP addresses you could disable the alarm if anyone's phone/device responded, meaning they were connected to the local network, and sounding it if all pings failed.

I have exactly this scenario, smartphones are already configured and receive a fixed ip number previously determined in the ap. I also already use this node that pings the device. But my question is which node to use in the stream after the "ping". The next node needs to collect the information from the "ping" node and make a decision. If there is someone at home, divert the flow to path B, otherwise take path A. Which node would this be? have a knot ready? Or do I have to venture into the function node and write code for it?

I'm fairly new to Node-RED myself and haven't had time to explore many of the nodes available, so can't really recommend any specific nodes or flows which might be able to check the ping responses.

As a long-time software developer I'd probably use a function node which correlates ping response messages against the table of possible visitors. If all of them fail to respond then sound the alarm and send the images. If any one succeeds then disable the alarm, and possibly log the list of people in the building at that time.

You should also think about failure modes such as a person switching off their phone, batteries runing out, or WiFi not connecting quickly enough leading to false alarms.

thanks for taking the time to respond here. Yes I'm aware of the failures regarding people checking, that's why there are 2 more checks before the ping. moreover the alarm will only go off after I check the images on the Telegram and decide on yes or no. And if I don't answer that within 60 seconds then it assumes yes and fires. Remembering that all residents who are included in the group can.

I'm already taking a look at JS to write the code to put in the function node.

1 Like

Sounds like you've thought through most of what will be needed, so it's just a question of working out the logic for the function. If you get stuck just ask, and I'm sure you'll get plenty of help from the users here on the forum.

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