Set temperature of a rest api heater with the rest api

Hi all, I would like to be able to set the temperature of my heater via the rest api of my heater.
What I can currently do is set the temperature via a curl -X POST and read and display it via Home Assistant.
I now want to create a temperature slider in Home Assistant that I can use to set the temperature via the rest api.
However, despite a lot of research, I have not been able to get it implemented.
Can you help me here?

thanks already Flame4ever

Set command of the Rest api (to 21 °C):
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -i 'http://192.168.1.201/set/json/v1/1/soll/10/' --data 'user=XXX&password=XXX&set=21.00'

currently i read the sensor like this

- platform: rest
  name: controme_sportroom
  resource: http://192.168.1.201/get/json/v1/1/temps/10/
  value_template: '{{ value_json[0]["name"] }}'
  json_attributes:
    - temperature
    - target_temperature
    - total_offset
    - offsets
    - sensors

- platform: template
  sensors:
    controme_sportroom_set_temperature:
      friendly_name: 'Sportsroom set_temperature'.
      unit_of_measurement: '°C'
      value_template: '{{ states.sensor.controme_sportzimmer.attributes["set_temperature"] | round(2) }}'

Have a look at this topic: Jacuzzi - Arctic Spas API - #2 by tom_l

1 Like

Hello @tom_l, the article was very helpful, but how do I get my user and password into the call, does it have to be in the payload, as far as I understand there is no “data” in rest_command.
attached my current configuration.

set_hobbyzimmer_temperature:
  name: Set Hobbyzimmer Temperature
  min: 25
  max: 35 # or whatever the min and max are
  step: 0.1
  unit_of_measurement: "°C"
  icon: mdi:thermometer

rest_command:
  spa_set_temperature:
    url: "http://192.168.1.201/set/json/v1/1/soll/11/"
    method: POST
    headers: 
      Content-Type: application/x-www-form-urlencoded
	data:
		user:[email protected]
		password:XXX
    payload: '{"soll": }'

thx for helping me

rest_command:
  spa_set_temperature:
    url: "http://192.168.1.201/set/json/v1/1/soll/11/"
    method: POST
    headers: 
      content-type: application/x-www-form-urlencoded
    username: [email protected]
    password: XXX
    payload: '{"soll": }'
1 Like

I have now assembled the following, but I get the following error message before restarting.

sensor.controme_hobbyzimmer_solltemperatur is a functional sensor which returns the setpoint with the same API.

#configuration.yaml:
rest_command:
  set_hobbyzimmer_temperature:
    url: "http://192.168.1.201/set/json/v1/1/soll/11/"
    method: POST
    headers: 
      content-type: application/x-www-form-urlencoded
    username: [email protected]
    password: xxxxx
    payload: '{"soll": {{ states("input_number.set_hobbyzimmer_temperature")| round(2) }} }'

set_hobbyzimmer_temperature:
  name: Set Hobbyzimmer Temperature
  min: 16
  max: 35 # or whatever the min and max are
  step: 0.1
  unit_of_measurement: "°C"
  icon: mdi:thermometer
#automations.yaml:
- alias: 'Set Hobbyzimmer Temperature'
  trigger:
    - platform: state
      entity_id: input_number.set_hobbyzimmer_temperature
      to:
  condition:
    - condition: template
      value_template: "{{ trigger.to_state.state not in ['unknown', 'unavailable'] }}"
    - condition: template
      value_template: "{{ states('sensor.controme_hobbyzimmer_solltemperatur')| round(2) != states('input_number.set_hobbyzimmer_temperature')| round(2) }}"
  action:
    - service: rest_command.sensor.controme_hobbyzimmer_solltemperatur

- alias: 'Get Hobbyzimmer Temperature'
  trigger:
  - platform: state
    entity_id: sensor.controme_hobbyzimmer_solltemperatur
    to:
  condition:
    - condition: template
      value_template: "{{ trigger.to_state.state not in ['unknown', 'unavailable'] }}"
    - condition: template
      value_template: "{{ states('sensor.controme_hobbyzimmer_solltemperatur')| round(2) != states('input_number.set_hobbyzimmer_temperature')| round(2) }}"
  action:
    - service: input_number.set_value
      data:
        entity_id: input_number.set_hobbyzimmer_temperature
        value: "{{ states('sensor.controme_hobbyzimmer_solltemperatur')| round(2) }}"

thx for helping me

This is an input number. Put it in the appropriate place.

The rest query does not work for my API, because it does not authenticate itself with the standard http header (username, password) but the information must be provided in the body.

https://support.controme.com/api/

Attached is the documentation of the API:

set methods

The /set/ calls have POST as HTTP method. The POST data must always contain "user" and "password" with your login data. Since we don't have certificates installed on the miniserver, it would make sense to send /set/ calls only on the local network. If the user cannot be authenticated, a status code 403 will be returned.
set-soll

+ /set/.../set/[RAUMID]/

Sets the setpoint temperature in the room. POST also contains "shall" with a decimal number as the value.
URL:

.../set/json/v1/1/soll/3/

Method:

    POST

Body:

    user
    password
    shall

Is there a possibility to include a body in the rest-command?
thx for helping me

Hello together, the following has now worked, but unfortunately only a fixed value (21.00 °C) is possible, how do I get a variable temperature (input_number) inserted here now?

binary_sensor:
  - platform: command_line
    name: set_hobbyzimmer_temperature_2
    command: "curl -o /dev/null -X POST -H 'content-type: application/x-www-form-urlencoded' -i 'http://192.168.1.201/set/json/v1/1/soll/11/' --data 'user=xxx%40xxx.xxx&password=XXXX&soll=21.00'"

thx for helping me

can anyone else help me with this?

Did you resolve your problems?
I’m trying to use my controme system into ha, reading out the Ist-Temperature is no problem, i’m searching for a solution to send the Soll-Temperature back to controme with the post command.