There isn’t a parent name and all the examples I’ve seen online are using the parent name to return data. Also the data is too large to fit into a sensor state so I’ve been trying to use an attribute to get around that problem.
I have been testing different combinations of the json_attributes_path and json_attributes from the REST sensor but cannot get anything to populate into the sensor.
Does anyone have any ideas on how I can achieve this?
The problem I seem to have is that the json path is numbered 0, 1, 2 etc so there is no way to specify an attribute without hard setting it to a number.
-r returns the resulting jq output as a raw string omitting the double quotes which would otherwise encapsulate it
.[] returns entire output of curl
select(.ip_address == "{{ state_attr('sensor.vpn_state', 'server_ip') }}") returns object literals where the “ip_address” key equals the value of my predefined attribute
.name returns the value associated to the “name” key
This results in a sensor containing a state for just the value I need. It also gets around the need to try and store a large amount of data into a state where the 255 character limit would otherwise be hit.