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

Automation with various conditions

$
0
0

Hello Everyone,

I need some help to finish an automation. I have a motion sensor that turns on my bathroom light. I had it to set a low light between 1-6 am and full-strength any other time. It then has a delay of 3 minutes and switches off if no motion is detected. This works fine most of the time but I decided that I wanted it to stay on and ignore the motion sensor if it’s switched on manually. Therefore the state of the light.master_bathroom light.master_bathroom has to be “off”. I’m constantly getting the error “[choose] is an invalid option for [automation]” although I have used it before in automations. Any help will be appreciated.

This is what I have so far:

- alias: Turn on/off Main Bathroom Light using sensor4
  trigger:
    - platform: mqtt
      topic: "zigbee2mqtt/IKEA Sensor 4"
      payload: true
      value_template: "{{ value_json.occupancy }}"
  action:
    - choose:
      - conditions:
        - condition: time
          after: '01:00:00'
          before: '06:00:00'
        - condition: state
          entity_id: light.master_bathroom
          to: "off"    
        sequence:
        - service: light.turn_on
          entity_id: light.master_bathroom    
          data:
            brightness: 35
            color_temp: 554    
        - delay:
          minutes: 3
        - service: light.turn_off
          target:
            entity_id: light.master_bathroom        
      - conditions:
        - condition: state
          entity_id: light.master_bathroom
          to: "off"                                      
      sequence:  
      - service: light.turn_on
        entity_id: light.master_bathroom    
        data:
          brightness: 255
          color_temp: 225        
      - delay:
        minutes: 3
      - service: light.turn_off
        target:
          entity_id: light.master_bathroom      
      default: []              
  mode: restart

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 102826

Trending Articles



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