Plugwise xPL-PERL support

Plugwise Forum about Plugwise devices and the Source software.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Thanks for help Hollie!

I might have found the cause. It send the request on my external network. And since it broadcasts it it dosnt work. When i started it with -i eth1 and i used the local network on booth the hub and the sender atleast those 2 worked out. Now i just need to get my gf to put in the correct stick in that computer :D
Because now booth the hub and the logger gets the info. Now i only need to figure out how the heck the runit thingy works and understand what i did to install xPL-PERL. It looks damn nice i must say.

Will get back when she have put the plug in and i can test that :)
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Holli. Awesome! It works now 8) :D :D It will be a damn late night.

Code: Select all

xpl-stat
{
hop=1
source=hollie-plugwise.router
target=*
}
plugwise.basic
{
command=listcircles
device00=9927B4
device01=46A07D
device02=9927B1
device03=B1B97B
device04=B1BCE4
device05=B1BB69
device06=469DC1
device07=B1BB6F
device08=B1BBAB
device09=B1BA17
device10=4321CD
device11=43B02E
device12=B1BB6C
device13=469E2A
device14=AF5098
device15=D36368
device16=43B295
device17=431B19
device18=3FD245
device19=43B012
device20=469E17
device21=AF4FFC
device22=4694ED
device23=998BC5
device24=43B010
device25=AF4EDA
device26=994AEE
device27=4695A9
device28=B1B4BB
device29=995C46
device30=99897C
}
Now im gonna search some and see if someone have done some nice scripts and get some ideas.
hollie
Starting Member
Starting Member
Posts: 17
Joined: Fri Aug 28, 2009 8:22 pm
Location: Belgium
Contact:

Re: Plugwise xPL-PERL support

Post by hollie »

Hej Daromer,

cool!

I'm using MisterHouse to control some lights based on the lightlevel outside and based on motion sensors. I also turn the amplifiers of my music installations on and off based on the status of my Squeezeboxes. The interface to the plugwise devices from MisterHouse is provided by a plugin module I wrote. So you can control the Circles like any other MisterHouse object.

Have fun,
Hollie.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Nice. Im using my own built software. Bash and php mainly. Then webpages to do the overview.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Another question. Im testing the limits of xpl-plugwise to see how i should build my programs.
If i run /usr/local/bin/xpl-plugwise --plugwise-tty /dev/ttyU0 --verbose -i eth1

And pools for livehistory constantly the xpl-plugwise stops responding after an hour or so.

Is it a bug or something else i found? :)
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

I can also se alot of

Code: Select all

at /usr/local/share/perl/5.12.4/xPL/IOHandler.pm line 213
Use of uninitialized value $offnoise in addition (+) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $gainB in multiplication (*) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $offnoise in addition (+) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $gainA in multiplication (*) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $offtot in addition (+) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $offnoise in addition (+) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $gainB in multiplication (*) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $offnoise in addition (+) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $gainA in multiplication (*) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.
Use of uninitialized value $offtot in addition (+) at /usr/local/share/perl/5.12.4/xPL/Dock/Plugwise.pm line 809.

Will dig into this later on.
hollie
Starting Member
Starting Member
Posts: 17
Joined: Fri Aug 28, 2009 8:22 pm
Location: Belgium
Contact:

Re: Plugwise xPL-PERL support

Post by hollie »

Regarding the livehistory: I wouldn't know what the limits are (that is what you get with closed-protocol hardware...). So it is hard to determine if the problem you describe is hardware related or something that is wrong in the interface I wrote. I did implemented a command queue that limits the rate at which commands are sent to the stick, no matter how fast your send them through xPL. So that part of the interface should be OK. What the code does depend on currently is the initial response sent by the stick in reply to a command/request. If that response is not produced by the stick, it will cause a 'hang'.
I think that in the Source software from Plugwise, Circles are polled at a fairly low frequency for their live power consumption, so maybe you're just pushing it a little bit too hard?

Also, I remember reading posts from people that experienced hardware hangs when polling the Circles too frequently.

Concerning the 'uninitialized' messages: good catch. This is caused by the fact that a Circle has not responded to a calibration request. At some point (e.g. when you perform 'listcircles' for the first time or request power info for the first time) a Circle is interrogated to get the calibration values. Those values are required to calculate the actual power or energy from the readings reported by a Circle. If the Circle does not respond to the calibration request, a log.basic xPL message is created (that you should be able to log with the current code). But in the current code, the fact that the calibration values are missing is not taking into account the fact that values could be missing due to a Circle not responding to a calibration request.
I will fix this probably this week (congratulations, you reported the first issue :-) https://github.com/hollie/xpl-perl/issues/1).
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Seems like the xpl-plugwise stalls:

