Combine multiple REST binary sensors using template?

Ok,im after trying to minimise the number of requests I’m sending to my Hue hub by combining a number of REST sensors using a template. My logic is if I request the JSON once and then template out for each of my sensors this would be better than querying the JSON multiple times, once for each sensor?

My binary sensors currently look like this…

- platform: rest
  resource: http://10.0.30.59/api/key/sensors/15
  value_template: '{{ value_json.state.presence }}'
  scan_interval: 1
  name: 'Kitchen Motion'

- platform: rest
  resource: http://10.0.30.59/api/key/sensors/21
  value_template: '{{ value_json.state.presence }}'
  scan_interval: 1
  name: 'Lounge Motion'

- platform: rest
  ........... (etc)

As you can see, the only thing that changes is the sensor ID (end of the API string).

Anyone help me out here?

Thanks

1 Like