Automation error

I’m trying to create a simple automation that will trigger my sprinkler to go on at 3:00AM if there is less than 20% chance of rain that day. I continue to get the same error, anyone see anything wrong with my config?

error is > [homeassistant.config] Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->action->0->state. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/

# Turns on sprinkler if its not going to rain that day
alias: 'Garden Sprinkler On'
trigger:
  platform: time
  after: "03:00:00"
condition:
  condition: numeric_state
  entity_id: sensor.dark_sky_precip_probability
  below: 20
action:
  service: switch.garden_sprinkler
  state: "on"

I would try it like this…

# Turns on sprinkler if its not going to rain that day
alias: 'Garden Sprinkler On'
condition:
  condition: numeric_state
  entity_id: sensor.dark_sky_precip_probability
  below: 20.0
trigger:
  - platform: time
    after: "03:00:00"
action:
  - service: switch.garden_sprinkler
    state: "on"
1 Like
# Turns on sprinkler if its not going to rain that day
alias: 'Garden Sprinkler On'
trigger:
  platform: time
  after: "03:00:00"
condition:
  condition: numeric_state
  entity_id: sensor.dark_sky_precip_probability
  below: 20
action:
  service: switch.turn_on
  entity_id: switch.garden_sprinkler
1 Like

Good catch rpitera missed the switch on :stuck_out_tongue: Was concenrating on the numeric_state.

1 Like