Hello,
I’m stuck with creating a REST sensor that intercepts the response to a GET rest call. I can’t find how to import all the parameters of the response inside the sensor attributes. Below I report both the answer and my attempt to do the above but without success (or rather with partial success: I can only insert an entry with all parameters).
My final goal is then to represent data in a table card.
[
{
"id": "1",
"product_id": "2",
"amount": "5",
"best_before_date": "2022-12-07",
"purchased_date": "2022-10-28",
"stock_id": "635ba5e19568f",
"price": null,
"open": "0",
"opened_date": null,
"row_created_timestamp": "2022-10-28 11:50:25",
"location_id": "2",
"shopping_location_id": null,
"note": ""
},
{
"id": "2",
"product_id": "1",
"amount": "10",
"best_before_date": "2023-03-16",
"purchased_date": "2022-10-28",
"stock_id": "635ba611df488",
"price": "0",
"open": "0",
"opened_date": null,
"row_created_timestamp": "2022-10-28 11:51:13",
"location_id": "2",
"shopping_location_id": null,
"note": ""
}
]
- platform: rest
resource: https://myhadomain.duckdns.org:9192/api/stock/locations/2/entries
method: GET
name: "Fridge"
scan_interval: 60
headers:
GROCY-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
value_template: 'Ok'
json_attributes_path: "$..*"
json_attributes:
- id
- product_id
- amount
- best_before_date
- purchased_date
- stock_id
- price
- open
- opened_date
- row_created_timestamp
- location_id
- shopping_location_id
- note
Thank you very much for every advice you can provide