#"Door" binary sensor always "open"

9 messages · Page 1 of 1 (latest)

naive galleon
#

i am trying to set the state of an entity through the API but the door always shows as "open" (as in the icon is always the open icon and it is always highlighted).

im changing it by sending a post request to http://192.168.3.10:8123/api/states/binary_sensor.front_door_test with the json body:

{
    "state": "closed",
    "attributes": {
        "device_class": "door"
    }
}
#

for another door with an actual sensor it shows this and this is what i was expecting to get from the API sensor as well

plush willow
#

Try using off and on

#

The open/closed displayed is just a translation based on the fact it's a door

#

What you're doing is setting the value to be the string "closed" - which because of the way the back end works - actually evaluates to "on/open" for the purpose of displaying things like that

naive galleon
#

ok, that worked. i read this bit at the top of the docs and assumed that string was the bit i needed to send (and also assumed that a door would be the same as a window)

plush willow
#

Hmmm that's a fair point... Closed should actually work

#

I normally just stick to on/off as I know that always works

naive galleon
#

yeah, will switch to sticking with on/off. makes less sense in the code but if its more reliable ill go with that and add comments where needed