How can I get this to work?

I want the switch for my misters to come on but only after noon, if the temp is above 88F. Problem is that if the condition is true for temp but not for time, it won’t work even though I have the “Mode” set to “Restart”

alias: Coop Mister
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.coop_interior_temperature
    above: 88
condition:
  - condition: time
    after: "12:00:00"
    before: "18:00:00"
action:
  - type: toggle
    device_id: 9dad1a304cf10dbf3c3c8d123a51f788
    entity_id: ba3fe7ac5784dde033b5ce33764f32cc
    domain: switch
mode: restart

You need to put the temp and time in both the trigger and conditions… also you should specify the turn_on action instead of toggle

alias: Coop Mister
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.coop_interior_temperature
    above: 88
  - platform: time
    at: "12:00:00"
condition:
  - condition: numeric_state
    entity_id: sensor.coop_interior_temperature
    above: 88
  - condition: time
    after: "12:00:00"
    before: "18:00:00"
action:
  - type: turn_on
    device_id: 9dad1a304cf10dbf3c3c8d123a51f788
    entity_id: ba3fe7ac5784dde033b5ce33764f32cc
    domain: switch
mode: restart
1 Like

I get the following error upon saving:
“Message malformed: required key not provided @ data[‘trigger’][1][‘platform’]”

Sorry, copy/paste error… I have fixed it above.

1 Like

May I ask what you had to change? They look similar. I am pretty new at this YAML stuff. :slight_smile:

For future reference “trigger” is an OR condition. One or the other will start (trigger) the automation. The “condition” is an AND condition. First condition AND second condition must be true for the automation to continue.

1 Like

As the error message says, one of the triggers (in this case the Time trigger) was missing a required platform: key because I didn’t change condition: to platform: as I should have.

2 Likes