- Code: Select all
{
"result": "success",
"server_time": "2020-03-14T01:17:53Z",
"channels": [{
"channel_id": "12503",
"field1": "Temperature",
"field2": "Humidity",
"field3": "Light",
"field4": "Voltage",
"field5": "WIFI RSSI",
"field6": "Vibration Index",
"field7": "Knocks",
"field8": "External Temperature Probe",
"field9": "",
"field10": null,
"latitude": "36.0097",
"longitude": "-115.1479",
"name": "Garage",
"public_flag": "false",
"tags": null,
"url": null,
"metadata": "{\"fn_th\":300,\"fn_light\":300,\"fn_mag\":0,\"fn_mag_int\":0,\"fn_acc_tap1\":0,\"fn_acc_tap2\":0,\"fn_acc_act\":0,\"fn_acc_min\":10,\"fn_bt\":0,\"fn_ext_t\":0,\"fn_battery\":7200,\"fn_dp\":900,\"cg_data_led\":1,\"wifi_mode\":1,\"no_net_fn\":1}",
"description": null,
"traffic_out": "273787",
"traffic_in": "117292",
"status": "{\"ssid\":\"cfwap\",\"status\":\"mac=6c:c3:74:eb:7d:77,usb=0\",\"usb\":\"0\",\"mac\":\"6c:c3:74:eb:7d:77\"}",
"timezone": null,
"created_at": "2020-03-12T02:09:23Z",
"updated_at": "2020-03-12T18:28:16Z",
"usage": "363330",
"last_entry_id": "1908",
"last_entry_date": "2020-03-14T01:11:29Z",
"product_id": "ubibot-ws1",
"device_id": "cf43a1776ff0218985d7a91a40965b1700819c56",
"channel_icon": null,
"last_ip": "70.180.187.74",
"attached_at": "2020-03-12T02:09:23Z",
"firmware": "ws1_v2.6.8",
"full_dump": "0",
"activated_at": "1583979074",
"serial": "VBM***WS1",
"mac_address": "6c:c3:74:eb:7d:77",
"full_dump_limit": "3",
"cali": null,
"size_out": "1073741824",
"size_storage": "209715200",
"plan_code": "ubibot_free",
"plan_start": "2020-03-12T02:09:23Z",
"plan_end": null,
"bill_start": "2020-03-12T02:09:23Z",
"bill_end": "2020-04-11T02:09:23Z",
"last_values": "{\"field1\":{\"value\":24.754333,\"created_at\":\"2020-03-14T01:11:15Z\",\"net\":\"1\"},\"field3\":{\"value\":22.43,\"created_at\":\"2020-03-14T01:11:15Z\"},\"field4\":{\"value\":3.132439,\"created_at\":\"2020-03-14T00:11:14Z\"},\"field2\":{\"value\":30,\"created_at\":\"2020-03-14T01:11:15Z\",\"net\":\"1\"},\"field5\":{\"value\":-33,\"created_at\":\"2020-03-14T01:11:17Z\"}}",
"vconfig": "{\"field1\":{\"h\":\"0\",\"u\":\"1\"},\"field2\":{\"h\":\"0\",\"u\":\"3\"},\"field3\":{\"h\":\"0\",\"u\":\"4\"},\"field4\":{\"h\":\"0\",\"u\":\"5\"},\"field5\":{\"h\":\"0\",\"u\":\"6\"},\"field6\":{\"h\":\"0\",\"u\":\"7\"},\"field7\":{\"h\":\"0\",\"u\":\"8\"},\"field8\":{\"h\":\"0\",\"u\":\"1\"},\"field9\":{\"h\":\"0\",\"u\":\"9\"}}",
"vpref": null,
"battery": null,
"vpref_from": "owner",
"net": "1",
"c_icon_base": null,
"full_serial": "VBM39XWS1",
"triggering_rules": null
}]
}
If I access it as follows:
- Code: Select all
myvar = str(result['channels'][0]['field1'])
I get "Temperature" as the myvar as expected.
But how do I access the values within the "last_values" portion?
What I want is the value (in this case 24.754333) within that string (it's the temperature recorded by the device).
Thank you for any assistance you can provide.