Automating Between Times

Since installing HA I’ve been busy installing components. Not done much with automation apart from moved the few i had already into HA.

The below works perfectly providing one of us is home at 17:30:00 if not it fails to trigger and has to be manually switched. Is there an alternative trigger or condition?

The ideal would be to switch on the Fish tank when someones home between 7am and 10pm all days of the week.

# Fish Tank    
  - alias: Fish Tank Timer On Weekday
trigger:
  platform: time
  after: "17:30:00"
condition:
- condition: time
  weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
- condition: state
  entity_id: group.all_devices
  state: home
action:
  service: light.turn_on
  entity_id: light.fish_tank
1 Like

Try something like:

- alias: "Fish Tank Timer On Weekday"
  trigger:
    - platform: state
      entity_id: group.tracker
      to: 'home'
  condition:
    - condition: time
      after: '07:00:00'
      before: '22:00:00'
     - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
action:
  service: light.turn_on
  entity_id: light.fish_tank
1 Like

Ill give that a go thanks @Danielhiversen

Hello!

I am facing a very similar issue, which i haven’t solved properly yet: https://github.com/cyberkov/home-assistant-config/blob/master/automation/heizung_aussertuerlich.yaml

Basically I am switching my thermostats to 21C/manual if someone is at home between 9 and 16h but it does not fire if someone is already home (which was the use case I wanted to target initially). Also there is no “exit task” that would return the thermostat to automode at 17h as 21C would be normal behavior then.
I don’t feel that timed actions like https://github.com/cyberkov/home-assistant-config/blob/master/automation/heizung_daily_reset.yaml are actually a good resolution to the problem :frowning:

Do you have an idea for improvement?

Thanks in advance!

Does this repeat?