Short preamble:
I have chickens, there is a load cell (measures weight) in their roost, I want to have a binary sensor that tells me if they are on the roost or not.
I can query influxDB and see the average weight over the last 10 minutes, I use this to decide if they are on the roost or not using jq and if statements.
When I run this manually, I get nice clean on or off results, however, the sensor is always in the off state.
I have tried various combinations of specifying (or not) the payload_on and payload_off parameters, I have tried using all variations of onONtrueTRUETrue etc. but not had the sensor change to the on state.
I think my issues before were that the json has a section called values and that is a reserved name - using ["values"] works - and probably will for all the other sensors I couldn’t get to work!
The template editor in developer tools was what helped me work this out when it said built-in method values of dict object
Thanks for the pointers and suggesting I have another look at using RESTful.