I have a coal heater, what would like to control by my HA. To read values I use Rest sensor and this is working.
This code let me read values. Now I am trying to send a command. To do that I need to somehow trigger URL.
I am trying to define action for that and trigger it when value of assistant is changed
So I defined Rest_Command. How can I send there Temperature value?
I am completly new with that language, so cannot understand yet how it works and official description says me nothing (really, they could place some examples with displaying how it influence entities and so on in practice...).
Codes:
Rest:
- authentication: basic
username: XXXX
password: YYYYYYY
scan_interval: 30
resource: http://192.168.AAA.BBB/getregister.cgi?device=0&fuel_level&tpow_value&tkot_value&kot_tzad&ob1_zaw4d_tzad&t1_value&next_fuel_time
sensor:
# Odczyt poziomu paliwa
- name: Poziom paliwa
unique_id: eCoal_Poziom_paliwa
value_template: '{{ value_json["cmd"]["device"]["reg"][0]["@v"] }}'
unit_of_measurement: "%"
rest_command:
ustaw_temp_kotla:
url: >-
http://XXXX:[email protected]/setregister.cgi?device=0&kot_tzad={{ temperatura }}
method: GET
It looks like you have already set up a REST command, so there should be a corresponding Action available in your automations and scripts. You can use the Actions tool to test it. If you don't see the action in the Action tool or the Action selector of the automation editor, restart Home Assistant to make sure it has been loaded, then check your logs for any errors.
Thanks for answer. I would like to send various value setted in the HA. Was trying sth like that:
rest_command:
ustaw_temp_kotla:
url: >-
http://XXX:[email protected]/setregister.cgi?device=0&kot_tzad={{ states.counter.zmien_temperature_zadana_kotla }}
method: GET
and I created automation what is triggered every time when assistant "zmien_temperature_zadana_kotla" change the value. And there I am trying to trigger this rest_command.