Hi,
am trying to set up some Restful sensors.
Using a rest client with the URL “http://intra.home:8010/ajax/fetch_collection.php”
and the following form-data
No authentication is required.
I get this data:
{
"state": "success",
"message": "successfully fetched collection",
"timings": {
"login": 0.64199495315551758,
"load": 0.751802921295166,
"login_perc": 85.393940431815111,
"load_perc": 14.605932716708306
},
"count": 16,
"data": [
{
"mac": "ce:63:2c:3d:13:88",
"name": "Device1",
},
{
"mac": "09:aa:3b:47:a8:2d",
"name": "Device2",
},
{
"mac": "40:c7:23:9a:59:16",
"name": "Device3",
}
...
]
}
I set up following rest-sonsor:
- platform: rest
name: "Unifi Client"
resource: http://intra.home:8010/ajax/fetch_collection.php
method: POST
headers:
accept: multipart/form-data
params:
selected_collection_method: list_clients
selected_site_id: default
selected_output_method: json
value_template: "{{ value_json['data[0]']['mac'] }}"
json_attributes_path: "$.data[0]"
Since I get no data back, I enabled logging for rest and see the following in the log:
[homeassistant.components.rest.sensor] Data fetched from resource: {"state":"success","message":"successfully fetched collection","timings":{"login":0,"load":0,"login_perc":0,"load_perc":0},"count":0,"data":[]}
Can somebody explain me how to set up the rest sensor correctly?
Thanks!