#i have an automation which keeps not

1 messages · Page 1 of 1 (latest)

frail cliff
#

`alias: Pool Schedule
description: ""
trigger:

  • platform: state
    entity_id:
    • input_boolean.pool_run_schedule
  • platform: state
    entity_id:
    • sensor.octopus_electricity_current_rate
      to: null
  • platform: state
    entity_id:
    • schedule.pool_heater
      to: null
  • platform: state
    entity_id:
    • input_number.pool_heating_maximum_unit_cost
      to: null
      condition: []
      action:
  • if:
    • condition: state
      alias: Run schedule is turned on
      entity_id: input_boolean.pool_run_schedule
      state: "on"
    • condition: state
      alias: The schedule calls for heating
      entity_id: schedule.pool_heater
      state: "on"
    • condition: template
      alias: Current electricity rate is below max
      value_template: >-
      {{ (states("sensor.octopus_electricity_current_rate") | float <=
      states("input_number.pool_heating_maximum_unit_cost") | float / 100)
      }}
      then:
    • service: script.turn_on
      data: {}
      target:
      entity_id: script.pool_cycle
      else:
    • service: script.turn_off
      data: {}
      target:
      entity_id: script.pool_cycle
    • service: switch.turn_off
      data: {}
      target:
      entity_id:
      - switch.pool_filter
      - switch.pool_heat_pump
      mode: single
      `
merry radish
#

I suspect that just because script.turn_on starts a script asynchronously, it may still count as the automation running as it's the parent

frail cliff
#

oh i see

merry radish
#

You could run a simple test with an automation and a script that simply calls delay: xxxx

frail cliff
#

yes i could

merry radish
#

Use an event trigger

frail cliff
#

can you detect if a script is running?

merry radish
#

Fire the event multiple times

#

Yes, there's an attribute

#

current

frail cliff
#

ok. i can also experiment with a different mode (maybe restart) for the automation,and only start the script if it's not running. i would need to experiment to see if the script gets cut down on the restart

#

is there anything i can do in an action which outputs a message to the log

merry radish
#

Yeah, I don't know

#

Yes

lethal axleBOT
frail cliff
#

thanks. i am sure i will be able to figure this out now