Page 7 of 13

Re: Powerlink protocol description

Posted: Mon Jan 13, 2014 3:42 pm
by Rene
Are you sure you add the preamble, checksum and postamble to the commands? And that the checksum is calculated correctly?

Re: Powerlink protocol description

Posted: Mon Jan 13, 2014 7:37 pm
by lmaurice
Yes, I'm sure for the preamble and the postamble. Concerning the checksum, I tried the checksum as calculated in the Post and tried also with +1 and -1.

I'm a little worried about it because the checksum I receive from the Powermax is usually different from the method shown in the Post. (maybe, my calculation is wrong)

For instance, I receive 0x0D 0xAB 0x03 0x00 0x1E 0x00 0x31 0x2E 0x31 0x33 0x00 0x00 0x43 0x2D 0x0A

The sum of the Payload is 0x01 0xD2. The sum of the two bytes is 0xD3 which is < 255.
0xFF - 0xD3 = 2C. But, the checksum I received is 2D. I receive it every 30s and always with this result.

Best regards,
Laurent

Re: Powerlink protocol description

Posted: Mon Jan 13, 2014 7:43 pm
by dad
Rene wrote:Are you sure you add the preamble, checksum and postamble to the commands? And that the checksum is calculated correctly?
@Rene:

I assume you mean my code. It is a matter of where in the process you break the message down into its component parts. This is very much experimental code and I have still to decide what is done in the main loop and what is done in modules.

Basically the message is parsed in to the following vars in the subroutine:

Using the example:
CalcChksum(0da50004050400001007000043f2)
$chksum = 43f2 then substringed to f2
$chkstring = a50004050400001007000043
@bytes = 165 0 4 5 4 0 0 16 7 0 0 67
$outhex = 010c
@pairs = 01 0c
$chkcalc = f2

So it seems to work for me

Dad

Re: Powerlink protocol description

Posted: Mon Jan 13, 2014 10:31 pm
by lmaurice
Definitively, the checksum is strange with my PowerMax Pro.

For instance, I receive a Keep alive with payload : 0xA5 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x43 with a Cheksum of 0x16
When I sum the check load, I have EA. FF - EA = 15 different from 16

But, I have an event with a payload 0xA5 0x00 0x04 0x05 0x01 0x00 0x00 0x00 0x05 0x00 0x00 0x43 with a checksum of 0x08
When I sum the check load, I have F7. FF - F7 = 08. There the calculation is OK

I have no idea when to take the calculation and when to add 1.
Has anybody any idea ?

Laurent

Re: Powerlink protocol description

Posted: Tue Jan 14, 2014 12:07 am
by dad
lmaurice wrote:Definitively, the checksum is strange with my PowerMax Pro.

For instance, I receive a Keep alive with payload : 0xA5 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x43 with a Cheksum of 0x16
When I sum the check load, I have EA. FF - EA = 15 different from 16

Laurent
Strange I have exactly the same message in my logs, but the checksum is 0x15!

Code: Select all

 0da5000200000000000000004315 
Dad

Re: Powerlink protocol description

Posted: Tue Jan 14, 2014 12:51 am
by viknet
check this thread page 2 message by myself about how to calculate checksum:
http://www.domoticaforum.eu/viewtopic.p ... =15#p55247

I find the proposed code dodgy in some case (false by 1) and proposed mine :

unsigned short checksum,i;
checksum=0xFFFF; (or 0xFF*x)
for (i=0;i<(Buff->size);i++)
checksum=checksum-Buff->buffer;
checksum=checksum%0xFF;

Re: Powerlink protocol description

Posted: Tue Jan 14, 2014 1:07 am
by Rene
This is the VB.Net code, which I use in the Homeseer plugin, to calculate the checksum:

Code: Select all

chkSum = 0
For index = 1 To alRecBuf.Count() - 3
  chkSum += alRecBuf.Item(index)
Next
chkSum = chkSum Mod &HFF
If chkSum And &HFF Then
  chkSum = chkSum Xor &HFF
End If

Re: Visonic Powermax Powerlink protocol description

Posted: Tue Jan 14, 2014 10:45 pm
by Mario from Spain
Hello.

I managed to write the VB.NET code to calculate the Powermax checksum.

The code is a little mess but I put it here just in case anyone needs it:

Code: Select all

'===========================================================================================================================
    ' Receives an Hex string and returns a char with the checksum
    '===========================================================================================================================
    Public Function PowermaxChecksum(ByVal MyHexString As Object)

        Dim HexS() As String
        Dim aSrtring As String
        Dim Checksum As UShort = 0
        Dim HighByte As Byte
        Dim LowByte As Byte
        Dim I As Integer
        Dim bytes As Byte()

        ' Sample Message
        ' 0D AB 0A 00 01 00 00 00 00 00 00 00 43 06 0A      
        '  |                                      |  |
        '  |                                      |  Postample
        '  |                                      Checksum
        '  Preamble

        HexS = MyHexString.Split(" ")
        Dim data(HexS.Length) As Byte
        ' 1. Sum all the payload bytes in a word;.
        For I = 0 To HexS.Length - 1
            data(I) = CLng("&h" & HexS(I))
            Checksum = Checksum + CLng("&h" & HexS(I))
        Next

        ' 2. Subtract both high and low byte from FFFF; (ej FFFF-00-FF = FF00)
        bytes = BitConverter.GetBytes(Checksum)
        LowByte = bytes(0)
        HighByte = bytes(1)
        Checksum = &HFFFF - HighByte - LowByte

        ' 3. Low byte contains the checksum.
        bytes = BitConverter.GetBytes(Checksum)
        LowByte = bytes(0)
        Checksum = LowByte

        aSrtring = Conversion.Hex(Checksum)
        If aSrtring.Length = 1 Then
            aSrtring = "0" & aSrtring
        End If

        Return aSrtring
    End Function
@Rene: I just saw your message with the code you use in the HomeSeer plugin. Thank you very much for sharing. :)

Hope it's usefull for somebody.

Mario.

Re: Visonic Powermax Powerlink protocol description

Posted: Tue Jan 14, 2014 11:10 pm
by Mario from Spain
I'm very happy :D ! THANK YOU ALL!

after finding out how to calculate de Powermax checksum and how to deal with the communications in HomeSeer I'm progressing a little more with it...

For now I can from HomeSeer:

- Arm and Disarm in all four modes (Disarm, Arm home, Arm away and Arm home instantly).
- Receive the open/close zones information.
- Get the panel status (Disarm, Exit Delay, Entry Delay, Armed Home, Armed Away, Home Bypass, Away Bypass, Ready, Not Ready, etc)

I'm rigth now trying to add other things as I progress studing the protocol ducumentation (thank you very much, guys, for a great work!)

My VB code is a complete mess and everything is hardcoded for my system but... hey, after four full time days of work it works! :)

Mario.

Re: Visonic Powermax Powerlink protocol description

Posted: Fri Jan 17, 2014 9:07 pm
by bartbakels
Mario just curious are u writing something to work with homeseer 2 or homeseer 3...? Im very interested in a hs3 solution

Regards bart


Verzonden vanaf mijn iPhone met behulp van Tapatalk

Re: Visonic Powermax Powerlink protocol description

Posted: Sat Jan 18, 2014 12:42 am
by Mario from Spain
Hi Bart.

I'm writing it for HS2. I plan to upgrade to Hs3 anytime soon (1-3 months) and will adapt the script. Problem is it's very hard coded for my setup and will need a big adjust (code rewrite) to work in any other setup.
Other than that I will be happy to share the code when it work better (right now it's loosing some commands and loosing "sync" because the communication loop isn't very fine tuned). Also I have to add code in order to process few some more things coming from the Powermax.

Re: Visonic Powermax Powerlink protocol description

Posted: Sat Jan 18, 2014 1:59 am
by bartbakels
Ok keep me posted.. Thanks in advance

Re: Visonic Powermax Powerlink protocol description

Posted: Mon May 12, 2014 11:25 pm
by bruce_miranda
Anyone managed to get the rs232 data off a powermax pro that has pl2 installed

Re: Visonic Powermax Powerlink protocol description

Posted: Sun Jun 08, 2014 9:22 pm
by d0min0
Hi,

I'm connecting a Raspberry Pi via a RS232-USB dongle. I have connected the double interface with cable etc to my USB dongle and I think I have gotten the dongle to work properly with the correct baudrate etc.

However, I'm curious, how do I initiate communcation with my PowerMax Complete unit?

Is there any example code (preferably in Python?) that connects to the unit and gets a status message back etc?

Did I understand it correctly, or is there a third PIN that is supposed to be used for remote connections? Or should I use the user PIN or installation PIN?

Awesome job, but I'm not sure how to proceed with setting up the basic communcation. :-(

Thanks in advance.

// Michael

Re: Visonic Powermax Powerlink protocol description

Posted: Thu Jun 12, 2014 11:14 am
by bartbakels
Mario from Spain wrote:I'm very happy :D ! THANK YOU ALL!

after finding out how to calculate de Powermax checksum and how to deal with the communications in HomeSeer I'm progressing a little more with it...

For now I can from HomeSeer:

- Arm and Disarm in all four modes (Disarm, Arm home, Arm away and Arm home instantly).
- Receive the open/close zones information.
- Get the panel status (Disarm, Exit Delay, Entry Delay, Armed Home, Armed Away, Home Bypass, Away Bypass, Ready, Not Ready, etc)

I'm rigth now trying to add other things as I progress studing the protocol ducumentation (thank you very much, guys, for a great work!)

My VB code is a complete mess and everything is hardcoded for my system but... hey, after four full time days of work it works! :)

Mario.
Mario,

Are you willing to discuss and share your code? Also willing to pay for it. I am trying to interface the visonic alarm in HS3. At this moment i use the HSgateway tools from Jon00 However the arming disarming etc, doe not work very reliable. Next to that i want to get rid of my HS2 installation. You can contact me if needed on bartbakels at ziggo .nl

regards

Bart