Handling HNAP - DLink DSP-W215 example

Python and python framework

Moderator: leecollings

dramich
Posts: 2
Joined: Saturday 11 March 2017 10:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dramich »

Hi, version 6943 - working well - thank You
elgiampo
Posts: 3
Joined: Monday 15 May 2017 20:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by elgiampo »

after the last beta upgrade, 3.7602, my DSP W 215 is disappeared from domoticz menu... what's happened?
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by Dnpwwo »

As warned, the latest beta broke some plugins. Try upgrading to the new plugin for this device in the examples folder.

If you still have issues, turn on debugging for the plugin and post the log output.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

Hi,

I was using the 1.1 plugin,no problems, then i decided to upgrade domoticz (3.7690 beta) then not be able to communicate with my plugs, now im getting this error :

2017-06-08 18:06:06.243 Error: (Dlink Hallway) 'onHeartbeat' failed 'AttributeError':''module' object has no attribute 'Connect''.
2017-06-08 18:06:06.243 Error: (Dlink Hallway) ----> Line 281 in /home/pi/domoticz/plugins/DSP215/plugin.py, function onHeartbeat
2017-06-08 18:06:06.243 Error: (Dlink Hallway) ----> Line 191 in /home/pi/domoticz/plugins/DSP215/plugin.py, function onHeartbeat

Any idea?
Thanks in advance.
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by Dnpwwo »

@dezde29,
As warned, the latest beta broke some plugins. Try upgrading to the new plugin for this device in the examples folder.

If you still have issues, turn on debugging for the plugin and post the log output.
I never heard back from elgiampo so I assume that will fix it
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

Hello,

Thanks for your quick reply, unfortunatly Im still struggling:

The script is consider by domoticz but still fail to initialize the plugs, here a complete log :

2017-06-09 17:48:16.404 (Dlink Hallway) Plugin is stopping.
2017-06-09 17:48:16.612 (Dlink Hallway) Exiting work loop...
2017-06-09 17:48:16.612 (Dlink Hallway) Stopped.
2017-06-09 17:48:16.710 (Dlink Hallway) Initialized version 1.0.0, author 'Dnpwwo'
2017-06-09 17:48:16.713 (Dlink Hallway) Debug log level set to: 'true'.
2017-06-09 17:48:16.713 (Dlink Hallway) 'HomeFolder':'/home/pi/domoticz/plugins/DSP-W215/'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Name':'Dlink Hallway'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Port':'80'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Version':'1.0.0'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Author':'Dnpwwo'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Mode6':'Debug'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Mode1':'admin'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Key':'DSP-W215'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Address':'192.168.0.14'
2017-06-09 17:48:16.713 (Dlink Hallway) 'HardwareID':'9'
2017-06-09 17:48:16.713 (Dlink Hallway) 'Mode2':'XXX'
2017-06-09 17:48:16.713 (Dlink Hallway) Device count: 3
2017-06-09 17:48:16.713 (Dlink Hallway) Device: 1 - ID: 41, Name: 'Dlink Hallway - Socket', nValue: 1, sValue: '100'
2017-06-09 17:48:16.713 (Dlink Hallway) Device ID: '41'
2017-06-09 17:48:16.713 (Dlink Hallway) Device Name: 'Dlink Hallway - Socket'
2017-06-09 17:48:16.714 (Dlink Hallway) Device nValue: 1
2017-06-09 17:48:16.714 (Dlink Hallway) Device sValue: '100'
2017-06-09 17:48:16.714 (Dlink Hallway) Device LastLevel: 100
2017-06-09 17:48:16.714 (Dlink Hallway) Device: 2 - ID: 42, Name: 'Dlink Hallway - Usage', nValue: 1, sValue: '1.14'
2017-06-09 17:48:16.714 (Dlink Hallway) Device ID: '42'
2017-06-09 17:48:16.714 (Dlink Hallway) Device Name: 'Dlink Hallway - Usage'
2017-06-09 17:48:16.714 (Dlink Hallway) Device nValue: 1
2017-06-09 17:48:16.714 (Dlink Hallway) Device sValue: '1.14'
2017-06-09 17:48:16.714 (Dlink Hallway) Device LastLevel: 0
2017-06-09 17:48:16.714 (Dlink Hallway) Device: 3 - ID: 43, Name: 'Dlink Hallway - Temperature', nValue: 1, sValue: '50'
2017-06-09 17:48:16.714 (Dlink Hallway) Device ID: '43'
2017-06-09 17:48:16.714 (Dlink Hallway) Device Name: 'Dlink Hallway - Temperature'
2017-06-09 17:48:16.714 (Dlink Hallway) Device nValue: 1
2017-06-09 17:48:16.714 (Dlink Hallway) Device sValue: '50'
2017-06-09 17:48:16.714 (Dlink Hallway) Device LastLevel: 0
2017-06-09 17:48:16.714 Error: (Dlink Hallway) 'onStart' failed 'AttributeError':'module 'Domoticz' has no attribute 'Transport''.
2017-06-09 17:48:16.714 Error: (Dlink Hallway) ----> Line 246 in /home/pi/domoticz/plugins/DSP-W215/plugin.py, function onStart
2017-06-09 17:48:16.714 Error: (Dlink Hallway) ----> Line 43 in /home/pi/domoticz/plugins/DSP-W215/plugin.py, function onStart

I've tried different plugins 1 and 1.1, reinstall the server but I dont get it back to work.

If you can think of anything.
Thanks in advance.
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by Dnpwwo »

@dezde29,

Thanks for taking the time to post a debug log of what you are seeing, it makes things much easier to troubleshoot.

For some reason you still don't have the new version running which works with the current beta. You could try pulling it directly from https://github.com/domoticz/domoticz/bl ... SP-W215.py to make sure you have the right one.

To tell the difference, the old one looked like this at around line 43:

Code: Select all

        Domoticz.Transport(Transport="TCP/IP", Address=Parameters["Address"], Port=Parameters["Port"])
        Domoticz.Protocol("HTTP")
        Domoticz.Heartbeat(8)
        Domoticz.Connect()
the new one has this:

Code: Select all

        self.httpConn = Domoticz.Connection(Name="DLink", Transport="TCP/IP", Protocol="HTTP", Address=Parameters["Address"], Port=Parameters["Port"])
        self.httpConn.Connect()
if you put the new version in your directory and name it plugin.py it should work.

Let me know if you still have issues because, although I updated the plugin, I don't have one of these so couldn't test it
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

Hi,

Thanks for you help, unfortunatly, after replacing the script, the Dlink in the hardware list has disappear.
Hard to get any logs.
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by Dnpwwo »

@dezde29,

If it is not in the hardware list that normally means that Domoticz can't access it.

If you are sure that you put it in the right directory I would suggest checking the permissions. If you are on Linux you could use a command like

Code: Select all

chmod 775 plugin.py
to make sure Domoticz can read and execute the file
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

root@raspberrypi:/home/pi/domoticz/plugins/DSP-W215# ls -l
total 144
-rwxrwxr-x 1 root root 143678 Jun 16 04:37 plugin.py
root@raspberrypi:/home/pi/domoticz/plugins/DSP-W215# /etc/init.d/domoticz.sh restart

then init 6, no luck, if I put back the previous script, it get back in the list but with the previous errors.

Is there a way to combine the 1.1 and the latest version.
I'll try to get back with more infos, need to remember how to enable the domoticz logs.
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

Hi,

I previously made a mistake and did "save as" on the new plug-in link wich didn't copy the script correctly.
Since i made sure to have the right code and rights on the file, i also change my wifi SSID ans reset my plugs but still get this error :

2017-06-16 18:17:22.615 Error: (DSP-W215) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/DSP-W215/:/usr/local/lib/python35.zip:/usr/local/lib/python3.5/:/usr/local/lib/python3.5/plat-linux:/usr/local/lib/python3.5/lib-dynload'.
2017-06-16 18:17:22.615 Error: (Dlink Fan) Module Import failed, exception: 'TabError'
2017-06-16 18:17:22.615 Error: (Dlink Fan) Import detail: File: /home/pi/domoticz/plugins/DSP-W215/plugin.py, Line: 1768736992, offset: 32
2017-06-16 18:17:22.615 Error: (Dlink Fan) Error Line ' httpConn = None
'
2017-06-16 18:18:30.306 Error: Dlink Fan hardware (13) thread seems to have ended unexpectedly
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by Dnpwwo »

@dezde29,

I have pushed a fix for this which will be merged into the beta channel soon but if you want to fix yours now it is pretty easy:
  • Open the plugin.py file and go to line 32.
  • Replace the tab character at the start of the line with 4 spaces
That should do it.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
pawels72
Posts: 1
Joined: Saturday 16 July 2016 21:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: PL
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by pawels72 »

Hello,

I've tried to do that fix but after some minutes domoticz is crashing - example log:

2017-06-18 12:25:29.192 Error: Domoticz received fatal signal 11 !...
2017-06-18 12:25:29.196 Error: /home/pawel/domoticz/domoticz() [0x1cca74]
2017-06-18 12:25:29.197 Error: /home/pawel/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1ccb2c]
2017-06-18 12:25:29.197 Error: /lib/arm-linux-gnueabihf/libc.so.6(+0x25260) [0x76be5260]

removing file plugin.py solving crashing problem. I'm using v3.7976 beta.
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

Hello,

After correcting the tab, here is the new log :

2017-06-17 13:26:51.480 Error: (DSP-W215) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/DSP-W215/:/usr/local/lib/python35.zip:/usr/local/lib/python3.5/:/usr/local/lib/python3.5/plat-linux:/usr/local/lib/python3.5/lib-dynload'.
2017-06-17 13:26:51.480 Error: (Dlink Fan) Call to import module '' failed, unable to decode exception.
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

@Dnpwwo

A big thanks for your work and perseverance.
Its all back in order with the latest script and beta update 8000.

Thanks again.
dezde29
Posts: 9
Joined: Saturday 04 February 2017 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by dezde29 »

Im sorry, but im back in the dog house. At first the script worked, but after a few minutes the domoticz interface kept going offline, then after copying the script again, i have this:

2017-06-22 22:36:33.669 Error: (DSP-W215) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/DSP-W215/:/usr/local/lib/python35.zip:/usr/local/lib/python3.5/:/usr/local/lib/python3.5/plat-linux:/usr/local/lib/python3.5/lib-dynload'.
2017-06-22 22:36:33.669 Error: (Dlink Fan) Module Import failed, exception: 'SyntaxError'
2017-06-22 22:36:33.669 Error: (Dlink Fan) Import detail: File: /home/pi/domoticz/plugins/DSP-W215/plugin.py, Line: 1760650400, offset: 291
2017-06-22 22:36:33.669 Error: (Dlink Fan) Error Line 'return
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by Dnpwwo »

@dezde29,

I just copied the file from the examples folder again and it loaded and started. Can you try that one?

@pawels72,

If it crashes after a few minutes, turn debug on for the plugin in the Hardware page than post the log. Just posting the error dosen't help trouble shoot.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
mozo78
Posts: 22
Joined: Friday 09 June 2017 6:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by mozo78 »

New update, new problem. :(

2017-07-31 21:04:29.607 Error: (Dlink konnektor) 'onMessage' failed 'AttributeError':''dict' object has no attribute 'decode''.
2017-07-31 21:04:29.607 Error: (Dlink konnektor) ----> Line 257 in /home/pi/domoticz/plugins/DSPW215/plugin.py, function onMessage
2017-07-31 21:04:29.607 Error: (Dlink konnektor) ----> Line 82 in /home/pi/domoticz/plugins/DSPW215/plugin.py, function onMessage
tkald
Posts: 8
Joined: Friday 01 January 2016 12:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by tkald »

mozo78 wrote:New update, new problem. :(

2017-07-31 21:04:29.607 Error: (Dlink konnektor) 'onMessage' failed 'AttributeError':''dict' object has no attribute 'decode''.
2017-07-31 21:04:29.607 Error: (Dlink konnektor) ----> Line 257 in /home/pi/domoticz/plugins/DSPW215/plugin.py, function onMessage
2017-07-31 21:04:29.607 Error: (Dlink konnektor) ----> Line 82 in /home/pi/domoticz/plugins/DSPW215/plugin.py, function onMessage
I have the same problem with version 1.2.0 :-(
How to temporaly solve it:
line 82: strData = str(Data)
new line under 82: Status = int(Data['Status'])

Everything is temporaly fix! But it works for me :-D
mozo78
Posts: 22
Joined: Friday 09 June 2017 6:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Handling HNAP - DLink DSP-W215 example

Post by mozo78 »

tkald wrote:
mozo78 wrote:New update, new problem. :(

2017-07-31 21:04:29.607 Error: (Dlink konnektor) 'onMessage' failed 'AttributeError':''dict' object has no attribute 'decode''.
2017-07-31 21:04:29.607 Error: (Dlink konnektor) ----> Line 257 in /home/pi/domoticz/plugins/DSPW215/plugin.py, function onMessage
2017-07-31 21:04:29.607 Error: (Dlink konnektor) ----> Line 82 in /home/pi/domoticz/plugins/DSPW215/plugin.py, function onMessage
I have the same problem with version 1.2.0 :-(
How to temporaly solve it:
line 82: strData = str(Data)
new line under 82: Status = int(Data['Status'])

Everything is temporaly fix! But it works for me :-D

Big THX! It is working now. :) A previous version could log the temperature and power consumption as well. Have you got a solution for these values?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest