This seems really simple and I feel quite dumb asking…but yet here I am
I have 13 irrigation zones that each have their own binary sensor in HA. I would like to have a single binary sensor that tells me when any zone is on. Would it have to be a brutish 13 case if else template or is there a better way? Also while I’m here, is there a better way to define my irrigation zones? It’s a similar situation where I’m manually doing each one where I’d rather have some sort of for loop to do it. Currently looks like this: (grabs state data from irrigation software JSON)
binary_sensor:
# Irrigation zones
- platform: rest
name: irrigation_zone1
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][0]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone2
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][1]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone3
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][2]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone4
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][3]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone5
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][4]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone6
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][5]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone7
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][6]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone8
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][7]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone9
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][8]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone10
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][9]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone11
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][10]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone12
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][11]["state"] }}'
scan_interval: 10
- platform: rest
name: irrigation_zone13
resource_template: http://localhost:88/json/zones
value_template: '{{ value_json["zones"][12]["state"] }}'
scan_interval: 10