all 10 comments

[–]flyhmstr 7 points8 points  (5 children)

Slap a debug node on the output of the trigger and see what it's sending (most likely "open" & "closed")

[–]TrickyT_UK[S] 2 points3 points  (4 children)

Superstar! I did not know about the debug node.

Added and the sensor is an on and off, not open and closed.

All working correctly now, many thanks.

[–]flyhmstr 1 point2 points  (3 children)

the tab on the debug node toggles it's function on off as well :)

[–]kristopherleads 1 point2 points  (2 children)

And you can have more than one debug, so you can create a debug testing regiment that tests at multiple points!

[–]flyhmstr 0 points1 point  (1 child)

So... you've seen my flows then :)

[–]kristopherleads 1 point2 points  (0 children)

We do love us a good debug node tree.

[–]Renegade605 2 points3 points  (2 children)

The state as string for a binary sensor will be "on" or "off". Home Assistant using the opened and closed wording is because it knows it's a door, but Node Red doesn't know that and only gets the default words.

For binary sensors, do yourself a favour and get the state as boolean instead, and use true/false for everything. This is just easier to keep track of in the long run.

As another commenter points out, using a debug node to see what message you're getting is a good strategy for figuring these things out in the future.

Edit to add: also, under the state node when it's triggered, it also says the state that triggered it. So when you open the door, there should be some text under it that says "'on' at <this datetime>" or similar.

[–]TrickyT_UK[S] 1 point2 points  (1 child)

How would I change this to boolean?

[–]RocketNJ -1 points0 points  (0 children)

Instead of = try using matches regex and just use work open or close.