[
{
"entity_id": "person.storm",
"state": "home",
"attributes": {
"editable": true,
"id": "0a71abd732aa4c37aaa4c77ec4a0e592",
"latitude": 10.65601134689769,
"longitude": 10.65601134689769,
"gps_accuracy": 65,
"source": "device_tracker.sfonx",
"user_id": "6077e1d60aaaa9103d88b9885ea3a",
"friendly_name": "STORM",
"entity_picture": "/api/image/serve/4750daaaa6c6587d6e751bc49bd/512x512"
},
"last_changed": "2020-11-15T00:28:41.896545+00:00",
"last_updated": "2020-11-16T12:31:30.635576+00:00",
"context": {
"id": "362a2fd22e4e415054af37b908c75fc4",
"parent_id": null,
"user_id": null
}
},
{
"entity_id": "sun.sun",
"state": "below_horizon",
"attributes": {
"next_dawn": "2020-11-17T06:28:15+00:00",
"next_dusk": "2020-11-17T15:36:21+00:00",
"next_midnight": "2020-11-16T23:02:25+00:00",
"next_noon": "2020-11-17T11:02:18+00:00",
"next_rising": "2020-11-17T07:16:58+00:00",
"next_setting": "2020-11-17T14:47:38+00:00",
"elevation": -20.86,
"azimuth": 267.49,
"rising": false,
"friendly_name": "SUN"
},
"last_changed": "2020-11-16T14:49:40.025488+00:00",
"last_updated": "2020-11-16T17:37:44.031768+00:00",
"context": {
"id": "6298c72b78183a753678e76825d6375e",
"parent_id": null,
"user_id": null
}
},
{
"entity_id": "entity_controller.motion_kitchen",
"state": "blocked",
"attributes": {
"sensor_type": "duration",
"mode": "night",
"delay": "600s",
"last_triggered_by": "binary_sensor.pr_kitchen",
"blocked_at": "2020-11-16T18:50:21.038561",
"blocked_by": "light.stove",
"friendly_name": "motion_kitchen",
"icon": "mdi:close-circle"
}
},
{
"entity_id": "light.bedroom_mini",
"state": "off",
"attributes": {
"is_deconz_group": false,
"friendly_name": "Mini sov",
"supported_features": 41
},
"last_changed": "2020-11-16T12:00:46.878946+00:00",
"last_updated": "2020-11-16T12:00:46.878946+00:00",
"context": {
"id": "a14e69bf8b96e4ae847d114c2c7c3384",
"parent_id": null,
"user_id": null
}
}
]
As you see, the structure of the data is completely deterministic, as expected.
json = [];
json[0] = {};
json[0].attributes = {};
json[0].attributes.editable = true;
json[0].attributes.entity_picture = "/api/image/serve/4750d81a3c4b566c6587d6e751bc49bd/512x512";
json[0].attributes.friendly_name = "STORM";
json[0].attributes.gps_accuracy = 65;
json[0].attributes.id = "0a71abd732aa4c37aaa4c77ec4a0e592";
json[0].attributes.latitude = 10.65601134689769;
json[0].attributes.longitude = 10.65601134689769;
json[0].attributes.source = "device_tracker.sfonx";
json[0].attributes.user_id = "6077e1d6074c4c8a9103d88b9885ea3a";
json[0].context = {};
json[0].context.id = "362a2fd22e4e415054af37b908c75fc4";
json[0].context.parent_id = null;
json[0].context.user_id = null;
json[0].entity_id = "person.storm";
json[0].last_changed = "2020-11-15T00:28:41.896545+00:00";
json[0].last_updated = "2020-11-16T12:31:30.635576+00:00";
json[0].state = "home";
json[1] = {};
json[1].attributes = {};
json[1].attributes.azimuth = 267.49;
json[1].attributes.elevation = -20.86;
json[1].attributes.friendly_name = "SUN";
json[1].attributes.next_dawn = "2020-11-17T06:28:15+00:00";
json[1].attributes.next_dusk = "2020-11-17T15:36:21+00:00";
json[1].attributes.next_midnight = "2020-11-16T23:02:25+00:00";
json[1].attributes.next_noon = "2020-11-17T11:02:18+00:00";
json[1].attributes.next_rising = "2020-11-17T07:16:58+00:00";
json[1].attributes.next_setting = "2020-11-17T14:47:38+00:00";
json[1].attributes.rising = false;
json[1].context = {};
json[1].context.id = "6298c72b78183a753678e76825d6375e";
json[1].context.parent_id = null;
json[1].context.user_id = null;
json[1].entity_id = "sun.sun";
json[1].last_changed = "2020-11-16T14:49:40.025488+00:00";
json[1].last_updated = "2020-11-16T17:37:44.031768+00:00";
json[1].state = "below_horizon";
json[2] = {};
json[2].attributes = {};
json[2].attributes.blocked_at = "2020-11-16T18:50:21.038561";
json[2].attributes.blocked_by = "light.stove";
json[2].attributes.delay = "600s";
json[2].attributes.friendly_name = "motion_kitchen";
json[2].attributes.icon = "mdi:close-circle";
json[2].attributes.last_triggered_by = "binary_sensor.pr_kitchen";
json[2].attributes.mode = "night";
json[2].attributes.sensor_type = "duration";
json[2].entity_id = "entity_controller.motion_kitchen";
json[2].state = "blocked";
json[3] = {};
json[3].attributes = {};
json[3].attributes.friendly_name = "Mini sov";
json[3].attributes.is_deconz_group = false;
json[3].attributes.supported_features = 41;
json[3].context = {};
json[3].context.id = "a14e69bf8b96e4ae847d114c2c7c3384";
json[3].context.parent_id = null;
json[3].context.user_id = null;
json[3].entity_id = "light.bedroom_mini";
json[3].last_changed = "2020-11-16T12:00:46.878946+00:00";
json[3].last_updated = "2020-11-16T12:00:46.878946+00:00";
json[3].state = "off";
person.storm = "home";
person.storm.attributes.editable = true;
person.storm.attributes.entity_picture = "/api/image/serve/4750d81a3c4b566c6587d6e751bc49bd/512x512";
person.storm.attributes.friendly_name = "STORM";
person.storm.attributes.gps_accuracy = 65;
person.storm.attributes.id = "0a71abd732aa4c37aaa4c77ec4a0e592";
person.storm.attributes.latitude = 10.65601134689769;
person.storm.attributes.longitude = 10.65601134689769;
person.storm.attributes.source = "device_tracker.sfonx";
person.storm.attributes.user_id = "6077e1d6074c4c8a9103d88b9885ea3a";
person.storm.context.id = "362a2fd22e4e415054af37b908c75fc4";
person.storm.context.parent_id = null;
person.storm.context.user_id = null;
person.storm.last_changed = "2020-11-15T00:28:41.896545+00:00";
person.storm.last_updated = "2020-11-16T12:31:30.635576+00:00";
sun.sun = "below_horizon";
sun.sun.attributes.azimuth = 267.49;
sun.sun.attributes.elevation = -20.86;
sun.sun.attributes.friendly_name = "SUN";
sun.sun.attributes.next_dawn = "2020-11-17T06:28:15+00:00";
sun.sun.attributes.next_dusk = "2020-11-17T15:36:21+00:00";
sun.sun.attributes.next_midnight = "2020-11-16T23:02:25+00:00";
sun.sun.attributes.next_noon = "2020-11-17T11:02:18+00:00";
sun.sun.attributes.next_rising = "2020-11-17T07:16:58+00:00";
sun.sun.attributes.next_setting = "2020-11-17T14:47:38+00:00";
sun.sun.attributes.rising = false;
sun.sun.context.id = "6298c72b78183a753678e76825d6375e";
sun.sun.context.parent_id = null;
sun.sun.context.user_id = null;
sun.sun.last_changed = "2020-11-16T14:49:40.025488+00:00";
sun.sun.last_updated = "2020-11-16T17:37:44.031768+00:00";
sun.sun.state = "below_horizon";
entity_controller.motion_kitchen = "blocked";
entity_controller.motion_kitchen.attributes.blocked_at = "2020-11-16T18:50:21.038561";
entity_controller.motion_kitchen.attributes.blocked_by = "light.stove";
entity_controller.motion_kitchen.attributes.delay = "600s";
entity_controller.motion_kitchen.attributes.friendly_name = "motion_kitchen";
entity_controller.motion_kitchen.attributes.icon = "mdi:close-circle";
entity_controller.motion_kitchen.attributes.last_triggered_by = "binary_sensor.pr_kitchen";
entity_controller.motion_kitchen.attributes.mode = "night";
entity_controller.motion_kitchen.attributes.sensor_type = "duration";
entity_controller.motion_kitchen.state = "blocked";
light.bedroom_mini = "off";
light.bedroom_mini.attributes.friendly_name = "Mini sov";
light.bedroom_mini.attributes.is_deconz_group = false;
light.bedroom_mini.attributes.supported_features = 41;
light.bedroom_mini.context.id = "a14e69bf8b96e4ae847d114c2c7c3384";
light.bedroom_mini.context.parent_id = null;
light.bedroom_mini.context.user_id = null;
light.bedroom_mini.entity_id = "light.bedroom_mini";
light.bedroom_mini.last_changed = "2020-11-16T12:00:46.878946+00:00";
light.bedroom_mini.last_updated = "2020-11-16T12:00:46.878946+00:00";
json[0] = {};
(...)
json[0].state = "home";
json[0].entity_id = "person.storm";
json[0].last_changed = "2020-11-15T00:28:41.896545+00:00";
person.storm = "home"
(...)
# perhaps keep this: person.storm.state = "home";
person.storm.last_changed = "2020-11-15T00:28:41.896545+00:00";
The tool somehow needs to know it is getting a (nested) array, and where to get the name of the index.