I am fascinated that I have to ask this, but… How to create automation to simply switch lights off/on?
I created a Condition on a state of the Switch. I can easily Call Service to light.turn_on (or off), depending on state transition. However, I don’t want to create two automation for every single switch/light. I expected that I can call a service to set light to the state of the switch, or some variable, or whatever…
What is the proper way to do that (in the Lovelace interface, not script)? Why are no blueprints for such simple tasks in the initial configuration?
You don’t need a automation for turning on off a light.
Just add the light itself to your lovelace
Everything is in Lovelace. My devices are KNX Integration.
I haven’t understood how to connect a Switch (or Binary Sensor or whatever) to a Light (or Whatever) without automation. What I click to edit a Light entity, I don’t see a way to add a Switch (or the other way round).
If the switch is somehow connected (paired) to the light, like you can do for example with LSC or Ikea remotes, you don’t need a connection switch ↔ light in HA. You either switch the light directly in HA or you steer the light by using the switch in HA.
If the switch is paired to more than one light you can group the lights in HA for having the same effect.
But maybe I got you wrong…
I think the point is that it’s quite cumbersome to associate/synchronize simple states (on/off) of different integrations in HA. I’d love this to be easier than creating an automation too.
For me, connecting otherwise siloed iot universes is the main usecases of HA.
The post you marked with the Solution tag suggests using a choose and trigger.id but your requirements are so simple that none of those concepts are needed.
- id: '1630222098133'
alias: Test svetlo on/off
trigger:
- platform: state
entity_id: switch.kuhinja_radna_povrsina_m7
action:
- service: "light.turn_{{ trigger.to_state.state }}"
target:
entity_id: light.led_ogledalo_apartman