Page 1 of 3

Add WiFi to your alarm with esp8266

Posted: Tue Jun 14, 2016 10:23 pm
by irekz
Wrote a C++ library that can communicate with PowerMax alarms (based on excellent code and articles found here).
First use for this library is to add WiFi capability to PM for less than 5£ using Wemos D1 ESP8266 board.

Here are some highlights:
- ESP8622 can be connected to serial interface of PM alarm, powered from 12V rail, and hidden inside (no wires!)
- No other dependencies, no need for a PC or raspberry Pi
- You have access to ESP8622 sketch source code, and can flash updates to the ESP firmware via WiFi (no need for opening the PM)

ESP8622 can work in two modes:
- stand alone: (where device acts like a powerlink, actively communicating with alarm)
In this mode it exposes a telnet and simple web interface, via telnet you can arm/disarm system etc.
- transparent packet relay: in this mode ESP will not interpret packets, will simply pass all traffic from remote app to the alarm.
This mode is used by Windows command line application - that you can build, modify etc.

Code status:
- ready to play with for DEVELOPERS (people who can read, modify code)
- minimal to no security (anyone on wifi network can talk to alarm, it's up to you to implement something more suitable)
- I will be working on improvements to the code and possibly will implement simple authentication etc

More details and source code:
https://github.com/irekzielinski/PowerMaxAlarm

I'm looking forward for you guys to contribute to the project!
Cheers,
Irek

ps. If you have any issues with the code, it might be faster for your to raise those directly on GitHub:
https://github.com/irekzielinski/PowerMaxAlarm/issues

Re: Add WiFi to your alarm with esp8266

Posted: Thu Jun 16, 2016 9:38 am
by Bwired
Nice!

Re: Add WiFi to your alarm with esp8266

Posted: Thu Jun 16, 2016 1:02 pm
by Phaeton
Awesomely done!

Re: Add WiFi to your alarm with esp8266

Posted: Thu Jun 16, 2016 1:48 pm
by Mario from Spain
That's fantastic!

Re: Add WiFi to your alarm with esp8266

Posted: Mon Jul 25, 2016 11:16 pm
by retiredtech
Irek,
I recently came across your project for connecting to the Visonic Powermax via WiFi and was immediately interested. I have had a Powermax + operational for 8 years and have been looking into using the Raspberry Pi as an interface. I am more interested in your approach so decided to see if I could get your code installed and running for a test. I have the WeMos esp8266 installed and operational and running other sketches but when I try to verify/compile your code I get all kinds of errors. First, please understand I am not a software coder of either C++ or Python so I am starting at a real disadvantage. The first error is that it cannot find the Pmax.h file which I have put in multiple folders. So I removed that #include to see how far I could get but there are multiple other errors so I gave up. So, either I have done something completely wrong or your code is just not ready to be sent to the esp8266 yet.
Would appreciate some guidance....

Richard

Re: Add WiFi to your alarm with esp8266

Posted: Tue Jul 26, 2016 10:39 am
by Botap
Hi,

I am trying to make this work on my PowerMax Pro, but I am facing a few issues and I hope you will be able to help me with this:
1. When compiling the sketch I am getting following error:
sketch/pmax.cpp:1650: undefined reference to `os_getLocalTime(unsigned char&, unsigned char&, unsigned char&, unsigned char&, unsigned char&, unsigned char&)'

When I remove the os_getLocalTime from the pmax.cpp file I can compile the sketch and load it to the WeMos board.

After that I can connect succesful to the board via Telnet and/or the windows application and I can see a lot of information by pressing r
But when trying to (a)rm or (d)isarm nothing happens.
Also when trying to read the signal strength for instance I get an access denied error:
!
[5][KeyPressHandling @ 104] Get zone signal strength
[6][serialHandler @ 34] --- new packet 16:08:36 ----
[6][PowerMaxAlarm::handlePacket @ 1739] Command found: 'Acknowledgement 2'
[6][serialHandler @ 34] --- new packet 16:08:36 ----
[6][PowerMaxAlarm::handlePacket @ 1739] Command found: 'Access denied'
[6][PowerMaxAlarm::OnAccessDenied @ 1254] Access denied
[6][serialHandler @ 34] --- new packet 16:08:37 ----
[6][PowerMaxAlarm::handlePacket @ 1739] Command found: 'Acknowledgement 2'

I am not sure if this is due to the fact I had to remove the os_getLocalTime function from the sketch?

Any help will be very much appreciated as this is a very interesting project
Regards
Bart

Re: Add WiFi to your alarm with esp8266

Posted: Mon Aug 01, 2016 10:30 am
by irekz
retiredtech wrote:Irek,
The first error is that it cannot find the Pmax.h file which I have put in multiple folders. So I removed that #include to see how far I could get but there are multiple other errors so I gave up. So, either I have done something completely wrong or your code is just not ready to be sent to the esp8266 yet.
Would appreciate some guidance....
Richard
Hi Richard.
Directory structure needs to be the same as in Github:

c:\yourArduinoFolder\Libraries\PMax
c:\yourArduinoFolder\PowerMaxEsp8266

Check this link for more information:
https://www.arduino.cc/en/Guide/Libraries#toc5

I would also expect "c:\yourArduinoFolder\" to be listed in settings as "sketchbook location":
http://www.alanzucconi.com/wp-content/u ... 0/ard2.png

Please let me know if it works for you.
Kind regards,
Irek

Re: Add WiFi to your alarm with esp8266

Posted: Mon Aug 01, 2016 10:34 am
by irekz
Botap wrote:Hi,
1. When compiling the sketch I am getting following error:
sketch/pmax.cpp:1650: undefined reference to `os_getLocalTime(unsigned char&, unsigned char&, unsigned char&, unsigned char&, unsigned char&, unsigned char&)'

When I remove the os_getLocalTime from the pmax.cpp file I can compile the sketch and load it to the WeMos board.
This has been fixed on github.

Botap wrote: [5][KeyPressHandling @ 104] Get zone signal strength
[6][serialHandler @ 34] --- new packet 16:08:36 ----
[6][PowerMaxAlarm::handlePacket @ 1739] Command found: 'Acknowledgement 2'
[6][serialHandler @ 34] --- new packet 16:08:36 ----
[6][PowerMaxAlarm::handlePacket @ 1739] Command found: 'Access denied'
[6][PowerMaxAlarm::OnAccessDenied @ 1254] Access denied
[6][serialHandler @ 34] --- new packet 16:08:37 ----
[6][PowerMaxAlarm::handlePacket @ 1739] Command found: 'Acknowledgement 2'
We had number of email exchanges outside this forum.
The original code was developed on PowerMax Complete system that supports auto-enrollment.
With Bart help I have much better understanding of older units and will update code on Github soon to support manual enrollment.

Kind regards,
Irek

Re: Add WiFi to your alarm with esp8266

Posted: Tue Aug 02, 2016 5:38 pm
by retiredtech
irekz wrote:
retiredtech wrote:Irek,
The first error is that it cannot find the Pmax.h file which I have put in multiple folders. So I removed that #include to see how far I could get but there are multiple other errors so I gave up. So, either I have done something completely wrong or your code is just not ready to be sent to the esp8266 yet.
Would appreciate some guidance....
Richard
Hi Richard.
Directory structure needs to be the same as in Github:

c:\yourArduinoFolder\Libraries\PMax
c:\yourArduinoFolder\PowerMaxEsp8266

Check this link for more information:
https://www.arduino.cc/en/Guide/Libraries#toc5

I would also expect "c:\yourArduinoFolder\" to be listed in settings as "sketchbook location":
http://www.alanzucconi.com/wp-content/u ... 0/ard2.png

Please let me know if it works for you.
Kind regards,
Irek

Irek,
Yes, your instructions worked perfectly.....thank you!
Richard

Re: Add WiFi to your alarm with esp8266

Posted: Wed Aug 03, 2016 10:03 am
by irekz
retiredtech wrote: Irek,
Yes, your instructions worked perfectly.....thank you!
Richard
Cool :-)
I described this procedure on GitHub:
https://github.com/irekzielinski/PowerM ... MaxEsp8266

