Restful API for Thermometer with multiple probes

I am trying to get readings from a Restful GET that has been successful in returning data but I’m not able to figure out how to separate them into 6 sensors. This is a Fireboard thermometer with 6 probes. I’d like to label them all separately so I’m certain I need to build a sensor for each probe but I don’t know how to break them out.

My sensor:

sensor:
  - platform: rest
    resource: "https://fireboard.io/api/v1/devices/UUID/temps.json" 
    headers:
      Authorization: "Token yadayadayada"
    value_template: '{{ value_json.temp.channel }}'
    name: Fireboard Temp
    json_attributes:
     - temp
     - channel

JSON response:
[{"channel":1,"created":"2020-02-11T05:06:14Z","temp":72.6,"degreetype":2},{"channel":2,"created":"2020-02-11T05:06:14Z","temp":72.7,"degreetype":2}]

I think it lies in the value_template but I can’t figure out how to build it for each channel. With that config I do get data back for the first channel.
temp: 72.7
channel: 1
friendly_name: Fireboard Temp

and If I need to go Command Line I’m assuming:

curl ... | jq '.[] | select(.component == "PM10") | .value'

Then my question becomes where to install jq (docker? which?), and if it’s in a container I’ll have to re-install every update?

[{
	"channel": 1,
	"created": "2020-02-11T05:06:14Z",
	"temp": 72.6,
	"degreetype": 2
}, 
{
	"channel": 2,
	"created": "2020-02-11T05:06:14Z",
	"temp": 72.7,
	"degreetype": 2
}]

The reply is an array. If we assume the array is always in order by channel, to get channel 1, you would do:

value_template: '{{ value_json[0].temp}}'

Likewise, channel 2 would be:

value_template: '{{ value_json[1].temp }}'

As for your json_attributes, the restfulSensor section requires a list of attributes. But this reply is only giving an array with no top level attributes…

The solution for this was to basically not use the restfulSensor integration sadly because of this limitation…

1 Like

I started looking and it if I went up a level in the API commands the array contains a dictionary. I used your example for value_templates and it worked. I have a Bond fan controller that I think is similar so hopefully I can apply your input there as well.

Appreciate it much Jim.

1 Like

Could you show how you used the array function? I was able to use the API to pull the data from my device using ubuntu, but when I tried to add a sensor, I was getting an error I think due to the array. I used this link as a guide, but I haven’t programmed anything really since the days of learning turbo pascal…

I just bought a Fireboard 2 Pro + blower, I will be installing it on my Weber 22 inch Kettle, any updates on this integration? @jocnnor can you share your setup?

I made some progress, look at my post here. Assistance with Rest sensor configuration for Fireboard temperature controller - #7 by Staffan_Spjuth

Do you have any plans for creating an integration to make this easier? I would love to integrate my fireboats with home assistant.