Some progress has been made, but Visonic seem to have made it impossible to detect which PIR had movement ... you only can see that -something- happened. See the Vera Plugin for the specific code changes

Moderators: Rene, Willem4ever
uAlex73,uAlex73 wrote:Yes, when i finally fired out how the powerlink communication is started, i got it working on the RS232 too![]()
Just send an invalid download request, and the PM30 will ask you to enroll
Code: Select all
Other way to calculate the checksum:
1. Sum all the payload bytes in a word;
2. Subtract both high and low byte from FFFF;
3. Low byte contains the checksum.
Code: Select all
Other way to calculate the checksum:
1. Sum all the payload bytes in a word;
2. Add high and low byte together into variable total
3. If total is > 255 then substract 255
4. Subtract total from FF;
5. Low byte contains the checksum.
Code: Select all
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Check the CRC of the received data
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub CheckCRC(bData As Byte[]) As Boolean
Dim bChecksum As Byte
Dim bDataTmp As Byte[]
' first copy the bData - else we loose information
bDataTmp = bData.Copy()
' Remove the preamble
bDataTmp.Extract(0, 1)
' Remove the postamble
bDataTmp.Pop()
' Check if Count > 0
If bDataTmp.Count > 0 Then
' Copy and remove the checksum
bChecksum = bDataTmp.Pop()
' Check if calculation and checksum match
If CalculateCRC(bDataTmp) = bChecksum Then Return True
Endif
Return False
End
As an alternative this is my perl code to do the checksum ( I am a perl beginner so I am sure it can be improved):uAlex73 wrote:@Mario:
If you got issues, maybe you can share some code / examples where it goes wrong?
Code: Select all
sub CalcChksum {
my $chkstring = shift;
# Read last 4 char which should include x43 checksum indicator
my $chksum = substr($chkstring, -4);
my $chkout = "";
my $base = 0xFFFF;
# Check for checksum character
if(substr($chksum, 0, 2) ne "43"){
# If no checksum return C1 no checksum error
$chkout = "ERR:C1";
return $chkout;
}
else{
# Otherwise calculate checksum
if(substr($chkstring, 0, 2) eq "0d"){
# Strip off carriage return
$chkstring = substr($chkstring, 2, -2);
}
# Get checksum value by removing lead 43
$chksum = substr($chksum, -2);
# Convert ASCII check string back to hex and then convert and calculate in decimal
my @bytes = unpack('C*', pack('H*', $chkstring));
my $chk = 0;
# Split into decimal byte values and sum
foreach my $num (@bytes){
$chk = $chk + $num;
}
# convert decimal check value to hex
my $outhex = sprintf("%04x",$chk);
# Split checksum into hi and lo bytes
my @pairs = $outhex =~ /../sg;
my $hibyte = hex "$pairs[0]";
my $lobyte = hex "$pairs[1]";
# Perform checksum calculation (FFFF - hibyte - lobyte) and return lo byte of result
my $chkcalc = substr(sprintf("%04x",$base - $hibyte - $lobyte), -2);
# If checksum OK set checksum code to OK
if($chkcalc eq $chksum){
$chkout = "OK";
}
else{
# If lobyte = FF hibyte appears to be used
# so check hibyte or return C2 checksum calculation error
$chkcalc = substr(sprintf("%04x",$base - $hibyte - $lobyte), 0, 2);
if($chkcalc eq $chksum){
$chkout = "OK";
}
else{
$chkout = "ERR:C2";
}
}
return $chkout;
}
}
# End of sub CalcChksum
I'm looking into purchasing an alarm system and want to use the sensor information in Homeseer to activate other events. I know this is possible with the PowerMax and RFXCom. The PowerMaster seems to be a more modern unit with new technology but without the option to use RFXCom, due to the PowerG technology.uAlex73 wrote:@nlrb:
I am trying to get my PowerMaster 30 work as as i want. I manage to get the status update from the PM30 (after i send a message). How can i get "near" real-time sensor updates from the PM30 as you have build into the Vera package?
None of those messages are send out on the serial on this moment?
Can I ask you why you choose the PowerMaster over the PowerMax? Was this because of the newer technology or are there any other reasons that make up for the downside of not being able to get the sensor information directly? The possibilities of communicating through Powerlink or RFXCom seem a big plus for the PowerMax.uAlex73 wrote:I have the PowerMaster 30 (UK) here and I am getting the motion sensor events now (you need to enable "always on" on the motion sensor first) via the serial. It isn't realtime, like the PowerMax. I get them once a minute. I initially had some timing issues in the code i am using, which sometimes drop the packet (and an invalid checksum calculation ;-().
If you want to be 100% safe, then possible the PowerMax + RFXCom option is the way to go. For PowerMaster there will be never a device like RFXCom as you correctly mentioned.
For support of your PowerMax/Master, you need to write the code yourself or use supporting software like HomeSeer/DomotiGa/Vera.