lorawan-server
lorawan-server copied to clipboard
Boolean with fun
Hope someone can help me as I am struggling. I have a door contact sensor from Dragino LDS02 I am trying to write a fun expression to output a true false value if door is open closed. What I Have that obviously is not working.
fun (Fields, <<Status:8, Bat:8, Mod:8, Events:24, Duration:24, Alarm:8>>) -> Status2 = if Status band 80; true -> 1 end, Fields#{status => Status2} end.
In Node-Red I tried this with the untouched output and it works but can not replicate it with a fun. var door = msg.payload.status & 0x80 ? 1 : 0
Any help would be greatly appreciated