I’m trying to integrate my home heat pump into HA. I’m having problem with automation running rest_command, to set room temperature in heat pump controller. When I run rest_command with Developer tools → Actions the command works, but when the command is run by automation, heat pump will not change its temperature.
Rest command:
heat_pump_set_temperature:
url: "http://192.168.1.234/d13output.cgi"
method: POST
payload: "id=MV1&MV1_Thi=220"
content_type: "application/x-www-form-urlencoded"
I hardcoded to send command for 22°C while debugging.
Automation:
- id: set_heat_pump_temperature
alias: Set Heat Pump Temperature
description: Adjust temperature via input_number
triggers:
- trigger: state
entity_id: input_number.heat_pump_temperature
actions:
- action: rest_command.heat_pump_set_temperature
mode: single
The trace for this automation gives no error and shows that the rest_command was performed. The debug log for rest_command shows that commands were successful, but heat pump’s settings doesn’t change when the rest_command is run by automation and it works when run by Developer tools → Actions.
Ok so I’m fairly certain this is a copy paste error - you need to try again with the yaml preserving the indentation - because yaml syntax is all about indentation…
Assuming your yaml is correct, what happens when you run the automation via Automations & scenes, on the Automations tab, select the automation then choose Run actions from the ellipsis menu? Does it give the same result as when you run it from developer tools? If so, then maybe the trigger isn’t working.
Logs shows that the command was executed successfuly but in the second case (logs at 10:00) the heatpump didn’t changed temperature settings.
2025-02-27 09:59:29.726 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2025-02-27 09:59:29.727 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2025-02-27 09:59:29.763 DEBUG (MainThread) [homeassistant.components.rest_command] Success. Url: http://192.168.1.234/d13output.cgi. Status code: 200. Payload: b'id=MV1&MV1_Thi=220'
2025-02-27 09:59:29.776 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Stop script sequence: done
2025-02-27 10:00:04.350 INFO (MainThread) [homeassistant.components.automation.set_heat_pump_temperature] Set Heat Pump Temperature: Running automation actions
2025-02-27 10:00:04.351 INFO (MainThread) [homeassistant.components.automation.set_heat_pump_temperature] Set Heat Pump Temperature: Executing step call service
2025-02-27 10:00:04.387 DEBUG (MainThread) [homeassistant.components.rest_command] Success. Url: http://192.168.1.234/d13output.cgi. Status code: 200. Payload: b'id=MV1&MV1_Thi=220'
I recorded internet traffic with wireshark, but still don’t understand why the same command works when run with debug tools and doesn’t when run with automation.
This is the trafic when the command was successful: Imgur: The magic of the Internet, and this is when run with automation: Imgur: The magic of the Internet
- id: set_heat_pump_temperature
alias: Set Heat Pump Temperature
description: Adjust temperature via input_number
triggers:
- trigger: state
entity_id: input_number.heat_pump_temperature
actions:
- action: rest_command.heat_pump_set_temperature
mode: single
Ok - maybe it’s a timing issue with how HA runs automations and what happens if an action step finishes with commands still outstanding? Just clutching at straws, but what happens if you add - delay: 0:20 after the rest_command step?
- id: set_heat_pump_temperature
alias: Set Heat Pump Temperature
description: Adjust temperature via input_number
triggers:
- trigger: state
entity_id: input_number.heat_pump_temperature
actions:
- action: rest_command.heat_pump_set_temperature
- delay: 0:20
mode: single
I hardcoded it so it is one less thing that could be wrong. After every try i check the settings on the heatpump’s webpage and change the temperature to 21°C.