Heyhey,
not sure if this is possible at all, but worth a try. So the situation is this: I’m using a REST sensor to query a public endpoint that amongst other fields provides this as part of the resultset:
"ersteZiehung": {
"ziehungsarten": [
0
],
"ziehungsdatum": "2022-12-25T00:00:00"
},
"letzteZiehung": {
"ziehungsarten": [
1
],
"ziehungsdatum": "2024-01-07T00:00:00"
},
"naechsteZiehung": {
"ziehungsarten": [
1
],
"ziehungsdatum": "2023-10-29T00:00:00+02:00"
},
With the following combination I’m able to pull the actual date from the “naechsteZiehung” section as an attribute for the sensor:
json_attributes_path: "$.displayData.naechsteZiehung"
json_attributes:
- ziehungsdatum
My problem: “ziehungsdatum” is too generic of a naming. It makes sense in the original context of the resultset, but in my sensor I’m losing the context.
Is there a way to manually override the attribute name that is given to the actual sensor attribute? From reading the documentation I only got that it gets derived directly from the JSON without “interception” option.
I know I could technically create a SECOND (template) sensor that uses the values from the original REST sensor, or I could create multiple sensors from the one REST call and store the attributes individually as dedicated sensor values, but both is overhead and “hacky” for my purposes.
Greatful for any hints, thanks in advance