You can use this template in your automation to get a list of the entity_ids of all scenes whose object_id
begins with HueRoomA_SceneName
.
{{ states.scene
| selectattr('object_id', 'match', 'HueRoomA_SceneName')
| map(attribute='entity_id') | list }}
Modify the HueRoomA_SceneName
string to meet your specific needs. Let me know if you need additional assistance to customize the template. For example the next step would be to determine which scene’s state contains the latest datetime value.
{{ expand(states.scene
| selectattr('object_id', 'match', 'HueRoomA_SceneName')
| map(attribute='entity_id'))
| rejectattr('state', 'in', ['unknown', 'unavailable'])
| sort(attribute='state')
| map(attribute='entity_id')
| list | last }}