Despite my best efforts with the documentation, I must confess to being stuck. Any help would be appreciated.
I’m trying to set up some REST sensors to poll my local bike share, and although I have it working, it seems a little kludgy and inelegant.
Basically, the way the JSON feed stores individual stations is in an array, and I only really want data from items in the array that match certain criteria.
Right now I have this in my rest.yaml:
- scan_interval: 60
resource: https://gbfs.citibikenyc.com/gbfs/en/station_status.json
sensor:
- name: "CitiBikeTest3"
state_class: measurement
json_attributes_path: "$.data.stations[?(@.station_id == '72')]"
value_template: '{{value_json.num_bikes_available}}'
json_attributes:
- "num_bikes_available"
Now, if I have to make multiple calls, so be it, but I was wondering if there is a way to have this part:
[?(@.station_id == '72')]
with different values to search for appear as different attributes for the same sensor.
I’ve tried a variety of combinations, and am having a lot of difficulty.