Can someone help me extract from this JSON?
I can get JSON but cannot set to json_attributes
I cannot get all JSON value to sensor value by 255 character limits.
API has limit about max 30 requests / 5 min.
I want to save the number of API requests.
then I want to make a single sensor and it has six attributes.
sensor's value: "Remo E lite" (anything)
attribute[0]:
{
"name": "coefficient",
"epc": 211,
"val": "1",
"updated_at": "2020-08-21T13:23:44Z"
}
attribute[1]:
{
"name": "cumulative_electric_energy_effective_digits",
"epc": 215,
"val": "6",
"updated_at": "2020-08-21T13:23:44Z"
}
attribute[3....
JSON sample
[
{
"id": "632603e4-e0f8-4073-9034-77f8b19e9128",
"device": {
"name": "Remo E lite",
"id": "79b6fea9-65f6-42f3-aa38-ddcd041aa1b6",
"created_at": "2020-04-27T09:22:43Z",
"updated_at": "2020-08-15T11:13:23Z",
"mac_address": "f4:cf:a2:81:03:94",
"bt_mac_address": "f4:cf:a2:81:03:96",
"serial_number": "4W120040000338",
"firmware_version": "Remo-E-lite/1.1.5",
"temperature_offset": 0,
"humidity_offset": 0
},
"model": {
"id": "7f3de26b-0afa-44fe-8680-7cf67f8bd415",
"manufacturer": "",
"name": "Smart Meter",
"image": "ico_smartmeter"
},
"type": "EL_SMART_METER",
"image": "ico_smartmeter",
"settings": null,
"aircon": null,
"signals": [],
"smart_meter": {
"echonetlite_properties": [
{
"name": "coefficient",
"epc": 211,
"val": "1",
"updated_at": "2020-08-21T13:23:44Z"
},
{
"name": "cumulative_electric_energy_effective_digits",
"epc": 215,
"val": "6",
"updated_at": "2020-08-21T13:23:44Z"
},
{
"name": "normal_direction_cumulative_electric_energy",
"epc": 224,
"val": "137351",
"updated_at": "2020-08-21T13:23:44Z"
},
{
"name": "cumulative_electric_energy_unit",
"epc": 225,
"val": "1",
"updated_at": "2020-08-21T13:23:44Z"
},
{
"name": "reverse_direction_cumulative_electric_energy",
"epc": 227,
"val": "27",
"updated_at": "2020-08-21T13:23:44Z"
},
{
"name": "measured_instantaneous",
"epc": 231,
"val": "778",
"updated_at": "2020-08-21T13:23:44Z"
}
]
}
}
]
I tried this
- platform: rest
resource: https://api.nature.global/1/appliances/
name: meter_coefficient
value_template: '{{value_json[0].device.name}}'
json_attributes_path: "$..echonetlite_properties"
json_attributes:
- "$.[2]"
headers:
Authorization: !secret nature_key
scan_interval: 60
force_update: true
json_attributes_path: "$..echonetlite_properties.*"
json_attributes:
- [0]