I am trying to use jq to find the ID of a hue scene when I pass the scene name. The problem is if I update the scene it makes another scene with a new ID assigned to it. So as I make changes to the scene more than one result returns. How Do I find the newest scene? I see there is an object that is lastupdated.
Here is what I have so far:
curl -s ${BASEURL}/scenes/ | /usr/local/bin/jq -r -e --arg SCENENAME "${SCENENAME}" '. as $object | keys[] | select($object[.].name == $SCENENAME)'
Here is what the json output looks like:
"FUX9A2m4LcuF6YG": {
"name": "KitchenDay",
"lights": [
"6",
"7",
"10",
"11"
],
"owner": "43594f081bb6d23e9ccd254927fa47",
"recycle": true,
"locked": false,
"appdata": {},
"picture": "",
"lastupdated": "2018-02-25T03:35:57",
"version": 2 }