#Here s an example
1 messages · Page 1 of 1 (latest)
Give me a couple minutes
Which workaround?
Maybe we just have a language disconnect. You want all the attributes from a single list item? Or one of the attributes from all the list items? Or >1 attribute from all the list items?
Assuming option 1:
rest:
- resource: https://dpaste.org/P9gE9/raw
scan_interval: 60
sensor:
- name: "Stuff for dan1002"
unique_id: dan1002
value_template: "{{ value_json[0].Name }}"
json_attributes_path: "$[*]"
json_attributes:
- Id
- Name
- Type
- EndpointId
- SwarmId
- EntryPoint
- Env
Creates sensor.stuff_for_dan1002 with value=frigate
and attributes=
friendly_name: Stuff for dan1002
Id: 1
Name: frigate
Type: 2
EndpointId: 2
SwarmId:
EntryPoint: docker-compose.yml
Env:
- name: IMAGE_NAME
value: 0.13.0-beta2
Yeah, looks like it's showing first item
second item, second sensor
- name: "dan1002 second item"
unique_id: dan1002_2
value_template: "{{ value_json[1].Name }}"
json_attributes_path: "$[1]"
json_attributes:
- Id
- Name
Id: 2
Name: ha
friendly_name: dan1002 second item
Yeah that's why I ended up doing this hack Petro proposed.
https://community.home-assistant.io/t/how-to-extract-data-from-json-again/449271/22
This gets me this
data:
- name: frigate
id: 1
- name: homeassistant
id: 2
- name: duplicati
id: 4
Good idea. Using curl+jq instead of rest