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

Automation - syntax correct, loaded OK, triggers, does not do what I want!

$
0
0

@nealedowling wrote:

Hello.

can anyone shed some light on why an automation is not working.
Here is the code:

- alias: Set AM Start Time based on Delphine's Work Time
  trigger:
    platform: time
    at: "00:00:01"
  condition:
    condition: template
    value_template: "{{ state_attr('calendar.delphine_work_calendar', 'start_time') [0:10] == states.sensor.date.state }}"
  action:
    service: input_select.select_option
    data_template:
      entity_id: input_select.stoveamstart
      option: >-
        {% if (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '16:30:00' %}
          '07:00'
        {% elif (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '10:00:00' %}
          '07:00'
        {% elif (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '13:30:00' %}
          '07:00'
        {% elif (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '06:45:00' %}
          '04:30'
        {% elif (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '08:00:00' %}
          '06:00'
        {% elif (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '08:45:00' %}
          '06:30'
        {% elif (state_attr('calendar.delphine_work_calendar', 'start_time') [11:19]) == '09:30:00' %}
          "07:00"
        {% endif %}

I have tested if conditions in the data template. All of the set values are valid options for input_select.stoveamstart.

The current attribute ‘start_time’ of calendar.delphine_work_calendar is ‘2019-11-19 09:30:00’ - which when used with the [11:19] evaluates to 09:30:00.

{{ (state_attr(‘calendar.delphine_work_calendar’, ‘start_time’) [11:19]) == ‘09:30:00’ }} shows true in the templates dev tool. All of the other conditions evaluate to false currently.

However I try, it does not do what I want.
Call the service input_select.select_option with data entity_id: entity_id: input_select.stoveamstart and time: 07:00.

As you may notice, I have tried changing the ‘07:00’ to “07:00” in the automation - changes nothing.

I really cannot see why it’s not working - Anyone like to enlighten me?

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95437

Trending Articles



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