How to set an input toggle helper value in automation - SOLVED

Input toggle doesn’t show up as a device in automation and I can’t find a way to set it, I can only read it. Is it possible to set the toggle input value in automation?

If not, is there an alternative, comparable to a virtual switch in SmartThings where you can both get and set it’s value?

Try input boolean services.

service: input_boolean.toggle
data: {}
target:
  entity_id: input_boolean.armed

A Toggle helper, as its called in the UI, actually produces an Input Boolean entity.

All of an Input Boolean’s service calls are documented here:

Service Data Description
turn_on entity_id(s)
area_id(s)
Set the value of specific input_boolean entities to on
turn_off entity_id(s)
area_id(s)
Set the value of specific input_boolean entities to off
toggle entity_id(s)
area_id(s)
Toggle the value of specific input_boolean entities
reload Reload input_boolean configuration

If you want to turn on an Input Boolean, use the input_boolean.turn_on service call.

service: input_boolean.turn_on
target:
  entity_id: input_boolean.example

To get the state of any entity, such as an Input Boolean, you must use a template with the states() function. This is explained in the Templating documentation.

It’s not a device. Devices are physical things.

Yup. You shouldn’t use devices in automations at all. Am I starting to sound like a cracked record? :roll_eyes:

1 Like

Thanks all, it works! Yes, I should have read the documentation before posting…