Want a pump to turn on for 15 mins every hour, but can't work out how - newby question

Hi
I currently use “webthings gateway” to control my Tasmota devices. I want to move everything over to HA ( with Mosquito MQTT & the Tasmota add on)
One of those Tasmota devices turns on a pump in my hydroponics for 15 minutes on the hour every hour - So when minutes =00 then on & when minutes =15 off
I have dug around in the automation and for the life of me I cannot see anyway of doing it ( I can create 24 different rules to turn it on each hou and another 24 to turn it of at XX:15, but surely there is something I can do that is not so clumsy?
Any help greatly appreciated… If I need to add a script manually, remember that I have only just fired up HA and worked out ho to get the Tasmota devices to talk to it , so I will probably need nursing through :slight_smile:

You could use time_pattern and then use a delay.

Something like (not complete and not tested):

alias: Test
description: ""
trigger:
  - platform: time_pattern
    minutes: 0
condition: []
action:
  - service: input_boolean.turn_on
    data: {}
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - service: input_boolean.turn_off
    data: {}
mode: single

Hmmm that looks like it… now to work out how this “template” thing works :slight_smile:
Thanks

Or simply, when 45mins off, turn on for 15mins, then turn off ?

description: "after off 45 mins, turn on for 15min"
mode: single
trigger: []
condition:
  - condition: device
    type: is_off
    device_id: 4b95cd43e600497cad970f5a92700d30
    entity_id: light.car_port1
    domain: light
    for:
      hours: 0
      minutes: 45
      seconds: 0
action:
  - type: turn_on
    device_id: 4b95cd43e600497cad970f5a92700d30
    entity_id: light.car_port1
    domain: light
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 4b95cd43e600497cad970f5a92700d30
    entity_id: light.car_port1
    domain: light

Alltho, this might not keep it exactly every hour start …

A schedule helper to turn it on every hour? The slots seem to be 30 minutes long, so you would need another timer helper to turn it off after 15 min.

You can do it via the UI

LMGTFY…

How can i toggle a switch to turn on and off every 15 minutes between two times? - #4 by tom_l)

Not sure I can see how @Mats789 , but I am still learning the granularity is not there , it seems to only show "if it is this hour, then X , but I would need 48 separate automations, like I said in my original post, but would love to be proved wrong :slight_smile: .

Thanks @Digeridrew but that isn’t what I am trying to do here …

Not sure really what you struggling with :slight_smile:

1 Like

thanks… I have seen what I was missing… It confused me, but i am getting there… I am working on turning my “Webthings Gateway” off so I can free up the Raspberry Pi. Home Assistant and MQTT is making my head spin :slight_smile:

The example provided by Drew does exactly this:

Just remove the condition.

- id: tasmota_on
  alias: Tasmota On (on the hour)
  trigger:
    - platform: time_pattern
      hours: "*"
      minutes: 0
      seconds: 0
  action: 
    - service: switch.turn_on
      target:
        entity_id: switch.tasmota
- id: tasmota_off
  alias: Tasmota Off (after 15 minutes)
  trigger:
    - platform: state
      entity_id: switch.tasmota
      to: 'on'
      for:
        minutes: 15
  action: 
    - service: switch.turn_off
      target:
        entity_id: switch.tasmota