Page 7 of 16

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Sun Dec 08, 2013 12:21 am
by manno
Wow! This is really cool! I'm in process of gathering the equipment needed but having some confusion on the wiring part of it. Can someone elaborate on how the wiring/connection is between the tp-link usb, micro-usb, the serial port on the powermax and the pl2303? Maybe a single schematic of all these parts wired together? Thanks a ton!

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Mon Dec 23, 2013 1:33 am
by manno
I was able to get the tp-link working ok and all seems to be working except that I pmaxd is not seeing the state change in the sensors. I can see state change in the panel itself when I arm/disarm but when armed and I trip a motion detector, I do not see a state change after running jsongetxplstate.cgi.

When running pmaxd -f -vvvv -xpldebug I get this after the xPL_DEBUG section:

ERR: [Sun Dec 22 15:16:30 2013 deFormatBuffer:0185]checksum NOK calculated:00B1 in packet:00C8
ERR: [Sun Dec 22 15:16:30 2013 packetManager:0292]Packet not correctly formated

this when I arm:

ERR: [Sun Dec 22 15:18:40 2013 deFormatBuffer:0185]checksum NOK calculated:00F5 in packet:000D
ERR: [Sun Dec 22 15:18:40 2013 packetManager:0292]Packet not correctly formated
ERR: [Sun Dec 22 15:18:40 2013 logBuffer:0141]Buffer: A5 00 07 00 00 00 00 00 01 00 00 43 0F 0A 0D A5 00 0A 00 00 00 00 00 00 00 00 43

but does show in jsongetxplstate that it armed.

After it arms, I get a continuous stream of this:

ERR: [Sun Dec 22 15:19:43 2013 deFormatBuffer:0185]checksum NOK calculated:00EF in packet:0000
ERR: [Sun Dec 22 15:19:43 2013 packetManager:0292]Packet not correctly formated
ERR: [Sun Dec 22 15:19:43 2013 logBuffer:0141]Buffer: 08 08

and when I trip the motion sensors, the output doesn't change but when the sirens start sounding, I get a stream of this:

ERR: [Sun Dec 22 15:21:11 2013 deFormatBuffer:0185]checksum NOK calculated:00ED in packet:0000
ERR: [Sun Dec 22 15:21:11 2013 packetManager:0292]Packet not correctly formated
ERR: [Sun Dec 22 15:21:11 2013 logBuffer:0141]Buffer: 09 09

and when I disarm:

ERR: [Sun Dec 22 15:21:14 2013 deFormatBuffer:0185]checksum NOK calculated:0000 in packet:001C
ERR: [Sun Dec 22 15:21:14 2013 packetManager:0292]Packet not correctly formated
ERR: [Sun Dec 22 15:21:14 2013 logBuffer:0141]Buffer: 00 00

then it goes gack to some xPL_DEBUG info.

I do have more logging info if needed.

I'm not an expert programmer by any means and would like to understand why it's not working correctly. Half of it is, but only half way. Any help would be greatly appreciated!

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Sun Dec 29, 2013 3:49 am
by manno
Ok, I have been able to troubleshoot a bit and this is where I am at... My first mistake was that I did not set the auth code correctly in pmaxd.conf. After setting that up correctly, things are working better.

As of now, I can use pmaxd -fvvvvv and all console commands seem to work (a,d,c) but "g" doesn't output anything. I can arm and disarm from this console and from the web gui.

The output of jsongetxplstate.cgi (4 zones - all motion sensors):

{ "status":"disarmed","pmaxstatus":"disarmed","readytoarm":"","sensor":[{"zone":"102","type":"perimeter","alert":"false","armed":"false","tamper":"false","low-battery":"false"},{"zone":"103","type":"perimeter","alert":"false","armed":"false","tamper":"false","low-battery":"false"},{"zone":"5","type":"interior","alert":"false","armed":"false","tamper":"false","low-battery":"false"},{"zone":"6","type":"interior","alert":"false","armed":"false","tamper":"false","low-battery":"false"}]}

I've noticed that "status":"disarmed","pmaxstatus":"disarmed","readytoarm":"" changes when going from disarm to arm so I know that is working ok

I also get changes is state "tamper":"false" to "tamper":"true" when I open a sensor. So that seems to work ok.

However, I still can not get any state change when motion is detected and the panel is in alarm. jsongetxplstate.cgi outputs this in the alarm state when motion is detected:

{ "status":"armed","pmaxstatus":"armed-away","readytoarm":"","sensor":[{"zone":"102","type":"perimeter","alert":"false","armed":"false","tamper":"false","low-battery":"false"},{"zone":"103","type":"perimeter","alert":"false","armed":"false","tamper":"false","low-battery":"false"},{"zone":"5","type":"interior","alert":"false","armed":"false","tamper":"false","low-battery":"false"},{"zone":"6","type":"interior","alert":"false","armed":"false","tamper":"false","low-battery":"false"}]}

Is there any other settings that I need to do on the panel itself to send the correct data to the PC port? I enabled CS Reporting to Broadband and that didn't seem to make a difference. I haven't rebooted the panel in a very long time, since before adding the TP-Link. Would that be required?

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Tue Jan 14, 2014 12:04 am
by viknet
sorry, only seen this message now, If you still have issue, PM or mail viknet365 at gmail dot com,
in your case there is a communication issue between panel and pmaxd (a lot of checksum not OK error) try rising or lowering the packet_timeout = 2000 value in /etc/pmaxd.conf, the value 6000 is known to work in one case.

P.S. you don't see change on motion sensor, you only see them on perimeter sensor (they are open or close), It is a weakness of my code but I have no real idea about how to change this, feel free to change my code :-)

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Tue Jan 14, 2014 1:45 pm
by bartbakels
hi,

Do i understand correctly that u use xpl_hub to publish xap messages, that also can be published on thge local network? If this is the case this also can solve the issues for us Homeseer 3 users to interface the Alarm via a dedicated plugin that is not available for HS3.

thanks in advance

Bar

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Jan 15, 2014 1:42 am
by viknet
yes xpl message can be broadcasted to the network, the xap protocol has been extended to cope with more feature, but should be backward compatible,
I use a xpl sender on my android for example to arm/disarm

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Jan 15, 2014 11:21 am
by bartbakels
hmm, ok that sounds interesting. Have 2 additional questions. Is it possible to run this package from a raspberry out of the box. and are the zone statusses also viewable via XAP?

regards

Bart

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Jan 15, 2014 2:37 pm
by dad
Hi Bart,

I do not know about XAP, but I am running an xpl_hub on a RPi server quite happily.

dad

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Jan 15, 2014 2:48 pm
by bartbakels
Dad,

Do you have a short tutorial, howto get Viknets rpository working on the RPI? That would be awesome :P.

At this moment i use my RPI to share usb devices on the network by use of virtualhere. The reason i want to try viknets solution is that im migrating to homeseer 3 and the visonic plugin (rene) for HS2 is not being migrated to Homeseer 3. So at this moment i have a dual installation of HS2 and 3 only to interface my visonic by use of the HS2 visonic plugin. So if i can control my visonic by use ofRPI and XAP or POSt and or GET URL actions, I can get rid of my HS2 installation besides to my HS3 setup.

regards

Bart

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Jan 15, 2014 6:09 pm
by dad
Hi Bart,

First of all, caution: I use Pidora on my RPi and it is slightly different to Raspian - being Fedora rather than Debian based. I chose it because I come from a Fedora background. In this context it is a pain as there is a big bug in the Pidora header files that means you cannot compile viknet's code.

However getting xpl hub running was pretty straight forward (assuming you have the appropriate compiler packages installed):
$ cd ~/install
$ wget http://www.xpl4java.org/xPL4Linux/downloads/xPLLib.tgz
$ tar xzvf xPLLib.tgz
$ cd xPLLib
$ sudo make install
$ cd examples
$ make
$ sudo cp xPL_Hub /usr/local/bin
$ sudo chmod a+rx /usr/local/bin/xPL_Hub
Then you have to create a startup script to get the hub to run at start up. This is mine for Pidora, which resides in /etc/init.d (note: I only run the hub on the loopback interface - you may need to change the interface line for your setup):
$ sudo nano /etc/init.d/xplhub

Code: Select all

#!/bin/sh
#
# chkconfig: 345 40 90
# description: start xPL Hub
# processname: xplhub

# Source function library.
. /etc/rc.d/init.d/functions


RETVAL=0

start() {
 echo -e "loading xpl hub \n"
 /usr/local/bin/xPL_Hub -interface lo &
  RETVAL=$?
 echo
}
stop() {
 echo -n "stopping xpl hub"
 killproc xplhub
 RETVAL=$?
 echo
}
# See how we were called
case "$1" in
    start)
  start
  ;;
    stop)
  stop
  ;;
    status)
        status xplhub
        ;;
    *)
  echo "usage xplhub {start|stop|status}"
esac
exit $RETVAL
Then make it executable:
$ sudo chmod a+x xplhub
Restart and you should have a working hub.

HTH

Dad

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Jan 15, 2014 11:01 pm
by viknet
bartbakels wrote:hmm, ok that sounds interesting. Have 2 additional questions. Is it possible to run this package from a raspberry out of the box. and are the zone statusses also viewable via XAP?

regards

Bart

out of the box: no i have not compiled it for RPI and cross compiling is a f******g mess, but you should be able o compile it directly on the pi
the sensor (not zone) status is viewable via xpl (AFAIK xpl is a derivative from xap), only perimeter sensor are shown closed/open,

the advantage of using tplink router instead of rpi: it runs INSIDE the powermax and is powered using the battery, things you (probably) cannot do with Rpi

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Tue Feb 11, 2014 3:44 pm
by clement
Hi,
I just want to say a big thank you for this work!
I use it since last summer and It's really great.
First I tried to catch the real time event from XPL but finally I check every 30s the page /cgi-bin/jsongetxplstate.cgi with curl from an other server.
I had to add a cron to reboot the TP-Link TL-WR703N every 24h and also restart the pmaxd process when it crash sometimes...
Again, thank you,
Clement from France

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Feb 12, 2014 11:52 am
by viknet
clement wrote: I just want to say a big thank you for this work!
de rien, tu te seras surement rendu compte que j'etais francais aussi, du coté de marseille precisement.
clement wrote:I had to add a cron to reboot the TP-Link TL-WR703N every 24h and also restart the pmaxd process when it crash sometimes...
don't use the cron, you better use the testpmaxd program I created, It check different parameters and reboot if needed, with it the whole solution is very stable (reboot is even delayed 5min after boot to avoid dead loop)

what is better to understand is why it hang !!!! the reason is simple and I cannot solve it:
the 703n need usb2.0 device whereas the serial adapter is usb 1.0. the solution found by manys is to add a usb2.0 hub between the serial adapter and the 703N,

see this post and whole thread if you fancy a long read: thread: https://forum.openwrt.org/viewtopic.php ... 64#p183164

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Feb 12, 2014 12:57 pm
by wwolkers
Actually, that problem got fixed if you read the end of that topic :)
Currently it's only in the development branch, and not in stable yet, but that should only be a matter of time.

Re: Powerlink serial pinout, linux daemon and web interface

Posted: Wed Feb 12, 2014 3:31 pm
by viknet
:oops: :oops: :oops:


so upgrade your openwrt instead :=)

and I will read the thread to find out what's new
:oops: :oops: :oops: