radio check for BinarySwitch nodes
-
hi everyone
i have lighting switch nodes (binary switch sketch) connected to 220v ac contactor in order to monitor the operation of some electrical devices - timed heaters, security alarm buzzer (backup for the security company), and detecting power failure.
because these nodes dont always send data - i wanted to have the nodes send their status even when it doesnt change for about every hour or so.
i have accomplished it in my power failure node using this addition (the else part) to the sketch:if (value != oldValue) { // Send in the new value gw.send(msg.set(value == HIGH ? 0 : 1)); oldValue = value; } else if ((millis() - premil) >= 300000) { gw.send(msg.set(value == LOW ? 0 : 1)); premil = millis(); }but when i tried this on other node it didnt worked in any syntax i tried:
value == LOW ? 0 : 1
value == LOW ? 1 : 0
value == HIGH ? 1 :0
value == HIGH ? 0 : 1and after an hour of trying i realized the case:
- this method can only make the node send routinous data of "on" state only - even if it reads HIGH on the digital pin
- the power failure node always send "on" beacuse it's normally feels electricity - while the other node monitors the turning on of the appliance and as mentioned - it cannot send "off" routinously.
for the clarification of my request: i want a binary switch to be able to send "off" messages from time to time so i'll know it didnt lost connection from the GW.*
example: (translation - the lower one is ON and upper is OFF)

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login