I have an OpenSprinkler controller. I have set up multiple programs for different times of the year. Before we get into what I’m trying to do, I do want to acknowledge that I realize the OpenSprinkler firmware does provide scheduling mechanisms. However, I do not feel these are sophisticated enough for what I want to do.
I am trying to decide which trigger
would be best to use to switch between programs. Right now, I use sensor.season
but I’m worried this isn’t granular or accurate enough. My automation is below.
- alias: "Irrigation: Switch to Seasonal Program"
id: 52bd58dc-1d85-472a-8ec4-eead62432a40
trigger:
- platform: time
at: "00:00"
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.season
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.season
state: [spring, autumn]
sequence:
- service: homeassistant.turn_off
entity_id:
- switch.summer_program_enabled
- service: homeassistant.turn_on
entity_id:
- switch.fall_spring_program_enabled
- switch.flower_beds_program_enabled
- conditions:
- condition: state
entity_id: sensor.season
state: [summer]
sequence:
- service: homeassistant.turn_off
entity_id:
- switch.fall_spring_program_enabled
- service: homeassistant.turn_on
entity_id:
- switch.summer_program_enabled
- switch.flower_beds_program_enabled
default:
- service: homeassistant.turn_off
entity_id:
- switch.fall_spring_program_enabled
- switch.summer_program_enabled
- switch.flower_beds_program_enabled
There’s a lot of redundancy here as well. It’s difficult to duplicate all the program names multiple times in each squence section. It would be nice if I could build a mapping in the automation (a map of program name to seasons or months in which it should be active) and use a template expression to loop over those and call the appropriate service on them. I’m not sure how to do that, though.
I’d also like to be able to map these programs to MM/DD
dates. For some programs, I would assign multiple date ranges (such as time frames in both fall and spring). Weather in Texas always seems to be a bit misaligned with your typical seasons (simply based on temperature) so this is why I’m hoping for some more granularity.
Can someone offer guidance on reducing the redundancy here as well as how I can set this up to work with date ranges?