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

Noobie needs help on templated automation triggers!

$
0
0

Thanks for reading! I am old, but have been playing around with HA for months. Now I am getting more involved, but am having trouble with what should be a simple thing - triggering an automation with a value template. Basically I am doing this to eventually get min and max temps for day, week, month, year with date and time f the or min or max. But I wanted to start off with the minimal version :slight_smile:

alias: daily set max temp
description: set or reset daily max temperature
trigger:
  - platform: time
    at: "00:00:00"
    id: daily_reset
  - platform: template
    value_template: >-
      {{ states('input_number.max_daily_temp')|int ==
      states('input_number.max_temp_reset')|int }}
    id: new_max
  - platform: template
    value_template: >-
      {{ states('sensor.gw2000b_outdoor_temperature')|float >
      states('input_number.max_daily_temp')|float }}
    id: new_max
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - daily_reset
        sequence:
          - service: input_number.set_value
            target:
              entity_id: input_number.max_daily_temp
            data:
              value: input_number.max_temp_reset
          - service: notify.alexa_media_my_show
            data:
              message: hey - it is daily reset!
              data:
                type: tts
      - conditions:
          - condition: trigger
            id:
              - new_max
        sequence:
          - service: input_number.set_value
            target:
              entity_id: input_number.max_daily_temp
            data:
              value: "{{ states('sensor.gw2000b_outdoor_temperature')|float }}"
          - service: notify.alexa_media_my_show
            data:
              message: >-
                new max temp is {{states('sensor.gw2000b_outdoor_temperature')}}
                degrees
              data:
                type: tts
          - service: input_number.increment
            data: {}
            target:
              entity_id: input_number.new_max_count
    default:
      - service: notify.alexa_media_my_show
        metadata: {}
        data:
          message: >-
            this temperature reading of {{
            states('sensor.gw2000b_outdoor_temperature')}} degrees and the 
            input number max daily value was
            {{states('input_number.max_daily_temp')}}
          data:
            type: tts
      - service: input_number.increment
        target:
          entity_id: input_number.default_action_no_new_max_count
        data: {}
mode: single

Thanks for all your time and effort!

edit: the daily reset works

6 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 106050

Trending Articles



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