Switches
Misc examples using switches.
Inverted Switch
Creates an inverted copy of an existing switch. My Watercop water valve at home returns on
when the water is off and off
when the water if on. Inverting these makese more sense.
switch: - platform: template switches: water_valve: friendly_name: Water Valve icon_template: >- {% if is_state('switch.water_valve_existing', 'off') %} mdi:water-pump {% else %} mdi:water-pump-off {% endif %} value_template: "{{ is_state('switch.water_valve_existing', 'off') }}" turn_on: - service: homeassistant.turn_off data: entity_id: - switch.water_valve_existing turn_off: - service: homeassistant.turn_on data: entity_id: - switch.water_valve_existing