Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105646

Light - color_name template

$
0
0

Hi, my automation logs error but working fine:

  alias: Bramy otwarte - gateway
  trigger:
  - entity_id:
    - binary_sensor.brama_garazowa
    - binary_sensor.brama_wjazdowa_contact
    platform: state
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.brama_garazowa
      state: 'on'
    - condition: state
      entity_id: binary_sensor.brama_wjazdowa_contact
      state: 'on'
  action:
  - service: light.turn_on
    data_template:
      entity_id: light.gateway_light_7xxxxx
      color_name: >-
        {% if is_state('binary_sensor.brama_garazowa', 'on') and is_state('binary_sensor.brama_wjazdowa_contact', 'off') %}
          blue
        {% elif is_state('binary_sensor.brama_garazowa', 'off') and is_state('binary_sensor.brama_wjazdowa_contact', 'on') %}
          green
        {% elif is_state('binary_sensor.brama_garazowa', 'on') and is_state('binary_sensor.brama_wjazdowa_contact', 'on') %}
          yellow
        {% else %} 
          white
        {% endif %}
      brightness: 50
  mode: single

I get error:

Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['color_name']
Bramy otwarte - gateway: Already running

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105646

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>