Plugin for Visonic Powermax Integration

Here a first attempt of a powermax+/vera interface (not perfect but works for me).

It makes powermax sensors (currently movement, door contacts (fire, flood still to do)) available in vera.

What you need:

  1. a powermax+ (other powermax variants may work too)
  2. a Visonic Powermax+ RS232 Interface (about £30 in the shop)
  3. a serial to USB converter that is recognized by vera
  4. the attached plugin files

Howto:

  1. Attach the RS232 Interface to the powermax
  2. Connect the RS232 Interface to the USB/Serial and that to vera
  3. Upload the plugin files; create a device using the files and explain the device to use the usb/serial port
  4. In the powermax device advanced control tab specify the powermax zones you would like to have in vera in the variable altid in form of “Z01,Z02,Z03,Z11”. After reload zone devices should become visible
  5. Enter the installer mode on the powermax panel. Go to the menu where you define a powerlink device. Activate the powerlink device. This should trick powermax into believing it is talking to a powerlink (but it is vera).
  6. Now events from powermax sensors should be visible in vera.

Versions:
12.11.2011: Version 7

  • uses default alarm partition API D_PowermaxPartition2.json

07.09.2011: Version 6

  • UI panel for reading event logs
  • checksum calculation bugfix
  • a number of UI bugfixes

28.08.2011: Version 5

  • Solves issue with motion sensors not triggered
  • Introduces automatic serial connection re-init every 15min (improves stability)
  • code moved to (Visonic Powermax Alarm Panel)

07.08.2011: Version 4

  • Allows to arm and disarm the panel
  • Supports events and commands for scenes

03.082011: Version 3

  • Bug fixes, support of additional messages

[font=Verdana]The code moved to http://code.mios.com/trac/mios_visonic-powermax[/font]

Hi Utz,

This is absolutely brilliant!! I have been looking for something like this for a long time now. Anyway, I am not experienced with installing and creating device drivers so I would appreciate a walk through example on how to get the subjected three modules installed and working in vera please.

BR
Sten

If I see this correct you have a powermax pro with an internal powerlink module. I tried my code with a powermax+ a slightly older variant of more or less the same system. I looked at the manual of your powermax pro and I think it has a good chance to work. I assume you have already in the powermax the dual rs232 module installed (to connect your internal powerlink). Thus, there should be a free serial port you can connect to vera via a usb/serial converter. All you need is the right cable (which you can buy or just make your own).

Problems could be

  • my code aims to mimic a powerlink. I dont know what will happen with your system as there will be a powerlink AND vera aiming to emulate one.
  • powermax pro autodetects a powerlink on the serial port. with powermax+ I can tell it that there is one. So, not sure if the autodetect feature prevents the code to work
  • the powermax pro may use a different communication protocol then powermax+. In this case the code will not work as expected. I assume they are using the exact same protocol…

Yes I have a PowerMaxPro with (not an internal) but external PowerLink box which is intended for use with the PowerMax+ and works perfectly with the Pro. Therefore the protocol must be the same for both the internal and external units.

However, I need to know the details on how to create a device based on your code in Vera. As I have no clue how that is performed I need a step by step instruction.

I do have a RS323 <-> USB connected but don’t know if it works or not. Any clue on how to check this?

Uploading files

  1. Go to your vera dashboard
  2. Klick on the Mios Developers icon
  3. Goto the section Luup files
  4. Goto the end of the list where you find empty boxes
  5. Select the three powermax files in three boxes (D_Powermax.json; D_Powermax.xml; I_Powermax.xml)
  6. Select restart Luup after upload
  7. Press go
  8. On the top right of your dashboard no error message should pop up when it is done

Serial port

  1. supported usb to serial devices are listed here: http://wiki.micasaverde.com/index.php/Serial_Supported_Hardware#USB-Serial_Devices
  2. there should be hints as well how to verify it is working

