RESTful sensor to read data from Thingspeak

Solved!!

  - platform: rest
    name: Sensore Thingspeak
    json_attributes:
      - field1
      - field2
      - field3
      - field4
    resource: https://api.thingspeak.com/channels/xxxxxx/feeds/last.json?api_key=myapikey
    value_template: '{{ value_json.created_at }}'
  - platform: template
    sensors:
      temperatura:
        friendly_name: 'Temperatura balcone cucina'
        value_template: '{{ state_attr("sensor.sensore_thingspeak", "field1") | round(1)}}'
        device_class: temperature
        unit_of_measurement: '°C'
     other sensor.....

Thanks to the guide and tips here on the forum I created the sensor. A single http request feeds a sensor (last reading time) with 4 arguments (temp, humidity, etc.). With a templete I take the data from the arguments and create individual sensors.

2 Likes