Condition inside of a script? - Problem

i’m trying several things to get my garage door automated.

i decided to try to run a script that checks the position of the door before operating it

here is the code:

close_gdn:
    alias: can only close garage door if open
    sequence:
      - condition: state
        entity_id: binary_sensor.garage_door_north_position_sensor
        state: on
      - service: switch.turn_on
        entity_id: switch.garage_door_north_operator_switch

here is the log:

2017-07-31 05:51:49 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: [condition] is an invalid option for [script]. Check: script->script->close_gdn->sequence->0->condition. (See /home/homeassistant/.homeassistant/configuration.yaml, line 142). Please check the docs at https://home-assistant.io/components/script/
2017-07-31 05:51:49 ERROR (MainThread) [homeassistant.setup] Setup failed for script: Invalid config.
2017-07-31 05:51:49 WARNING (Thread-9) [homeassistant.components.emulated_hue] When targetting Google Home, listening port has to be port 80
2017-07-31 05:51:51 ERROR (Thread-8) [homeassistant.components.light.hue] Error connecting to the Hue bridge at 192.168.1.125

Anyone know why it says β€œ[condition] is not a valid option for [script]”?

EDIT:

fixed it by putting ’ ’ around the state value - state: β€˜on’

If think you should not put it in your sequence, but as a condition in close_gnd.

Or as a condition from your close trigger/automation

Thanks for the reply but I already figured out what was wrong.

I ended up having to put ’ ’ around the state: value.

Like:

state: β€˜on’

I somehow missed that in the examples

2 Likes

Just had the same issue, glad I found this post :smile:

1 Like