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

How to trigger a scene based on an a states if statement - Error is an invalid entity ID for dictionary value

$
0
0

I have two scenes that will either increase or decrease the fan speed. I am trying to create a condition on which scene will be triggered based on the current fan speed and the set fan speed.

I am currently getting the below error:

Invalid config for ‘fan’ from integration ‘template’ at configuration.yaml, line 47: Entity ID {% if states(‘input_number.percentage’) < percentage %} scene.fan_speed_up {% else %} scene.fan_speed_down {% endif %} is an invalid entity ID for dictionary value ‘fans->bedroom_fan->set_percentage->1->scene’, got “{% if states(‘input_number.percentage’) < percentage %}\n scene.fan_speed_up\n{% else %}\n scene.fan_speed_down\n{% endif %}”, please check the docs at Template - Home Assistant

My fan template below:

fan:
  - platform: template
    fans:
      bedroom_fan:
        friendly_name: "Bedroom fan"
        value_template: "{{ states('input_boolean.state') }}"
        percentage_template: >
          {{ states('input_number.percentage') if is_state('input_boolean.state', 'on') else 0 
          }}
        oscillating_template: "{{ states('input_select.osc') }}"
        turn_on:
          - scene: scene.fan_power
          - action: input_boolean.turn_on
            target:
              entity_id: input_boolean.state
        turn_off:
          - scene: scene.fan_power 
          - action: input_boolean.turn_off
            target:
              entity_id: input_boolean.state
        set_oscillating:
          scene: scene.fan_swing
        speed_count: 3
        set_percentage:
          - action: input_boolean.turn_{{ 'on' if percentage > 0 else 'off' }}
            target:
              entity_id: input_boolean.state
          - scene: >-
              {% if states('input_number.percentage') < percentage %}
                scene.fan_speed_up
              {% else %}
                scene.fan_speed_down
              {% endif %}
          - action: input_number.set_value
            target:
              entity_id: input_number.percentage
            data:
              value: "{{ percentage }}"

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105688

Trending Articles



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