Still trying to wrap my ahead around template syntax. I have a little script that dims a light by using tasmota URL call:
dim_one_step:
alias: dim all lights 10%
sequence:
- service: rest_command.send_to_tasmota
data:
ip: "50"
cmd: "dimmer%20-"
It would need to call that same command with different IPs, from 50 to 60. Im sure this can be done with a template, but the syntax,… well, if I see it, a light bulb will go off inside my head ? But its dim right now lol. help?
well, does ip support a list? If not, you just need to duplicate the service call. Template would be used to decide which ip to send it to, not to send it to both.
They are in groups, but I want to send commands that I cant do via HA light service, like changing speed and fade settings, so I can flash quickly on some alerts, and have slow fading out at night. I can do that using the URL, not any other way AFAIK.
Nope, not like that. Just copy and paste. Plus you’d get into a scenario where you can only run 1 script at a time.
Personally i’d make separate rest_commands and combine them all in a light template. Then you have a working light instead of a bunch of commands.
rest_command:
send_to_50_tasmota:
url: "http://192.168.0.50/cm?cmnd={{cmd}}"
light:
- platform: template
lights:
my_ip_50_light:
value_template: "{{ whatever you have that gets the state of the light (on or off) }}"
level_template: "{{ whatever you have that gets the current brightness level }}"
turn_on:
service: rest_command.whatever_turns_on_the_light
turn_off:
service: rest_command.whatever_turns_off_the_light
set_level:
service: rest_command.send_to_50_tasmota
data_template:
cmd: "dimmer%{{ (level / 255) | int }}"