Plugwise and Linux

Plugwise Forum about Plugwise devices and the Source software.
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Plugwise and Linux

Post by Rene »

Thanks for your offer, I will do when required (are your latest sources available?)


Rene.
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by Mdamen »

The latest work is done in my home automation software, not in the pol binary. If you want those sources let me know..

--
Maarten Damen

www.maartendamen.com
eelco
Starting Member
Starting Member
Posts: 6
Joined: Mon Jan 05, 2009 11:27 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by eelco »

Hi, I just registered today because I actually did not know of this forum. Let me first thank Maarten for his work on pol 0.2. I've just switched my first Circle on and off again using his pol.py. If you have any newer code I'm going to be greedy and ask for it :-)

I had some trouble getting the script to work because I had no clue what the mac addresses should be. I tried the code on the devices themselves at first. That did not produce any error and the prompt did not return. Digging through this forum I found out I had to open an .mdb file to get the full addresses. Opening such files is not straightforward without a copy of Microsoft Office (OpenOffice.org fan here). But I managed to open the thing somewhere and it appears that the mac addresses are in the following format for Circles :

000D6F00003 + 5position unique code. That would produce the following commandline to turn a Circle on :

# ./pol.py -p /dev/ttyUSB0 -o 000D6F000038C08A

(just posting this for future Linux users without access to MS Access ;) )
--
This is a sig
eelco
Starting Member
Starting Member
Posts: 6
Joined: Mon Jan 05, 2009 11:27 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by eelco »

There is one problem with pol.py that I've run into. When trying to get the watt figure using the -w, the python script barfs. Has anybody seen this behaviour before?

Code: Select all

root@freedom:/root/plugwise# ./pol.py -p /dev/ttyUSB0 -w 000D6F000038C08A
Traceback (most recent call last):
  File "./pol.py", line 151, in <module>
    main()
  File "./pol.py", line 135, in main
    print plugwise.GetPowerInfo()
  File "./pol.py", line 50, in GetPowerInfo
    self.GetCalibrationInfo()
  File "./pol.py", line 31, in GetCalibrationInfo
    self.gain_a = self.hexToFloat(result[0:8])
  File "./pol.py", line 70, in hexToFloat
    return struct.unpack('f', bits)[0]
  File "/usr/lib/python2.5/struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 4
Platform : Ubuntu 8.10 x86_64


--
This is a sig
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Plugwise and Linux

Post by RDNZL »

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by eelco</i>
<br />Hi, I just registered today because I actually did not know of this forum. Let me first thank Maarten for his work on pol 0.2. I've just switched my first Circle on and off again using his pol.py. If you have any newer code I'm going to be greedy and ask for it :-)

I had some trouble getting the script to work because I had no clue what the mac addresses should be. I tried the code on the devices themselves at first. That did not produce any error and the prompt did not return. Digging through this forum I found out I had to open an .mdb file to get the full addresses. Opening such files is not straightforward without a copy of Microsoft Office (OpenOffice.org fan here). But I managed to open the thing somewhere and it appears that the mac addresses are in the following format for Circles :

000D6F00003 + 5position unique code. That would produce the following commandline to turn a Circle on :

# ./pol.py -p /dev/ttyUSB0 -o 000D6F000038C08A

(just posting this for future Linux users without access to MS Access ;) )
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

I have 000D6F00002 and 000D6F00001 here, sorry! [:o)]
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by Mdamen »

Hmm error handling isn't very good in pol.py it was merely a proof of concept code. Can you switch this module on and off, and is it currently using watts?

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by eelco</i>
<br />There is one problem with pol.py that I've run into. When trying to get the watt figure using the -w, the python script barfs. Has anybody seen this behaviour before?

Code: Select all

root@freedom:/root/plugwise# ./pol.py -p /dev/ttyUSB0 -w 000D6F000038C08A
Traceback (most recent call last):
  File "./pol.py", line 151, in <module>
    main()
  File "./pol.py", line 135, in main
    print plugwise.GetPowerInfo()
  File "./pol.py", line 50, in GetPowerInfo
    self.GetCalibrationInfo()
  File "./pol.py", line 31, in GetCalibrationInfo
    self.gain_a = self.hexToFloat(result[0:8])
  File "./pol.py", line 70, in hexToFloat
    return struct.unpack('f', bits)[0]
  File "/usr/lib/python2.5/struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 4
Platform : Ubuntu 8.10 x86_64


--
This is a sig
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

--
Maarten Damen

www.maartendamen.com
eelco
Starting Member
Starting Member
Posts: 6
Joined: Mon Jan 05, 2009 11:27 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by eelco »

Yes I was suspecting a division by zero error, so I switched to Cirle off and on and made sure there was some current running through. Maybe I should try a 32 bit machine?
And I'm not complaining about code quality, I am thankful there is linux code to work with in the first place :-)

--
This is a sig
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by Mdamen »

Ah, you are on x64 didn't notice directly.
Phew.. I'd have to test that. I suspect something goes wrong with my hextofloat function...

--
Maarten Damen

www.maartendamen.com
eelco
Starting Member
Starting Member
Posts: 6
Joined: Mon Jan 05, 2009 11:27 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by eelco »

Ah, it is a 64/32 bit problem.

Just tested your script in a virtual machine with Ubuntu 8.04 32 bit and that works without any problems. There is no need to fix it for me, because I will move the USB plug to my "homeserver" which is a 32 bit CPU laptop ;)

I read that you were not working on this code anymore but on some other solution. Care to tell me about your setup / plans? With the basic stuff covered I might want to expand the number of Circles and the Linux tools to manage them.

Thanks for your quick response anyhow.

--
This is a sig
plutonium
Starting Member
Starting Member
Posts: 1
Joined: Thu Jan 22, 2009 4:11 am
Location: Sweden

Plugwise and Linux

Post by plutonium »

Wonderful work!

But I find it hard to get my Mac addresses to my modules. How do I solve this the easiest way, without mixing with Windows?

Am I required to install the source on an XP computer?

Thanks for the answer!
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by Mdamen »

@plutonium: you need to install and setup the plugs/circles once on Windows XP or similar. After it has been setup you don't need Windows any longer. You can determine the mac addresses of the plugs using the plugwise access database which is by default located under:

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">%UserProfile%\application data\plugwise\source\DB<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

--
Maarten Damen

www.maartendamen.com
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Plugwise and Linux

Post by Rene »

@Maarten: THis is new information to me. Why do you need to initialize the zigbee network from within the Source software?

Rene.
Mdamen
Forum Moderator
Forum Moderator
Posts: 390
Joined: Sat Nov 22, 2008 6:58 pm
Location: Netherlands
Contact:

Plugwise and Linux

Post by Mdamen »

Rene, you need to pair your devices with the plug at least when you use a secured plugwise network.

--
Maarten Damen

www.maartendamen.com
vivaldi
Starting Member
Starting Member
Posts: 13
Joined: Fri Jan 16, 2009 8:07 pm
Location: Netherlands

Plugwise and Linux

Post by vivaldi »

Maarten, My compliments for your hard work. I don't have the time right now to implement it on Linux, although i prefer Linux as the basis of my home automation system. I'm planning to write a php or RoR based solution. As these are within my comfort zone. But I will after we moved to our new house in april. For now I was just experimenting with the Source. The only drawback I experienced is the limited distance between the circles.

Do you know if routing and signal strength information is available?

Have a nice day
Reinder
Member
Member
Posts: 220
Joined: Sun Jan 13, 2008 12:57 am
Location: Netherlands

Plugwise and Linux

Post by Reinder »

No I don't think that's the problem. I think the problem can be found in the reliability of the wireless ZigBee system. When doing something wrong, it could stop working. With the software of Plugwise this could not happen.
Post Reply

Return to “Plugwise Forum”