I would like to be able to select dynamically what part of the json result is included as attributes. Currently json_attributes_path has to be hard coded. For example in this YAML snippet which returns air quality values from a specific station id STA-IS0037A:
sensor:
platform: rest
name: air_quality
resource: https://api.ust.is/aq/a/getLatest
json_attributes_path: "$.STA-IS0037A.parameters"
json_attributes:
- H2S
- "NO"
- NO2
- PM1
- PM10
- PM2.5
- SO2
value_template: "{{value_json['STA-IS0037A'].name}}"
scan_interval: 3600
What I would really like to do would be to use an input_text or input_select to select dynamically the station id and what part of the json to include like this:
json_attributes_path: “$.{{ states(‘input_select.air_station_id’) }}.parameters”