Hello,
I Need help with controlling DLI Web Power Switch Pro from Home Assistant
Current firmware version number: 1.9.10.0
Below is yaml code that creates switch button in HA dashboard, but does not turn on or off the switch using DLI rest API command that’s in yaml code I found from HA community forum.
Configuration.yaml (updated code view)
# DLI Power Controller
switch:
- platform: command_line
scan_interval:
seconds: 10
switches:
power_outlet_2:
command_on: "curl -u admin:mypassword -X PUT -H 'X-CSRF: x' --data 'value=true' --digest 'http://10.25.43.7/restapi/relay/outlets/1/state/'"
command_off: "curl -u admin:mypassword -X PUT -H 'X-CSRF: x' --data 'value=false' --digest 'http://10.25.43.7/restapi/relay/outlets/1/state/'"
command_state: "curl -s -k -u admin:mypassword -H 'Accept:application/json' --digest 'https://10.25.43.7/restapi/relay/outlets/1/state/'"
value_template: "{{ value }}"
friendly_name: 'DLI Outlet 2'
BTW…Power Outlet Control works fine when run from Mac OS Terminal (see command below)
(Turn ON Outlet 2)
curl --digest -u admin:mypassord -X PUT -H "X-CSRF: x" --data "value=true" "http://10.25.43.7/restapi/relay/outlets/1/state/"
(Turn OFF Outlet 2)
curl --digest -u admin:mypassword -X PUT -H "X-CSRF: x" --data "value=false" "http://10.25.43.7/restapi/relay/outlets/1/state/"
Any help, greatly appreciated
Update: Here’s a better view of the yaml code-