Hey, guys. I’m trying to figure out, how can I turn on switches by input_number (slider) values. Maybe it’s an odd solution, but I want to do it with url function for many reasons. URLs are working. I do not know, how can I configure Automations. For example: I want to turn on switch pc_volume_0 by slider value “0”… or when I choose value 5 on slider I want to turn on switch pc_volume_5. etc… This is my configuration:
input_number:
slider_zvuk:
icon: mdi:volume-high
name: Volume
initial: 100
min: 0
max: 100
step: 5
- platform: command_line
switches:
pc_volume_0:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol000"
pc_volume_5:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol005"
pc_volume_10:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol010"
pc_volume_15:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol015"
pc_volume_20:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol020"
pc_volume_25:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol025"
pc_volume_30:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol030"
pc_volume_35:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol035"
pc_volume_40:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol040"
pc_volume_45:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol045"
pc_volume_50:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol050"
pc_volume_55:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol055"
pc_volume_60:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol060"
pc_volume_65:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol065"
pc_volume_70:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol070"
pc_volume_75:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol075"
pc_volume_80:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol080"
pc_volume_85:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol085"
pc_volume_90:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol090"
pc_volume_95:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol095"
pc_volume_100:
command_on: curl -X POST "http://192.168.1.10:8000/?action=Shell.ExecutePredefined&command=vol100"
- alias: PC Volume
trigger:
- platform: state
entity_id: input_number.slider_zvuk
action:
- service: switch.turn_on
data_template:
entity_id: switch.pc_volume_{{ trigger.to_state.state | int }}
I believe it’s Airytec Switch Off (yeah, because it also uses port 8000), which gives you a local network accessible page, where you can launch scripts on windows on specific URLs by accessing them. I currently use it for standby command, but I think I’ll add volume and screen brightness controls (this with the commands for ClickMonitorDDC).