It spinns on something like this:

'30590' => {
'received_ok' => 1,
'type' => 'plugwise.basic'
},
'23752' => {
'received_ok' => 1,
'type' => 'plugwise.basic'
},
'23804' => {
'received_ok' => 1,
'type' => 'plugwise.basic'
}
};
Plugwise connected status is 1
UART RX buffer is now '�'
Pointers: RD: 73422
Awaiting_response: 1
++++++++++++++++++++++++++++++++++++++
Process_queue: seems we're waiting for a response from a previous command (rd: 73422)
------- queue_to_stick -------------------------------



Same thing over and over. This is only a small part of it.
hollie
Starting Member
Starting Member
Posts: 17
Joined: Fri Aug 28, 2009 8:22 pm
Location: Belgium
Contact:

Re: Plugwise xPL-PERL support

Post by hollie »

As stated: xpl-plugwise stalls when it is waiting for a response from the Stick. I assume that the Stick responds to each frame in the same way: one 'ACK' with a frame counter, and one actual response. If this is not the case, then xpl-plugwise will appear to 'hang' (and you indeed see that 'awaiting response' == 1).

I will try to duplicate your problem. At what rate are you sending live power requests?
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Hi

Im sending 5 requests after each another with no timeout with xpl-sender. Then i wait 3-4 seconds after the last one is send and i send another 5 requests for power..

This works kinda well untill it ends up in some loong loop with the above.


Im not reading the values with the same process that is sending. i got a deamon reading a socket that i have reconfigured an xpl-log to send to.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Another interesting thing is this:
Array
(
[0] => 192.168.10.1:34405
[1] => xpl-stat
[2] => plugwise.basic:
[3] => hollie-plugwise.router
[4] => ->
[5] => *
[6] => 995C46
[7] => power
[8] => 0.0002
[9] => 17.5629
[10] => kW
)


The power on #9 is the 8 second one. It ends u p way to high. This happens on 2 of my 32 devices at the moment. it happens perhaps on every 10th reading or so. Haven checked that much about it. Just built in a checker that skips those high readings.
hollie
Starting Member
Starting Member
Posts: 17
Joined: Fri Aug 28, 2009 8:22 pm
Location: Belgium
Contact:

Re: Plugwise xPL-PERL support

Post by hollie »

I'm only reading out the historic power consumption in my system and not the live power consumption. From what you write, could it be that you're requesting the live power too frequently? Have you tried reducing the request rate to e.g. once a second? Does the problem then also occur? Do you also see false readings when you use the Plugwise Source firmware?

Concerning the false reading: do you get 'decent' values out of the per-second measurements when you attach a known load? Maybe there is something wrong with the conversion formula for pulses -> W that takes into account the calibration values. This would cause also the per-second readings to be invalid.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Hi,

I will try to reduce the amounts later on when the statistics part is done for this new plattform. Haven rewritten all the old code yet.

About false readins in source: no idea. If it happens they probably filter it. And perhaps it is due to load is almost 0. But dont know. Since 1 second load is 0.1-0.2 and i have several others where the amount is between 0 and 0.5 without a problem. But it sure does look like some sort of internal calculation problem. As long as the values is this high it dosnt mather for me. Its easy to filter them.

Will try to gather more info.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

There must be a bug in the software. (Perhaps in the plugwise itself but dont think so)

It ends up in the loop when a device isnt online and after some time that loops starts going. When i then restart the xpl-plugwise it works except it dosnt still find the devices that got lost earlier. Only way to get them to work is to unplug them and then plug them back again in. It dosnt help if i start source. xpl-plugwise seem to make the circles to end up in some kind of endless loops that need power reset to be brooken.

Will do some more tests now.
daromer
Starting Member
Starting Member
Posts: 42
Joined: Sat Oct 24, 2009 2:41 pm
Location: Sweden

Re: Plugwise xPL-PERL support

Post by daromer »

Have tested some more.

And this happens when i loses connection to one circle for a couple of calls. It ends up in some sort of queue. And in the end this just loops around.

In this case i run 1 livepower each 5th second. So that should be enough time between.
Post Reply

Return to “Plugwise Forum”