"Dummy" binary sensor?

Is there any way to create a “dummy” binary sensor the state of which is controlled only from automations, with no actual platform behind it? I know I can use an input boolean, but I want it to be a binary sensor, with all of the features thereof (customization options, being legal to use where a binary sensor is expected, etc.).

I’ve done this using an MQTT-based binary sensor, setting its state by having the automation post MQTT packets, but that seems overkill - why go out to the MQTT server and then back into HA when both the automation and the sensor are in HA…

Not a direct solution, but you could control the input boolean from your automations and simply put the value of it into a template binary sensor to get the binary sensor features.

FWIW, there are, or at least used to be, ways to set the state of pretty much anything directly (like you can do from the dev states page), but I’m not sure how to do that from an automation off the top of my head.

I know how to set it, I just want to make sure it doesn’t get changed in any way other than the automation. A template sensor with a valid but meaningless template sounds may be the way to go.

An input boolean is effectively what you’re after.

But an input boolean isn’t interchangeable with a binary sensor, is it? Service calls, events, etc.?

An input_boolean has services whereas a binary_sensor does not.

1 Like

Without abuse of the REST API, you can’t set the state of a sensor. You can set the state of an input_X entity, and you can even create a template sensor (or template binary sensor) backed by one if you really want to.

1 Like