Skip to content

Boolean with fun #846

@wavespan

Description

@wavespan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions