epoxsv
(Epoxsv)
January 15, 2020, 8:39pm
1
Hi All,
Thanks for our work about HA !
I need yout help, i want to integration Awtrix (LED MATRIX) to my HA with REST.
I have created REST INTEGRATION on my config.yaml
rest_command:
awtrix_notify:
url: http://IP/api/v3/settings
method: POST
payload: ‘{“Brightness”: “70 ”}’
content_type: ‘application/json’
When I send my service “rest_command.awtrix_notify” in developper tools, it work fine
But is it possible to create an variable for value of Brightness (70 in my example) ? How can I do that ?
When i send my service “rest_command.awtrix_notify”, I want to send Brightness in parameter.
Thanks for your help !
jocnnor
(Jim O'Connor)
January 15, 2020, 10:34pm
2
Just use the normal template style. whatever you put inside the {{ }} will be the variable(s) you need to pass into your command.
rest_command:
awtrix_notify:
url: http://IP/api/v3/settings
method: POST
payload: '{“Brightness”: "{{ brightness_variable_name }}" }’
content_type: ‘application/json’
Now when you call this command, pass in the data of brightness to it. Example automation:
- alias: Awtrix Test
trigger:
platform: time
at: "22:00:00"
action:
- service: rest_command.awtrix_notify
data: {"brightness_variable_name":"100"}
The data is a json array of all of the variables you want to replace.
After doing this, try it in the developer tools. You’ll have to build the json array as the payload in the gui.
{
"brightness_variable_name" : "70"
}
1 Like