Automation actions with condition

Are conditions no longer allowed in actions?

Invalid config for [automation]: [condtion] is an invalid option for [automation]. Check: automation->action->1->condtion. (See /home/homeassistant/.homeassistant/configuration.yaml, line 253). Please check the docs at Automation - Home Assistant

The error appears to be on the condition statement that is part of the action below.

- alias: 'Bookshelf state sync'
      trigger:
        platform: time_pattern
        # Matches every 5 seconds
        seconds: '/5'
      condition:
        condition: or
        conditions:
          - condition: template
            value_template: '{{ states.light.bookshelf.state != states.light.bsmt_bar_overhead_level.state }}'
          - condition: or
            conditions:
              - condition: template
                value_template: '{{ states.light.bookshelf.attributes["brightness"] - states.light.bsmt_bar_overhead_level.attributes["brightness"] > -2 }} '
              - condition: template
                value_template: '{{ states.light.bookshelf.attributes["brightness"] - states.light.bsmt_bar_overhead_level.attributes["brightness"] < -2 }} '
      action:
        - service_template: "{{ 'light.turn_on' if states.light.bsmt_bar_overhead_level.state == 'on' else 'light.turn_off' }}"
          entity_id: light.bookshelf
        - condtion: template
          value_template: '{{ "on" == states.light.bsmt_bar_overhead_level.state }}'
        - service_template: "{{ 'light.turn_on' if states.light.bsmt_bar_overhead_level.state == 'on' else 'light.turn_off' }}"
          entity_id: light.bookshelf
          data_template:
            brightness: '{{ states.light.bsmt_bar_overhead_level.attributes["brightness"] }}'

I’m trying make an automation that will sync two light entities and I don’t want to pass brightness to the turn_off service.

1 Like

It’s a typo. Change condtion to condition.

- condtion: template

:man_facepalming:
that did it, thanks

I have a few cameras running on a Blue Iris Server that feeds Home Assistant via a MQTT feed for the motion sensors.
3 Fire Tablets throughout the house running Fully Kiosk Browser on Fire Tablets.
Currently I have automation and scripts setup to go to full screen of that camera for 3 minutes on each of the Fire Tablets and then return to the base home assistant start page after 3 minutes. This is a static automation without conditions.
Please if I could receive assistance on:
Motion --> Full screen video pops up on Fully Kiosk Browser, need assistance with conditional statement/timer that keeps that full screen up if there is continued motion triggered (Currently it is set after 3 minutes to return back to the home screen regardless of future events)
Motion --> Full screen video pops up on Fully Kiosk, need assistance with a conditional statement that if there is any other motion triggered within 3 minutes of each other to bring up a different video url that includes all the cameras: http://192.168.87.66:81/mjpg/index/video.mjpeg. In addition, if there is persisted motion on any of the cameras to extend the video on the tablets rather than returning to the home screen.
Example: Front Door Motion, Full Screen Front Door Camera Video URL comes on Fire Tablets via Fully, 1 minute passes, Motion at Driveway --> I want at this point for a different URL to be sent to Fully Kiosk Browser that includes all the cameras (listed above).
Lastly, I have 2 of the Fire Tablets that go dim/screen off after no motion for 30 seconds or so. display.turn_on via Fully does turn on the screens. I’d like to be able to integrate display.turn_on throughout the video sequences above and not have them go dark.
Example of Current Automations/Scripts:
Front Door Motion Triggered – Scripts to pull up video on Kiosk Tablets
- alias: FD Motion
  trigger:
    platform: state
    entity_id: binary_sensor.mqtt_front_door_motion
    to: 'on'
  action:
  - service: homeassistant.turn_on
    entity_id: script.fdimage
  - service: homeassistant.turn_on
    entity_id: script.motion_fd_alexa
  - service: homeassistant.turn_on
    entity_id: script.fdmotionlr
  - service: homeassistant.turn_on
    entity_id: script.fdmotionbr
  - service: homeassistant.turn_on
    entity_id: script.fdmotionmini
  id: 86d5f5ca35c94f40a2f97e281e42e0d0
Script Example:
fdmotionlr:
  sequence:
    - service: display.turn_on
      entity_id: display.living_room_tablet
    - delay:
        seconds: .3    
    - service: fully_kiosk.screensaver_stop
      entity_id: display.living_room_tablet
    - delay:
        seconds: .3
    - service: display.load_url
      entity_id: display.living_room_tablet
      data:
        url: http://192.168.87.66:81/mjpg/FD/video.mjpeg
    - delay:
        minutes: 3
    - service: display.load_url        
      entity_id: display.living_room_tablet
      data:
        url: http://192.168.87.68:8123/lovelace/Tablet

Thank you!