dwighthubbard / python-dlipower

Python modules to manage Digital Loggers Web Power Switch
Other
54 stars 35 forks source link

Doesn't work with new "Pro" switch #35

Closed jradwan closed 6 years ago

jradwan commented 6 years ago

Something has apparently changed in the new LPC9 "pro" version of the switch (which also has wireless now) because the dlipower script won't connect to it.

If I do a curl against my old LPC7 switch, without authentication, I get this:

$ curl http://192.168.1.4/index.htm
<HTML><HEAD>

<META HTTP-EQUIV="refresh" content="0; URL=/">

</HEAD><BODY></BODY>

And if I include authentication, I get the actual index page (which dlipower would then parse). But with the LPC9, if I do a curl with (or without) authentication, I get this:

$ curl http://192.168.1.5/index.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="/style.css">
<title>Redirecting...</title>

<META HTTP-EQUIV="refresh" content="0; URL=/">

</head>

<body>
</body>

</html>

It's not actually loading the index.htm page. Any suggestions on how I could fix this? The web UI of the LPC9 looks pretty much the same as the LPC7. It just has some additional features like wireless, event notifications, a new scripting engine, etc. The basic outlet control seems the same.

Thanks!

dwighthubbard commented 6 years ago

The pro switch should be working with the new release

jradwan commented 6 years ago

Yes, it does. Thanks!

andjones132 commented 6 years ago

I am still having issues connecting to the new DL Web Power Pro switch over wifi. Below is an excerpt from the home-assistant.log.

2018-06-27 20:54:52 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform digitalloggers Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/digitalloggers.py", line 69, in setup_platform for outlet in power_switch[0:] File "/usr/lib/python3.6/site-packages/dlipower/dlipower.py", line 298, in getitem status = self.statuslist()[index.start:index.stop] TypeError: 'NoneType' object is not subscriptable

I am running ha version 0.72.1. It looks like from the previous post that this issue was resolved, so I am curious why I am still having an issue. I can connect to the switch via the LAN IP intermittently while ha is running. I had to change the invalid logon lockout period to 0 in order to avoid getting locked out by ha trying and failing to connect.

Andrew J

jradwan commented 6 years ago

Sorry, I should have clarified that I tested the fix outside of HA. In the time between I logged the original issue and the fix, I actually stopped using HA. I made a (bad) assumption that since the code was fixed and it worked via direct python it would work through HA as well.

kda commented 5 years ago

I'm seeing this issue. I am using a clone from the repo. I upgraded the Web Power Switch to 1.7.20.0. I think they "upgraded" to Javascript...

Alas, I figured it out: Go to the settings page, under Access Settings and check the checkbox: Allow legacy plaintext login methods