Getting Hue light reachable state from CLIP API

Hello all.

One of my house-mates keeps accidentally turning the Hue lights off at the wall. So I want to monitor whether they’re reachable or not.

I’ve been looking at the REST platform to access the Hue’s CLIP API

So far, I have this working:

sensor:
  - platform: rest
    name: 'Random light name'
    resource: http://192.168.1.~~~/api/~~~/lights/1
    value_template: '{{ value_json.state.reachable }}'

I know the code below won’t work, but what it illustrates sort of what I’m aiming for:

sensor:
  - platform: rest
    name: '{{ value_json.state.name }}'
    resource: http://192.168.1.~~~/api/~~~/lights/*
    value_template: '{{ value_json.state.reachable }}'

This would allow me to grab the whole list of lights and their actual names without having to define them manually.

Any JSON wizards know if this is possible? Or to read in the larger JSON object into another sensor and then parse the attributes out of that?

Hi… I wondered how you got on? I’m new to HA, but want to monitor Hue lights for unreachable in a similar way, and when they become reachable again to turn them back to previous state, or at least 50% brightness if after midnight (for example) rather than the default full brightness after power restoration. I’m hoping somehow the bit of code you have here may help me! (Quite happy to poll all lights individually if needed)
Cheers,
Steve