Octoprint encloser temp sensor in home assistant

Hi guys,

i try to get the value of my temperature sensor in HA. All my searches at google doesnt help.

hardware: raspberry pi 4 , temp sensor DS18B20 at GPIO4 and HA on other pi

On my octoprint i can see the temperature in the navbar.

I tried the following in HA configuration.yaml:

sensor:
  - platform: rest
    name: Temp_Gehäuse
    device_class: temperature
    unit_of_measurement: "°C"
    resource: http://192.168.178.46/plugin/enclosure/inputs/1
    value_template: '{{ value_json.temp_sensor_temp }}'
    scan_interval: 5

I have no idea why it doesnt work, i only get a value of 0.
when i make a GET request in “boomerang” i get this: so i think the adress is correct.

Please, someone has an idea?

I came across your post.
Don’t know if you fixed it on your side, but here is how I made it in the configuration.yaml:

rest:
  - scan_interval: 5 #seconds
    resource: http://x.x.x.x/plugin/enclosure/inputs/1
    headers:
      X-Api-Key: "Your octoprint API key for Home Assistant"
      Content-Type: "application/json"
    sensor:
      - name: "Octoprint enclosure Temperature"
        value_template: "{{ value_json.temp_sensor_temp }}"
        unit_of_measurement: "°C"
        device_class: temperature
      - name: "Octoprint enclosure Humidity"
        value_template: "{{ value_json.temp_sensor_humidity }}"
        unit_of_measurement: "%"
        icon: mdi:cloud-percent
        device_class: humidity

You just need to pass an API key.

Thank you. It is working now.