Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Boolean with fun #846

Open
wavespan opened this issue Jan 15, 2024 · 0 comments
Open

Boolean with fun #846

wavespan opened this issue Jan 15, 2024 · 0 comments

Comments

@wavespan
Copy link

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant