lorawan-server icon indicating copy to clipboard operation
lorawan-server copied to clipboard

Boolean with fun

Open wavespan opened this issue 5 months ago • 0 comments

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

wavespan avatar Jan 15 '24 20:01 wavespan