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)