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

Can't get thi Scheduler to work

$
0
0

@Philippe_Demartin wrote:

Ha
I’m trying tu get my working automation schedule to work with the adition of day of the week schedule.
My initial working code is this:

- id: Sprinkler_Schedule
  alias: Sprinkler Schedule
  trigger:
  - minutes: /1
    platform: time_pattern
    seconds: '0'
  condition:
  - condition: template
    value_template: '{{ states(''sensor.time'') ==  states(''sensor.sprinklertime'')}}'
  action:
  - data:
      entity_id: switch.sprinklerzone1
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve1.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone1
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone2
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve2.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone2
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone3
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve3.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone3
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone4
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve4.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone4
    service: homeassistant.turn_off
  - data:
      message: Sprinkler done.
    service: persistent_notification.create

Now I added the needed input_boolean to define the days of operation, and added some condition and, or , With template, and using state function, niether are working … any clue to hel me ?
My automation using template:

- id: Sprinkler_Schedule
  alias: Sprinkler Schedule
  trigger:
  - minutes: /1
    platform: time_pattern
    seconds: '0'
  condition:
    condition: and
    conditions:
    - condition: template
      value_template: '{{ states(''sensor.time'') ==  states(''sensor.sprinklertime'')}}'
    - condition: or
      conditions:
      - condition: template
        value_template: '{{ states(''input_boolean.monday'') == on }} and states(''sensor.dayoftheweek'') == Monday }}'
      - condition: template
        value_template: '{{ states(''input_boolean.tuesday'') == on }} and states(''sensor.dayoftheweek'') == Tuesday }}'
      - condition: template
        value_template: '{{ states(''input_boolean.wednesday'') == on }} and states(''sensor.dayoftheweek'') == Wednesday }}'
      - condition: template
        value_template: '{{ states(''input_boolean.thursday'') == on }} and states(''sensor.dayoftheweek'') == Thursday }}'
      - condition: template
        value_template: '{{ states(''input_boolean.friday'') == on }} and states(''sensor.dayoftheweek'') == Friday }}'
      - condition: template
        value_template: '{{ states(''input_boolean.saturday'') == on }} and states(''sensor.dayoftheweek'') == Saturday }}'
      - condition: template
        value_template: '{{ states(''input_boolean.sunday'') == on }} and states(''sensor.dayoftheweek'') == Sunday }}'
  action:
  - data:
      entity_id: switch.sprinklerzone1
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve1.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone1
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone2
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve2.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone2
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone3
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve3.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone3
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone4
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve4.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone4
    service: homeassistant.turn_off
  - data:
      message: Sprinkler done.
    service: persistent_notification.create

My automation using States :

- id: Sprinkler_Schedule
  alias: Sprinkler Schedule
  trigger:
  - minutes: /1
    platform: time_pattern
    seconds: '0'
  condition:
    condition: and
    conditions:
    - condition: template
      value_template: '{{ states(''sensor.time'') ==  states(''sensor.sprinklertime'')}}'
   - condition: or
     conditions:
     - condition: state
       entity_id: input_boolean.monday
       state: 'on'
     - condition: and
       conditions:
       - condition: state
         entity_id: sensor.dayoftheweek
         state: Monday
    - condition: or
      conditions:
      - condition: state
        entity_id: input_boolean.tuesday
        state: 'on'
      - condition: and
        conditions:
        - condition: state
          entity_id: sensor.dayoftheweek
          state: Tuesday
    - condition: or
      conditions:
      - condition: state
        entity_id: input_boolean.wednesday
        state: 'on'
      - condition: and
        conditions:
        - condition: state
          entity_id: sensor.dayoftheweek
          state: Wednesday
     - condition: or
       conditions:
       - condition: state
         entity_id: input_boolean.thursday
         state: 'on'
       - condition: and
         conditions:
         - condition: state
           entity_id: sensor.dayoftheweek
           state: Thursday
     - condition: or
       conditions:
       - condition: state
         entity_id: input_boolean.friday
         state: 'on'
       - condition: and
         conditions:
         - condition: state
           entity_id: sensor.dayoftheweek
           state: Friday
     - condition: or
       conditions:
       - condition: state
         entity_id: input_boolean.saturday
         state: 'on'
       - condition: and
         conditions:
         - condition: state
           entity_id: sensor.dayoftheweek
           state: Saturday
     - condition: or
       conditions:
       - condition: state
         entity_id: input_boolean.sunday
         state: 'on'
       - condition: and
         conditions:
         - condition: state
           entity_id: sensor.dayoftheweek
           state: Sunday
  action:
  - data:
      entity_id: switch.sprinklerzone1
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve1.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone1
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone2
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve2.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone2
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone3
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve3.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone3
    service: homeassistant.turn_off
  - data:
      entity_id: switch.SprinklerZone4
    service: homeassistant.turn_on
  - delay: 00:0{{ states.input_number.valve4.state | int }}:00
  - data:
      entity_id: switch.SprinklerZone4
    service: homeassistant.turn_off
  - data:
      message: Sprinkler done.
    service: persistent_notification.create

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95419

Trending Articles



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