I’m using the API to get the runtime summary but I don’t understand what the runtime_thermostat_summary_id is. It seems I have to determine that value first before I can drill down to get detailed info. Is that correct? I’m using TCL and I convert the JSON to a DICT and when I check the data key I get the entire remainder of the JSON when I just want the id so I can drill down to get just the data I want. Does this make sense?
You don’t actually need the runtime_thermostat_summary_id for anything. That’s just a unique ID for that specific row in my database. Beestat typically returns data in objects with the ID pointing at the data.
I believe in your cases you just want to use dict values to turn that object into an array you could iterate over. That should throw away those IDs.
I’m not too familiar with TCL, but one of the following might work.
Normally you would want to loop over the records; something like this:
set records [dict get $api data]
foreach therm_id [dict keys $records] {
set rec_data [dict get $records $therm_id]
set hpdate [dict get $rec_data date]
# do whatever you need with $hpdate here
}
If you just care about the first record, you could do this:
set records [dict get $api data]
set therm_id [lindex [dict keys $records] 0]
set hpdate [dict get $records $therm_id date]