Powermax binding

Just test the 1.x Powermax binding on openHAB 2 - it should work right away. So no need to stick with openHAB 1, only because you are using bindings from it!

Kai, doesn’t the author of the binding say above there’s an incompatibility with OH2?

@dan12345, You are right, I should have read the whole thread more carefully.

@Lolodomo If you think your code is ok and it it works well on openHAB 1, feel free to create an issue at openHAB 2 describing the problem. It can very well be that there is a bug in the compatibility layer, which I would have to fix.

Initial tests has shown that the binding connects, but does not communicate very well since it complains about the CRC checksum calculations. First I had a RPi with ser2net in between, and then I tried to directly connect the serial cable to the OH-server (via a USB-to-RS232 adapter).

Still trying to get my head around it!

Ah, I got it started! Previously when I ran my code I was able to have the PowerLink2 module attached as well - but now I had to remove it in order to get the messages to be handled correctly. I made a lot of trial and errors, so I am not 100% sure that this actually was the succeeding factor, but so I guess!

Hi Kai.

I already tried to start the discussion about this issue by opening 2 topics:

But I got no answer !

I thought about a workaround to this bug, consisting in calling ItemRegistry.getItem to know if an item already exists before pushing an update for it. I will delay the update if the item does not yet exist…

@scurb: yes, you are right, you cannot have the Powerlink2 activated at the same time.
Let me know what are your remaining problems.

And sorry for the delay but I have to find time to publish my current version. It would be easy to attach the jar file but you absolutely need all the explanations.
My version is now emulating powerlink2 mode, I think (but I am not sure) that the jar I provided was without this feature.

Yep, I know I have read this before, but I was still able to use a serial connection from my java code. Though - I did not manage to get the crc routine implemented correctly - now I know why :wink:

I’m running in test mode and actually have no other things to say than your binding seems to work really fine! Good work!

It sounds like you are rewriting the binding to emulate the Powerlink2 module - what will be the benefit of this?

Best regards, Patrik!

Ok, great - sorry that they missed to get my attention. I will follow up on them now.

@Lolodomo, I have a question regarding how the alarm triggering is noticed. Right now, I have an item with name “Powermax_partition_alarm” which has the item bound to {powermax=“partition_alarm”}. When I have armed my house and left the building then I must open the door (which has a entry delay configured) and then enter my pin code in the keypad on the wall. Although, now I get the “Powermax_partition_alarm” set to ON directly when I open the front door. It seems like it does not care about the entry delay, and because of that triggering the alarm to be executed.

Have I misunderstood something in the configuration?

Best regards, Patrik

@Patrik: I tested today and you’re right, the item switches to ON as soon as the door is opened.
I think the system considers an alarm event as soon as you open the door, even if it does not trigger the sirens during the entry delay.

But I can certainly change that in the binding because I normally know when the status is “entry delay”.

I let you know when it is fixed.

@scurb: I studied a little more my debug logs and unfortunately the alarm panel does not switch in a “Entry delay” arm mode when you open the door but remains in a “armed” mode. So I get an alarm event (door opened) with no way to identify if it is during the entry delay or not.
That is a little strange because there is an “Exit delay” mode when we arm the alarm.

One solution may be using rather “panel_alert_in_memory”. It is set only when the entry delay expires. But I think it remains ON even after disarming. Not exactly what we are looking for.

Last option would be to consider events logged in the panel. That is something that I don’t handle yet, even in my own version. But I will try to add this new feature. That is how sirens state is managed in the Vera plugin too.

I’ve a couple of rules dealing with this:

1 - runs if panel_alert_in_memory changes from OFF to ON. If Powermax_partition_alarm is ON then turns a virtual switch “alarm” to ON
2 - runs if Powermax_partition_alarm changes from ON to OFF - turns the virtual switch “alarm” to OFF; turns panel_alert_in_memory to OFF; turns another virtual switch “alert in memory” to ON

Dan

Oh yes you’re right I should probably set alarm only when alarm_in_memory is set too.
If I correctly remember, we have to arm again the system to reset alarm_in_memory flag from the panel ?

that’s right

Hi @Lolodomo!

From the beginning, I wrote a connector in Delphi, from which I successfully triggered burglary and fire alarms when they occured. Unfortunatly I’m not able to verify it now, but from what I can remember, it worked :slight_smile: I would gladly send you an email with the complete procedure/function that was used to parse the incoming package, but here goes the part that checked whether the correct bit values was set, and if it should trigger:

            if (pmEvent.SystemStatus=ssArmedAway) and (pmEvent.ZoneEventType in [zeOpen, zeViolatedMotion]) then
                SendToMQTTBus('home/alarm/burgular', 'ON');

            if (pmEvent.ZoneEventType in [zeFireAlarm]) then
                SendToMQTTBus('home/alarm/fire', 'ON');

Don’t know if this can help you?

I finally fixed opehHAB2 compatibilty and “alarm active” status during the entry delay. I still have to trigger the alarm to be sure that it is working fully (will be done in a more appropriate moment).

Then I will compile minimal documentation (configuration file, items and sitemap examples) in this topic and attach the new JAR file.

New configuration for the binding:

################################### PowerMax Binding ##################################

# the serial port to use for connecting to the PowerMax alarm system
# e.g. COM1 for Windows and /dev/ttyS0 or /dev/ttyUSB0 for Linux
powermax:serialPort=COM1

