Add WiFi to your alarm with esp8266

Forum about Visonic products like Powermax Plus and Powermax Pro

Moderators: Rene, Willem4ever

Re: Add WiFi to your alarm with esp8266

Postby irekz » Wed Sep 07, 2016 9:22 am

retiredtech wrote:Irek,
I found the RS-232 pin-out for the Powermax+ at: viewtopic.php?f=68&t=6581&start=45#p63022.
Richard



Thanks Richard.
I will add this information to the github!

Cheers,
Irek
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby irekz » Fri Sep 09, 2016 8:08 am

retiredtech wrote:Irek,
I found the RS-232 pin-out for the Powermax+ at: viewtopic.php?f=68&t=6581&start=45#p63022.
Richard


BTW. I have been working with other user that has Powermax+ and for this panel to work you need this modification in source code (code in red needs to be added):

void PowerMaxAlarm::OnAck(const PlinkBuffer * Buff)
{
if(this->m_lastSentCommand.size == 12 &&
this->m_lastSentCommand.buffer[0] == 0xAB &&
this->m_lastSentCommand.buffer[1] == 0x0A &&
this->m_lastSentCommand.buffer[3] == 0x01)
{
//we got an ack for Pmax_INIT command, this on PowerMax+ can take some time, we need to pause execution before issuing any new commands
os_usleep(10 * 1000000); //sleep for 9 seconds
}


if(this->m_lastSentCommand.size == 1 &&
this->m_lastSentCommand.buffer[0] == 0x0F) //Pmax_DL_EXIT
{
//we got an ack for exit from dload mode:
this->m_bDownloadMode = false;
//this will be false for the first Pmax_DL_EXIT that is called from Init()
if(this->m_bEnrolCompleted)
{
#ifdef _MSC_VER
saveMapToFile("main.map", &this->m_mapMain);
saveMapToFile("ext.map", &this->m_mapExtended);
#endif
this->processSettings();
//after download is complete, we call restore - this will get other important settings, and make sure panel is happy with comms
this->sendCommand(Pmax_RESTORE);
}
//re-starting keep alive timer
this->startKeepAliveTimer();
}
}


I will investigate if there is a cleaner way of doing it, and push fix to Github. In a meantime just apply the path.
This should give you full PM+ functionality (without it code will fail to download the PIN from the alarm).

Cheers,
Irek
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby passy » Sat Dec 03, 2016 7:13 pm

Hi Irek,

I followed your clear instructions for my Powermax+ and I am able to connect my WeMos D1 board via wifi. However, when I am running PowerMax.exe, I don't think the handshake with the Powermax+ happens (the last message in the log is PC [17:39:18]0x0D,0x24,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x0A [DLOAD START]). I did the Powerlink enrolment and got a beep after the instalation was complete (but I get the same beep if the board is not connected).

Do you have any troubleshooting advice for me?

Cheers,

Passy
passy
Starting Member
Starting Member
 
Posts: 4
Joined: December 2016

Re: Add WiFi to your alarm with esp8266

Postby irekz » Thu Dec 08, 2016 7:00 pm

passy wrote:Hi Irek,

I followed your clear instructions for my Powermax+ and I am able to connect my WeMos D1 board via wifi. However, when I am running PowerMax.exe, I don't think the handshake with the Powermax+ happens (the last message in the log is PC [17:39:18]0x0D,0x24,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x0A [DLOAD START]). I did the Powerlink enrolment and got a beep after the instalation was complete (but I get the same beep if the board is not connected).

Do you have any troubleshooting advice for me?

Cheers,

Passy


Hi Passy.
I don't have Powermax+ but some member reported success with this board type - and maybe will be able to help.
Can you attach whole log from PowerMax.exe?

Kind regards,
Irek
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby passy » Sat Dec 10, 2016 10:18 am

Hi Irek,

Thanks for your reply. I think my issue is the Powerlink enrolment as I am getting a beep but a long one which according to the documentation is a failure. I follow the enrolment procedure for Powermax+ but maybe I am missing something. Do I need to do anything on the Wemos D1 board side before selecting "Install Powerlink" from the installer menu?

I have double checked my wiring it seems OK but I do not know how to check that the RX/TX pins are not faulty on My Wemox board.

Here is the full log:
PC [20:44:57]0x0D,0x0F,0xF0,0x0A [DLOAD EXIT]
PC [20:44:57]0x0D,0xAB,0x0A,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x06,0x0A [INIT]
PC [20:44:58]0x0D,0x24,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x0A [DLOAD START]

Passy
passy
Starting Member
Starting Member
 
Posts: 4
Joined: December 2016

Re: Add WiFi to your alarm with esp8266

Postby ayasystems » Sun Dec 11, 2016 1:46 am

Did you change the power max master pin?

The library has the pin if your panel has another pin it will not work
ayasystems
Starting Member
Starting Member
 
Posts: 39
Joined: May 2014

Re: Add WiFi to your alarm with esp8266

Postby passy » Sun Dec 11, 2016 6:15 pm

ayasystems wrote:Did you change the power max master pin?

The library has the pin if your panel has another pin it will not work


I did a factory reset and I have not changed any of the default code.

In pmax.h, I can see "#define POWERLINK_PIN 0x3622;" and it says it does not have to match user (default 1111) or installer (default 9999).

Is there another code to set on the Powermax+?

Passy
passy
Starting Member
Starting Member
 
Posts: 4
Joined: December 2016

Re: Add WiFi to your alarm with esp8266

Postby irekz » Thu Dec 15, 2016 9:24 pm

passy wrote:Here is the full log:
PC [20:44:57]0x0D,0x0F,0xF0,0x0A [DLOAD EXIT]
PC [20:44:57]0x0D,0xAB,0x0A,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x06,0x0A [INIT]
PC [20:44:58]0x0D,0x24,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x0A [DLOAD START]
Passy


Hi. This log does not look correct - as I don't see ANY response from the board at all.
This is what I get in PM Complete:

PC [20:19:44]0x0D,0x0F,0xF0,0x0A [DLOAD EXIT]
PM [20:19:44]0x0D,0x02,0xFD,0x0A [ACK]
PC [20:19:45]0x0D,0xAB,0x0A,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x06,0x0A [INIT]
PM [20:19:45]0x0D,0x02,0x43,0xBA,0x0A [ACK]
PC [20:19:57]0x0D,0x24,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x0A [DLOAD START]
PM [20:19:57]0x0D,0x02,0xFD,0x0A [ACK]
PM [20:19:57]0x0D,0x08,0xF7,0x0A [ACCESS DENIED]
PM [20:19:57]0x0D,0xAB,0x0A,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x06,0x0A [INIT]
PC [20:19:58]0x0D,0xAB,0x0A,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x43,0xAE,0x0A [ENROL REQ]

PM [20:19:58]0x0D,0x02,0x43,0xBA,0x0A [ACK]
PM [20:19:58]0x0D,0xAB,0x03,0x00,0x1E,0x00,0x32,0x30,0x32,0x30,0x00,0x00,0x43,0x2B,0x0A [PING]
PC [20:19:58]0x0D,0x02,0x43,0xBA,0x0A [ACK]
PC [20:19:58]0x0D,0x24,0x00,0x00,0x36,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x0A [DLOAD START]
PM [20:19:59]0x0D,0x02,0xFD,0x0A [ACK]
PM [20:19:59]0x0D,0x3C,0xFD,0x0A,0x00,0x00,0x0E,0x05,0x01,0x00,0x00,0x00,0xA7,0x0A
PC [20:19:59]0x0D,0x02,0xFD,0x0A [ACK]
PC [20:19:59]0x0D,0x3E,0x00,0x04,0x20,0x00,0xB0,0x00,0x00,0x00,0x00,0x00,0xEC,0x0A [Pmax_DL_PANELFW]
PM [20:19:59]0x0D,0x02,0xFD,0x0A [ACK]
PM [20:19:59]0x0D,0x3F,0x00,0x04,0x20,0x4A,0x2D,0x37,0x30,0x31,0x33,0x33,0x34,0x20,0x76,0x32,0x2E,0x30,0x2E,0x32,0x31,0x4A,0x53,0x37,0x30,0x31,0x31,0x31,0x39,0x20,0x76,0x32,0x2E,0x30,0x2E,0x32,0x30,0xAF,0x0A [DLOAD INFO(DATA)]
PC [20:19:59]0x0D,0x02,0xFD,0x0A [ACK]
PC [20:20:00]0x0D,0x3E,0x30,0x04,0x08,0x00,0xB0,0x00,0x00,0x00,0x00,0x00,0xD4,0x0A [Pmax_DL_SERIAL]
PM [20:20:00]0x0D,0x02,0xFD,0x0A [ACK]
PM [20:20:00]0x0D,0x3F,0x30,0x04,0x08,0x46,0x09,0x02,0x74,0x81,0xFF,0x0E,0x05,0x2A,0x0A [DLOAD INFO(DATA)]
PC [20:20:00]0x0D,0x02,0xFD,0x0A [ACK]
PC [20:20:00]0x0D,0x3E,0x00,0x19,0x00,0x02,0xB0,0x00,0x00,0x00,0x00,0x00,0xF5,0x0A [Pmax_DL_ZONESTR]
PM [20:20:01]0x0D,0x02,0xFD,0x0A [ACK]
.....

But the most important thing is that you should get response from PM. Double check the wiring, maybe TX/RX is not connected correctly?

Cheers,
Irek

ps. NOTE: Section in bold will be different in Power Master (as this board does not support enrolment).
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby passy » Sat Dec 17, 2016 5:52 pm

Hi Irek,

You were correct it was my wiring.

Thanks a lot for your help!

Passy
passy
Starting Member
Starting Member
 
Posts: 4
Joined: December 2016

Re: Add WiFi to your alarm with esp8266

Postby irekz » Sun Dec 18, 2016 10:01 pm

passy wrote:Hi Irek,
You were correct it was my wiring.
Thanks a lot for your help!
Passy


Hi Passy.
Let me know if all works correctly on your Powermax+?
Any changes to the code required?, if yes - would love to hear what's needs to be updated so other users can benefit.

Cheers,
Irek
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby bruce_miranda » Sun Feb 26, 2017 1:57 pm

I was halfway through doing this exact same project but instead using a Particle Photon. A much smaller board, which runs on 5V or 3.3V. This is a great starting position.
bruce_miranda
Starting Member
Starting Member
 
Posts: 21
Joined: April 2014

Re: Add WiFi to your alarm with esp8266

Postby cjcharles » Thu Mar 02, 2017 12:24 am

Thank you so much @irekz , this is absolutely fantastic and an amazing achievement!

I am currently trying to modify this library for use with Samsung SmartThings (a smart home controller) since I can then use the PIR sensors to trigger lights, whilst also reacting to alarm events. I am a newcomer to Python but have done bits of coding in my past, so Im currently trying to understand what is going on. Thankfully your comments are good, but Im wondering if you can help me understand the different between OnStatusUpdatePanel and OnStatusChange?

The Change event has sub functions which are great to integrate with since I can get an event fire when the alarm arms/disarms/...etc. However they both seem to support this functionality....

Also I think the OnStatusUpdatePanel is the only function which would support zone events (i.e. Zone_4 change from Open to Close), however I will need to modify the CPP file in order to do this (by adding some function calls in these case statements), I think.... Can you correct me if I am wrong?
cjcharles
Starting Member
Starting Member
 
Posts: 10
Joined: April 2016

Re: Add WiFi to your alarm with esp8266

Postby irekz » Wed Mar 08, 2017 7:41 pm

bruce_miranda wrote:I was halfway through doing this exact same project but instead using a Particle Photon. A much smaller board, which runs on 5V or 3.3V. This is a great starting position.


Hi. If Wemos D1 is too big for you - you can also use Wemos D1 Mini.
I used D1 as it has a build in voltage regulator and can take 12V, Mini would need a buck converter or regulator to step down from 12V to 3.3V.
I used D1 Minis in many projects - great little wifi boards.

Cheers,
Irek
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby irekz » Wed Mar 08, 2017 7:52 pm

cjcharles wrote:Thank you so much @irekz , this is absolutely fantastic and an amazing achievement!

Pleasure!

cjcharles wrote:I am currently trying to modify this library for use with Samsung SmartThings (a smart home controller) since I can then use the PIR sensors to trigger lights, whilst also reacting to alarm events. I am a newcomer to Python but have done bits of coding in my past, so Im currently trying to understand what is going on. Thankfully your comments are good, but Im wondering if you can help me understand the different between OnStatusUpdatePanel and OnStatusChange?

The Change event has sub functions which are great to integrate with since I can get an event fire when the alarm arms/disarms/...etc. However they both seem to support this functionality....



OnStatusChange: is fired when mayor change happens in the panel (like arm/disarm/alarm/etc).
OnStatusUpdatePanel: is fired for less important events (like zone events).

So I would start with OnStatusChange, or even easier use those APIs:

Code: Select all
    //Fired when system enters armed state
    //armType     : 0x51 = "Arm Home", 0x53 = "Quick Arm Home", 0x52 = "Arm Away", 0x54 = "Quick Arm Away"
    //armTypeStr  : text representation of arming method
    //whoArmed    : specifies who armed system (for example a keyfob 1), values from PmaxEventSource
    //whoArmedStr : text representation of who armed
    virtual void OnSytemArmed(unsigned char armType, const char* armTypeStr, unsigned char whoArmed, const char* whoArmedStr){};

    //Fired when system enters disarmed state
    //whoDisarmed    : specifies who disarmed system (for example a keyfob 1), values from PmaxEventSource
    //whoDisarmedStr : text representation of who disarmed
    virtual void OnSytemDisarmed(unsigned char whoDisarmed, const char* whoDisarmedStr){};

    //Fired when system enters alarm state
    //alarmType      : type of alarm, first 9 values from PmaxLogEvents
    //alarmTypeStr   : text representation of alarmType
    //zoneTripped    : specifies zone that initiated the alarm, values from PmaxEventSource
    //zoneTrippedStr : zone name
    virtual void OnAlarmStarted(unsigned char alarmType, const char* alarmTypeStr, unsigned char zoneTripped, const char* zoneTrippedStr){};

    //Fired when alarm is cancelled
    //whoDisarmed    : specifies who cancelled the alarm (for example a keyfob 1), values from PmaxEventSource
    //whoDisarmedStr : text representation of who disarmed
    virtual void OnAlarmCancelled(unsigned char whoDisarmed, const char* whoDisarmedStr){};



cjcharles wrote:Also I think the OnStatusUpdatePanel is the only function which would support zone events (i.e. Zone_4 change from Open to Close), however I will need to modify the CPP file in order to do this (by adding some function calls in these case statements), I think.... Can you correct me if I am wrong?


Don't modify pmax.cpp file, Instead in your own cpp file - derive a class from PowerMaxAlarm, override those and handling code (do something useful).
Example how to do this is in this file:
https://github.com/irekzielinski/PowerM ... sp8266.ino

Cheers,
Irek
irekz
Starting Member
Starting Member
 
Posts: 26
Joined: June 2016

Re: Add WiFi to your alarm with esp8266

Postby cjcharles » Wed Mar 22, 2017 10:43 am

Thank you for all your help with this. Im getting there and have built a few functions to return alarm status to my Smartthings Hub which is really cool.

The only problem I am having at the moment is the fact that the alarm has a continuous 'communications failure' error message. I cant seem to be able to clear it by blanking out the IP address/phone number/... inside the installer menu, but this happened from when I first unplugged the Powerlink and swapped to the ESP8266. Is there another setting I am missing, such that the alarm still thinks something is broken, when in reality it is working fine. I could do a reset to factory defaults but Im not massively keen to do so!

Thanks again
cjcharles
Starting Member
Starting Member
 
Posts: 10
Joined: April 2016

PreviousNext

Return to Visonic Alarm systems

Who is online

Users browsing this forum: No registered users and 1 guest

cron