Automation to control outlet based on time, and wind

I’m trying to create and automation to control my fountain outlet. i want the outlet to come on at set times, then go on or off during those times based on wind speed. thank you! Ive had this working once before, but due to a storm i lost the data, now i am about to literally pull my last hair out lol.

alias: New automation?
description: ""
triggers:
  - trigger: time
    at: "08:00:00"
    id: timeon
  - trigger: time
    at: "20:30:00"
    id: timeoff
  - trigger: numeric_state
    entity_id:
      - sensor.pirateweather_wind_gust
      - sensor.pirateweather_wind_speed
    above: 5
    id: windoff
  - trigger: numeric_state
    entity_id:
      - sensor.pirateweather_wind_gust
      - sensor.pirateweather_wind_speed
    below: 4
    id: windon
conditions:
  - condition: time
    after: "07:59:50"
    before: "20:30:00"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - timeon
              - windon
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              device_id: 201c051cb0856eabdbe8f0625405cdf5
      - conditions:
          - condition: trigger
            id:
              - timeoff
              - windoff
        sequence:
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              device_id: 201c051cb0856eabdbe8f0625405cdf5
mode: single

ill be forever in debt to whomever helps for my sanity! :sweat_smile:

What isn’t happening that you expect to happen?
What is happening that you don’t expect?

The one issue I can see is your Time condition won’t allow the timeoff trigger to work as expected. One way to address it would be to use an Or:

conditions:
  - or:
      - condition: trigger
        id: timeoff
      - condition: time
        after: "07:59:50"
        before: "20:30:00"

The second possible issue is that the wind speed is not being taken into account for the timeon trigger. This may be by design, you will have to let us know. One option to solve this is the same as above:

actions:
  - choose:
      - conditions:
          - or:
              - condition: trigger
                id: windon
              - and:
                  - condition: trigger
                    id: timeon
                  - alias: Both speed and gust below 4
                    condition: numeric_state
                    entity_id:
                      - sensor.pirateweather_wind_speed
                      - sensor.pirateweather_wind_gust
                    below: 4
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              device_id: 201c051cb0856eabdbe8f0625405cdf5
....
1 Like

Thank you for the reply, and sorry for not being more detailed. Yes, both things listed will be changed, but overlooked ATM trying to make the automation run.

The issue is I can’t get it to trigger on with the wind speed variables added, no matter if I change windspeed on value to below 100. On the trace it says false parameters not met. (Can’t remember exact wording but similar).

My second question is, will this throughout the day turn the fountain off if the windspeed is over 5, then back on if under 4, or will it only trigger when it’s 8 am, and 8:30 pm?