Is it possible to have json_attributes from different levels like the sample code below (not working yet)?
sensor:
- platform: rest
name: JSON attributes
json_attributes:
- nickname
- address.street
- address.city
resource: https://jsonplaceholder.typicode.com/users
value_template: "{{ value_json.name }}"
Thanks. So the workaround that I can think of is to create additional REST sensor for the ‘address’ JSON level. Then create a template sensor combining those attributes. This way we have to query twice the same JSON file. Any better workaround?
123
(Taras)
August 25, 2021, 1:52am
4
Pplayer:
Any better workaround?
Consider using the RESTful integration. I provided an example here (second example in the post):
The indentation for the Template sensor is incorrect. It should be like this:
- platform: rest
name: meteobridge_rest
resource: http://user:[email protected] /cgi-bin/template.cgi?template={"th1":{"temp":"[th1!1temp-act:0]","hum":"[th1!1hum-act:0]"},"th2":{"temp":"[th1!2temp-act:0]","hum":"[th1!2hum-act:0]"},"th3":{"temp":"[th1!3temp-act:0]","hum":"[th1!3hum-act:0]"},"th4":{"temp":"[th1!4temp-act:0]","hum":"[th1!4hum-act:0]"},"th5":{"temp":"[th1!5temp-act:0]","hum":"[th1!5hum-act:0]"},"th6":{"…
1 Like
Thank you. It’s very useful.