I tired to use json_attributes, but still geo unavailable
The json website is here:
https://pm25.lass-net.org/data/last.php?device_id=74DA38F20824
{"source": "last by IIS-NRL", "feeds": [{"AirBox": {"gps_num": 9.0, "s_d0_hourly": 4.222222222222222, "app": "AirBox", "gps_alt": 2.0, "s_d2": 3.0, "c_d0_method": "BRR/30/6.84", "s_d0": 5.0, "s_d1": 5.0, "s_h0": 91.0, "addr": "[262]\u5b9c\u862d\u7e23\u7901\u6eaa\u9109\u8305\u57d4\u8def24\u865f", "area": "yilan", "SiteName": "\u5b9c\u862d\u7e23\u7e23\u7acb\u7389\u7530\u570b\u5c0f", "gps_fix": 1.0, "c_d0_source": "AS-IISNRL", "gps_lat": 24.795, "s_t0": 24.12, "timestamp": "2020-05-12T06:43:57Z", "gps_lon": 121.79, "SiteAddr": "[262]\u5b9c\u862d\u7e23\u7901\u6eaa\u9109\u8305\u57d4\u8def24\u865f", "date": "2020-05-12", "device_id": "74DA38F20824", "name": "\u7389\u7530\u570b\u5c0f", "c_d0": 2.63, "s_d0_hourly_num": 9, "time": "06:43:57"}}], "version": "2020-05-12T06:52:59Z", "num_of_records": 1, "device_id": "74DA38F20824"}
here is my configuration.yaml:
sensor:
- platform: rest
resource: https://pm25.lass-net.org/data/last.php?device_id=74DA38F20824
name: yilan
json_attributes:
- "feeds"
value_template: '{{ value_json["device_id"] }}'
- platform: template
sensors:
pm25_yilan:
value_template: '{{ state_attr("sensor.yilan", "feeds")[0]["Airbox"]["s_d0"] }}'
entity_id: sensor.yilan
I also tried to use
value_template: '{{ state_attr("sensor.yilan", "feeds")[0]["Airbox"]["s_d0"] }}'
or
value_template: '{{ state_attr("sensor.yilan", "feeds")[0]["Airbox"].s_d0 }}'
but none of these works. I still can’t get correct value of s_d0
Can someone help me to solve this?