More Powerlink2 stuff

Another “HowStuffWorks” post 😉

Changing the alarm state of a Visonic Powermax Pro with the Powerlink2 was fun, but there’s more. The Powerlink web interface also shows the Control Panel status:

Visonic Control Panel status

And, if there are any sensors that prevent the alarm from being armed they’re shown here too. Wouldn’t it be nice to obtain that information in a usable form, so it can be used in our own apps? (everything is called an “app” these days, right)  Stuff like the current status, sensor information and such? Gotta have it! Here we go…

I started a browser, Fiddler and logged in on the Powerlink 2 mobile interface and saw these periodic calls being made:

GET  HTTP/1.1 Accept: */* Accept-Language: nl
Referer:
Content-Type: application/octet-stream
Accept-Encoding: gzip, deflate
User-Agent: blabla
Host: xx.xx.xx.200
Connection: Keep-Alive
Cookie: PowerLink=43e66dc8f6485151c9179d40b0e1831f; mobile=802fece964ec8e77ca2e533d479cc93f

Quite easy to mimic. So I did and logged the responses:

{ "id": "1", "js": { "reply": { "index": "24", "configuration": { "sensors": [ { "name": "Sensor", "index": "1", "type": "Delay 1", "location": "Front Door" }, { "name": "Sensor", "index": "2", "type": "Perimeter-Follow" , "location": "Hall" } ], "system": { "name": "Control Panel", "disarm": [  ], "status": "Ready", "arm": "0", "latchkey_enable": "Latchkey Enable", "ip_mode": "dynamic", "ip": "xx.xx.xx.200", "subnet": "255.255.255.0", "gateway": "xx.xx.xx.60", "dns1": "xx.xx.xx.1" } }, "alarms": [  ], "alarmframetimes": [  ] } }, "text": "" }

This is the ‘initial’ response, as in the first response we get to the request shown above. Here we see the sensors, their index number (needed later on), type and location and we also see the Control Panel status: Ready. OK; lets see what the response is made of when we repeat the same request a few times:

{ "id": "1", "js": { "reply": [  ] }, "text": "" }

Few seconds later another request, response is still the same:

{ "id": "1", "js": { "reply": [  ] }, "text": "" }

Nothing changes. Let’s open the Hall sensor (no, not this one, but a regular MCT-302) :

{ "id": "1", "js": { "reply": { "index": "25", "update": { "sensors": [ { "index": "1" }, { "index": "2", "status": "Open" } ], "system": { "not_ready": [  ], "disarm": [  ], "status": "Not Ready", "arm": "0" } } } }, "text": "" }

Aha! The sensor with index 2 changed to status “Open” and the Control Panel Status changed to “Not ready”. On the Powermax LCD display I see: HALL OPEN. Yep, the Control Panel is showing the right text; it’s working 😉

Next response, with the Hall sensor still open:

{ "id": "1", "js": { "reply": [  ] }, "text": "" }

And again…

{ "id": "1", "js": { "reply": [  ] }, "text": "" }

Time to close the sensor again, now I get this:

{ "id": "1", "js": { "reply": { "index": "26", "update": { "sensors": [ { "index": "1" }, { "index": "2" } ], "system": { "disarm": [  ], "status": "Ready", "arm": "0" } } } }, "text": "" }

No more “problem sensors” and the Control Panel is back to “Ready”. Also notice this index number increasing with every change (24, 25, 26…). Track this one in your software and use it in the subsequent requests you do. If you don’t, you’re gonna miss all the information you want…

And as expected, the next responses are:

{ "id": "1", "js": { "reply": [  ] }, "text": "" }
{ "id": "1", "js": { "reply": [  ] }, "text": "" }

With this information it should be relatively easy to create a driver for it and use the provided information for whatever you want.

I also added the quick&dirty example code I used while playing with the Powerlink 2. Now I’m gonna find me a large firm cardboard box, put the Powermax Pro in it and send it back to Pieter. I’m sure he’ll want to start using it by now!

Next!

Tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *