Rest binary_sensors not go OFF when unreachable

I’d like for my REST binary sensors to not automatically go OFF when the URL they’re checking is unreachable. Maybe add an attribute, or a way to allow, in configuration, for the sensor to retain its state.

Template binary sensor allows ON, OFF , Other state I believe.

Maybe use that.
I used this for MQTT sensors that vanished if not detected for some period.

Furthermore, if the REST call fails during initialization of HASS, the entity is not created. This leads to other problems. Can this be fixed (at least create the binary_sensor entity in the OFF state)? Any other suggestions?

Is there a way to cause HASS to enstantiate the binary_sensor later?

1 Like

I’m having the same problem too - with this code:

- platform: rest
  name: Js Car Keys

If it’s not found at boot time, it’s unavailable unless it catches on the next reboot.

The curl command equivalent finds the BLe keyring every time.

There is another binary_sensor querying that api at boot time, so I’m guessing there’s a type of race condition, and one of the binary sensors has to lose. There is, by necessity, a 3 second scan time for the api.

Only once have both been seen, otherwise it’s back & forth between the two as to which one is available.

I thought I was so clever making that little api yesterday, oh well. I’ll have to find another scanning method.

I opened a thread a couple off days ago with the same problem I think. I hope this gets fixed soon.

RESTfull “unavailable”

I also have this problem, as I’m using it to have Google Home tell me when my download manager has finished a new download it gets a touch annoying…

It would be nice to have it simply ignore “unavailable” states and only update when actual data is fetched:)