Creating device in dashboard

  1. Go to your vera dashboard
  2. Klick on the Mios Developers icon
  3. Goto the section create device
  4. In section UpnpDevFilename enter: D_Powermax.xml
  5. press create device

Attach device to serial port

  1. Go to your vera dashboard
  2. Klick on the Mios Developers icon
  3. Goto the section serial port configuration
  4. Select for the serial port Used by device and enter the device name you just created
  5. select parameters: Baud 9600; Data bits 8; Parity none; Stop bit 1

Configure the powermax device:

  1. Go to your vera dashboard
  2. Click the spanner on the powermax device
  3. Goto advanced
  4. In the field altid enter the zones you would like to see: for example Z01,Z02,Z03 (in this case you will get 3 additional child devices in dashboard that represent zone devices such as movement detector or PIR sensor)
  5. When done some zone devices should appear (the arm/disarm butten will be bit funny but it goes away after a while)

then it should work. I will write more about how to debug if it does not behave.

Useful reading is this: http://wiki.micasaverde.com/index.php/Luup_Somfy_Walkthrough

That is what I followed to create the plugin (be aware some code syntax has changed and is not correct in the wiki)

If my description has errors, let me know (I never did this in one go …)

@Sten: Is it possible that you capture the commands send from the Powerlink to the Powermax in order to determine what the commands are for arming and disarming the panel? Or could can utz or I use you Powerlink to figure out?

I can confirm the protocol discovered sofar looks identical for the Powermax Pro.

There are now a few people at different places that try to make sense of the powermax protocol.

I created a wiki page here: http://powermax.wikia.com/wiki/Powermax_Wiki

The idea is to use this place to collaboratively come up with the protocol specification.

Please edit if you find out more about the protocol.

If it does not work let me know (I never used this wiki before, so I do not know if it works out)

I am very interested in getting this up running but currently I am busy with work. Once I have validated that my RS232 <-> USB converter works with VERA 1 (it does not seem to be on the list of working ones but I will give it a go anyway) and got the device driver properly installed (didn’t work the first time I did it) then I am willing to see if I can contribute to the protocol.

Yes I could of course lent you the PowerLink box provided you pick it up at my place and return it there again. However, in the weekend I intend to play with the device driver and I may need the PowerLink for that. When/if I get the the PowerMax working via VERA then I will ditch the PowerLink…

I already ordered a Powerlink and expect it to be delivered tomorrow (I got sponsored :wink: )

@rene: very good, then soon we will have the remaining protocol bits. Finally ;D. The powerlink is an embedded linux, when done with this you might be able to format it and use it for some other duty around the house.

@sten: I am not authorized to reply to your pm. But I have ordered the Powerlink so do not need yours anymore. Thanks for the offer. As soon as I have any results I will let you know.

I managed to get as far as to install the PowerMax plugin (I think?) using 10 Zones (I presume zones are the zones I have defined in the PowerMax) and I get an option for arming or bypassing. How can I use these sensors to switch on a light in Vera?

@sten

the zone devices Z01 to Z10 represent the 10 Zones you defined in the powermax. Lets say Z01 would be a movement detector. So, if someone walks pass that movement detector that is assigned to zone Z01 then the powermax would send a signal over serial link to vera and the red man should become visible in the UI at the Z01 device for a set period of time (I think I coded 5 minutes or so).

To switch on a light when someone moves in front of Z01 you need to define a scene. The event in the scene would be the device z01 tripped and the action would be to send a command to a light switch.

Thank you for your support. I have not managed to get the PowerMax panel to tricker yet. I presume it is the usb to serial adapter although it works with a PC running the PowerMax serial programming software. I have attached the VERA1 dmesg diff output before and after the usb adapter is connected. From this it seems that the serial adapter is recognized and working - not? Any clue is appreciated…