If you have any issues, don't hesitate to contact me or raise it via:
https://github.com/irekzielinski/PowerMaxAlarm/issues

Cheers,
Irek

Re: Add WiFi to your alarm with esp8266

Posted: Fri Aug 05, 2016 8:21 pm
by retiredtech
Irek,
My Powermax is the + (plus) series and as a result your diagram showing connection of the esp8266 to the RS232 port is incorrect. My connection has 12 pins on it instead of 10. Before I continue on I need to make sure your code will run on the esp8266 connected to the Powermax+? I will find the correct pins for the Tx, Rx and Gnd on my 12 pin plug so that won't be a problem.

Richard

Re: Add WiFi to your alarm with esp8266

Posted: Tue Aug 09, 2016 10:55 am
by irekz
retiredtech wrote:Irek,
My Powermax is the + (plus) series and as a result your diagram showing connection of the esp8266 to the RS232 port is incorrect. My connection has 12 pins on it instead of 10. Before I continue on I need to make sure your code will run on the esp8266 connected to the Powermax+? I will find the correct pins for the Tx, Rx and Gnd on my 12 pin plug so that won't be a problem.
Richard
Hi Richard.
Code should work with Powermax+. If you will get the pinout for your alarm - maybe you can draw a diagram - I will add it to guthub.
Thanks,
Irek

Re: Add WiFi to your alarm with esp8266

Posted: Tue Aug 09, 2016 6:24 pm
by retiredtech
Irek,
I found the RS-232 pin-out for the Powermax+ at: http://www.domoticaforum.eu/viewtopic.p ... =45#p63022.
Richard

Re: Add WiFi to your alarm with esp8266

Posted: Fri Sep 02, 2016 10:42 am
by ayasystems
Great work!!!

I'm using WR703N with viknet powermax code (pmaxd) from some years ago... (last mod done by me here-> http://www.domoticaforum.eu/viewtopic.p ... 373#p80373 )

I will try your code with my test (non production powermax)

Witch features are you implemented on web server?

Could you post some screenshoots?

Best regards!!!!

Re: Add WiFi to your alarm with esp8266

Posted: Wed Sep 07, 2016 10:21 am
by irekz
ayasystems wrote:Witch features are you implemented on web server?
Could you post some screenshoots?
Sorry for the delay in response. I have been on holiday.
Web server allows to query state of the system (it outputs a JSON page).
To control the system - a telnet interface is exposed.

All of this can be easily modified to suit your needs.
Kind regards,
Irek