# the IP address and port to use for connecting to the PowerMax alarm system
#powermax:ip=
#powermax:tcpPort=

# The delay in minutes to reset a motion detection (optional, defaults to 3)
#powermax:motionOffDelay=3

# Enable or disable arming the PowerMax alarm system from openHAB
# For security reason, this feature is disabled by default (false)
#powermax:allowArming=false

# Enable or disable disarming the PowerMax alarm system from openHAB
# For security reason, this feature is disabled by default (false)
#powermax:allowDisarming=false

# The PIN code to use for arming/disarming the PowerMax alarm system from openHAB
# Not required except when Powerlink mode cannot be used
#powermax:pinCode=

# Force the standard mode rather than trying using the Powerlink mode
# (optional, defaults to false)
#powermax:forceStandardMode=false

Items examples:

Group GPowerMax "Alarm"

String Powermax_panel_type "Panel type [%s]" (GPowerMax) {powermax="panel_type"}
String Powermax_panel_eeprom "EPROM [%s]" (GPowerMax) {powermax="panel_eprom"}
String Powermax_panel_software "Software version [%s]" (GPowerMax) {powermax="panel_software"}
String Powermax_panel_serial "Serial [%s]" (GPowerMax) {powermax="panel_serial"}
String Powermax_panel_mode "Panel mode [%s]" (GPowerMax) {powermax="panel_mode"}
String Powermax_partition_status "Partition status [%s]" (GPowerMax) {powermax="partition_status"}
Switch Powermax_partition_ready "Partition ready" (GPowerMax) {powermax="partition_ready", autoupdate="false"}
Switch Powermax_partition_bypass "Partition bypass" (GPowerMax) {powermax="partition_bypass", autoupdate="false"}
Switch Powermax_partition_alarm "Partition alarm" (GPowerMax) {powermax="partition_alarm", autoupdate="false"}
Switch Powermax_panel_trouble "Panel trouble" (GPowerMax) {powermax="panel_trouble", autoupdate="false"}
Switch Powermax_panel_alert_in_mem "Panel alert in memory" (GPowerMax) {powermax="panel_alert_in_memory", autoupdate="false"}
Switch Powermax_partition_armed "Partition armed" (GPowerMax) {powermax="partition_armed", autoupdate="false"}
String Powermax_partition_arm_mode "Partition arm mode [%s]" (GPowerMax) {powermax="partition_arm_mode", autoupdate="false"}

Switch Powermax_zone1_status "Zone 1 status" (GPowerMax) {powermax="zone_status:1", autoupdate="false"}
Contact Powermax_zone1_status2 "Zone 1 status [%s]" (GPowerMax) {powermax="zone_status:1"}
DateTime Powermax_zone1_last_trip "Zone 1 last trip [%1$tH:%1$tM]" (GPowerMax) {powermax="zone_last_trip:1"}
Switch Powermax_zone1_bypassed "Zone 1 bypassed" (GPowerMax) {powermax="zone_bypassed:1", autoupdate="false"}
Switch Powermax_zone1_armed "Zone 1 armed" (GPowerMax) {powermax="zone_armed:1", autoupdate="false"}
Switch Powermax_zone1_low_battery "Zone 1 low battery" (GPowerMax) {powermax="zone_low_battery:1", autoupdate="false"}

Switch Powermax_get_event_log "Event log" (GPowerMax) {powermax="get_event_log", autoupdate="false"}
String Powermax_event_log_1 "Event log 1 [%s]" (GPowerMax) {powermax="event_log:1"}
String Powermax_event_log_2 "Event log 2 [%s]" (GPowerMax) {powermax="event_log:2"}
String Powermax_event_log_3 "Event log 3 [%s]" (GPowerMax) {powermax="event_log:3"}
String Powermax_event_log_248 "Event log 248 [%s]" (GPowerMax) {powermax="event_log:248"}
String Powermax_event_log_249 "Event log 249 [%s]" (GPowerMax) {powermax="event_log:249"}
String Powermax_event_log_250 "Event log 250 [%s]" (GPowerMax) {powermax="event_log:250"}

Switch Powermax_PGM_status "PGM status" (GPowerMax) {powermax="PGM_status", autoupdate="false"}

Switch Powermax_X10_1_status "X10 1 status" (GPowerMax) {powermax="X10_status:1", autoupdate="false"}
String Powermax_X10_1_status2 "X10 1 status [%s]" (GPowerMax) {powermax="X10_status:1", autoupdate="false"}

Sitemap example:

    Text label="Security" icon="lock" {
        Switch item=Powermax_partition_armed mappings=[OFF="Disarmed", ON="Armed"]
        Switch item=Powermax_partition_arm_mode mappings=[Disarmed="Disarmed", Stay="Armed Home", Armed="Armed Away"] valuecolor=[=="Armed"="green",=="Stay"="orange"]
        
        Switch item=Powermax_get_event_log mappings=[ON="Refresh"]
        
        Switch item=Powermax_PGM_status mappings=[OFF="Off", ON="On"]
        Switch item=Powermax_X10_1_status2 mappings=[OFF="Off", ON="On", DIM="Dim", BRIGHT="Bright"]

        Group item=GPowerMax label="Alarm"
    }