root@MiOS:~# cat zzz
— xxx Wed Aug 3 12:52:22 2011
+++ yyy Wed Aug 3 12:52:56 2011
@@ -1,8 +1,4 @@
-'s a 5350.
-mini_fo: using base directory: /
-mini_fo: using storage directory: /jffs
-jffs2.bbc: SIZE compression mode activated.
-b44: eth0: Link is up at 100 Mbps, full duplex.
+ex.
b44: eth0: Flow control is off for TX and off for RX.
device eth0.0 entered promiscuous mode
eth0.0: dev_set_promiscuity(master, 1)
@@ -285,3 +281,6 @@
hub.c: new USB device 00:03.0-1.1, assigned address 11
usbserial.c: CP210X converter detected
usbserial.c: CP210X converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
+hub.c: new USB device 00:03.0-1.2, assigned address 12
+usbserial.c: PL-2303 converter detected
+usbserial.c: PL-2303 converter now attached to ttyUSB1 (or usb/tts/1 for devfs)
root@MiOS:~#

serial port looks fine.

next you have to turn on verbose logging and then have a look in /var/log/cmh/ (I forgot the filename and I am not near my vera). You should see there if data is sent out or is coming in.

I have attached the Luup log which seem to indicate that it receives zones not defined?

02 08/03/11 14:08:45.492 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:45.496 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:45.499 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:45.501 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:45.504 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:45.506 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:55.519 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:55.521 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:55.524 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:55.526 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:55.528 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:59.527 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:59.536 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:59.546 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:59.557 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:59.566 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:59.576 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:59.586 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:59.596 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
02 08/03/11 14:08:59.606 UPnPCallbackEventHandler 4 start PIDLOG2 9360 <0x240a>
02 08/03/11 14:08:59.623 UPnPCallbackEventHandler 4 start PIDLOG2 9359 <0x2009>
50 08/03/11 14:09:03.022 luup_log:21: POWERMAX: no zone Z05 <0x402>
50 08/03/11 14:09:03.026 luup_log:21: POWERMAX: no zone Z09 <0x402>
50 08/03/11 14:09:03.030 luup_log:21: POWERMAX: no zone Z13 <0x402>
50 08/03/11 14:09:03.032 luup_log:21: POWERMAX: no zone Z14 <0x402>
50 08/03/11 14:09:03.034 luup_log:21: POWERMAX: no zone Z15 <0x402>
50 08/03/11 14:09:03.036 luup_log:21: POWERMAX: no zone Z16 <0x402>
50 08/03/11 14:09:03.037 luup_log:21: POWERMAX: no zone Z17 <0x402>
50 08/03/11 14:09:03.039 luup_log:21: POWERMAX: no zone Z18 <0x402>
50 08/03/11 14:09:03.041 luup_log:21: POWERMAX: no zone Z19 <0x402>
50 08/03/11 14:09:03.044 luup_log:21: POWERMAX: no zone Z22 <0x402>
50 08/03/11 14:09:03.046 luup_log:21: POWERMAX: no zone Z23 <0x402>
50 08/03/11 14:09:03.050 luup_log:21: POWERMAX: no zone Z26 <0x402>
50 08/03/11 14:09:03.052 luup_log:21: POWERMAX: no zone Z27 <0x402>
50 08/03/11 14:09:03.054 luup_log:21: POWERMAX: no zone Z29 <0x402>
50 08/03/11 14:09:03.056 luup_log:21: POWERMAX: no zone Z30 <0x402>
02 08/03/11 14:09:11.025 ZW_Send_Data node 4 NO ROUTE (nil)root@MiOS:/tmp/log/cmh#

No my code just periodically tries to find devices that represent all potential 30 zones of the powermax. It just means you do not have a device for e.g. Z13 in the UI.

If you push the reload button in the UI (top right) the powermax device gets a restart and should then send a message over serial to the powermax and an ACK should come back. See if you can see that happening in the logfile.

I see the following when reloading:

06 08/03/11 14:29:43.076 Device_Variable::m_szValue_set device: 14 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Neighbors was: 1,2,3,4,5,6,8,10,11,12,17, now: 1,2,3,4,5,6,8,10,11,12,17, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.077 Device_Variable::m_szValue_set device: 15 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Capabilities was: 201,4,0,3,16,0,L,R,|37,39,117, now: 201,4,0,3,16,0,L,R,|37,39,117, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.078 Device_Variable::m_szValue_set device: 15 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Neighbors was: 1,2,4,5,6,9,10,11,16,17, now: 1,2,4,5,6,9,10,11,16,17, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.079 Device_Variable::m_szValue_set device: 16 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Capabilities was: 201,4,0,3,16,0,L,R,|37,39,117, now: 201,4,0,3,16,0,L,R,|37,39,117, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.080 Device_Variable::m_szValue_set device: 16 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Neighbors was: 1,9,16, now: 1,9,16, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.081 Device_Variable::m_szValue_set device: 17 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Capabilities was: 201,4,0,3,16,0,L,R,|37,39,117, now: 201,4,0,3,16,0,L,R,|37,39,117, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.082 Device_Variable::m_szValue_set device: 17 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Neighbors was: 1,9,10,11,14,15,17, now: 1,9,10,11,14,15,17, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.083 Device_Variable::m_szValue_set device: 18 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Capabilities was: 201,4,0,3,16,0,L,R,|37,39,117, now: 201,4,0,3,16,0,L,R,|37,39,117, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.084 Device_Variable::m_szValue_set device: 18 service: urn:micasaverde-com:serviceId:ZWaveDevice1 variable: Neighbors was: 1,2,3,4,5,6,8,10,11,12,13,14,16, now: 1,2,3,4,5,6,8,10,11,12,13,14,16, #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x803>
06 08/03/11 14:29:43.085 Device_Variable::m_szValue_set device: 1 service: urn:micasaverde-com:serviceId:ZWaveNetwork1 variable: NetStatusID was: 5 now: 1 #hooks: 0 upnp: 0 v:0x8a1088/NONE duplicate:0 <0x803>
06 08/03/11 14:29:43.087 Device_Variable::m_szValue_set device: 1 service: urn:micasaverde-com:serviceId:ZWaveNetwork1 variable: NetStatusText was: Configuring ZWave devices now: OK #hooks: 0 upnp: 0 v:0x8a5890/NONE duplicate:0 <0x803>
50 08/03/11 14:29:46.032 luup_log:21: POWERMAX: starting … device #21 starting up with id Z01,Z02,Z03,Z04,Z06,Z07,Z08,Z10,Z11,Z12,Z20,Z21,Z24,Z25,Z28 <0x402>
50 08/03/11 14:29:46.033 luup_log:21: POWERMAX: attempting to add zones Z01,Z02,Z03,Z04,Z06,Z07,Z08,Z10,Z11,Z12,Z20,Z21,Z24,Z25,Z28 <0x402>
50 08/03/11 14:29:46.034 luup_log:21: POWERMAX: adding zone Z01 <0x402>
50 08/03/11 14:29:46.036 luup_log:21: POWERMAX: adding zone Z02 <0x402>
50 08/03/11 14:29:46.037 luup_log:21: POWERMAX: adding zone Z03 <0x402>
50 08/03/11 14:29:46.038 luup_log:21: POWERMAX: adding zone Z04 <0x402>
50 08/03/11 14:29:46.040 luup_log:21: POWERMAX: adding zone Z06 <0x402>
50 08/03/11 14:29:46.091 luup_log:21: POWERMAX: adding zone Z07 <0x402>
50 08/03/11 14:29:46.094 luup_log:21: POWERMAX: adding zone Z08 <0x402>
50 08/03/11 14:29:46.096 luup_log:21: POWERMAX: adding zone Z10 <0x402>
50 08/03/11 14:29:46.097 luup_log:21: POWERMAX: adding zone Z11 <0x402>
50 08/03/11 14:29:46.098 luup_log:21: POWERMAX: adding zone Z12 <0x402>
50 08/03/11 14:29:46.106 luup_log:21: POWERMAX: adding zone Z20 <0x402>
50 08/03/11 14:29:46.107 luup_log:21: POWERMAX: adding zone Z21 <0x402>
50 08/03/11 14:29:46.109 luup_log:21: POWERMAX: adding zone Z24 <0x402>
50 08/03/11 14:29:46.111 luup_log:21: POWERMAX: adding zone Z25 <0x402>
50 08/03/11 14:29:46.112 luup_log:21: POWERMAX: adding zone Z28 <0x402>
50 08/03/11 14:29:46.115 luup_log:21: POWERMAX: sending AB PDU for init <0x402>
50 08/03/11 14:29:46.152 luup_log:21: POWERMAX: start of new PDU detected <0x4011>
50 08/03/11 14:29:46.154 luup_log:21: POWERMAX: unknown PDU of type 02 detected <0x4011>
50 08/03/11 14:29:46.155 luup_log:21: POWERMAX: 43 received from panel <0x4011>
50 08/03/11 14:29:46.157 luup_log:21: POWERMAX: BA received from panel <0x4011>
50 08/03/11 14:29:46.158 luup_log:21: POWERMAX: 0A received from panel <0x4011>
02 08/03/11 14:29:49.248 UPnPCallbackEventHandler 4 start PIDLOG2 17718 <0x2009>
02 08/03/11 14:29:49.252 UPnPCallbackEventHandler 4 start PIDLOG2 17719 <0x240a>
02 08/03/11 14:29:49.254 UPnPCallbackEventHandler 4 start PIDLOG2 17719 <0x240a>
02 08/03/11 14:29:49.257 UPnPCallbackEventHandler 4 start PIDLOG2 17719 <0x240a>
02 08/03/11 14:29:49.250 UPnPCallbackEventHandler 4 start PIDLOG2 17718 <0x2009>
02 08/03/11 14:29:53.924 UPnPCallbackEventHandler 4 start PIDLOG2 17719 <0x240a>
02 08/03/11 14:29:53.934 UPnPCallbackEventHandler 4 start PIDLOG2 17718 <0x2009>
02 08/03/11 14:29:53.944 UPnPCallbackEventHandler 4 start PIDLOG2 17719 <0x240a>
02 08/03/11 14:29:53.954 UPnPCallbackEventHandler 4 start PIDLOG2 17718 <0x2009>
02 08/03/11 14:29:53.964 UPnPCallbackEventHandler 4 start PIDLOG2 17719 <0x240a>
02 08/03/11 14:29:53.974 UPnPCallbackEventHandler 4 start PIDLOG2 17718root@MiOS:/tmp/log/cmh#

Your serial communication definitely works.

An AB PDU is sent at the start to the panel and it responds as expected with a 02 43 BA which is the ACK (it just says unknown PDU as I do not know what the ACK message means in detail).

50   08/03/11 14:29:46.115   luup_log:21: POWERMAX: sending AB PDU for init  <0x402>
50   08/03/11 14:29:46.152   luup_log:21: POWERMAX: start of new PDU detected <0x4011>
50   08/03/11 14:29:46.154   luup_log:21: POWERMAX: unknown PDU of type 02 detected <0x4011>
50   08/03/11 14:29:46.155   luup_log:21: POWERMAX: 43 received from panel <0x4011>
50   08/03/11 14:29:46.157   luup_log:21: POWERMAX: BA received from panel <0x4011>
50   08/03/11 14:29:46.158   luup_log:21: POWERMAX: 0A received from panel <0x4011>

When you now move in front of a movement sensor (or disarm the system with a keyfob) other messages should appear. See if these show up in the logfile.

As I remember correctly my code creates a special logfile in /var/log/cmh/powermax_pdu where it should log all incoming messages as well.

Sorry no additional messages when a sensor trick and no log file by name powermax_pdu

Concerning the verbose logging where do I enable that?