DLI Web Power Switch Pro Control

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-

Hello!

As far as I can tell, the YAML is valid.

I’ve added to my test config, and can see requests are being sent (and failing, since I don’t have one of these devices):

Do you see errors in the logs?

Hi, thanks for checking my post and trying out the code.

Yes I see the following error:

I figured it out, my DLI Power outlet controller was on a separate VLAN on my home network. I needed to add a entry in the network firewall to allow traffic from DLI Power Controller to Home Assistant server. After that allow rule, DLI Power controller now works.

1 Like