Powermax binding

OK, I’ve reminded myself how I turned off the beeps:

From the panel: installer mode -> define panel -> 11 trouble beeps

then this can be disable beeps, enable beeps, off at night. I have it disabled.

Have I just saved your marriage?

I think I’m forever indebted to you lol.

Thanks Dan

Thanks @BigCol that would be great.

Didn’t get chance to mess around with it last weekend, hoping I have some time this weekend.

I have a PowerMax Pro Part with partitions disabled. When I toggle the switch get_event_log it indeed retrieves the latest events, however after that it crashes with:

Exception in thread “Thread-29” java.lang.ArrayIndexOutOfBoundsException: -113
at org.openhab.binding.powermax.internal.message.PowerMaxEventLogMessage.toString(PowerMaxEventLogMessage.java:176)
at org.openhab.binding.powermax.internal.message.PowerMaxBaseMessage.handleMessage(PowerMaxBaseMessage.java:114)
at org.openhab.binding.powermax.internal.message.PowerMaxEventLogMessage.handleMessage(PowerMaxEventLogMessage.java:101)
at org.openhab.binding.powermax.internal.PowerMaxBinding.powerMaxEventReceived(PowerMaxBinding.java:548)
at org.openhab.binding.powermax.internal.connector.PowerMaxConnector.handleIncomingMessage(PowerMaxConnector.java:90)
at org.openhab.binding.powermax.internal.connector.PowerMaxReaderThread.run(PowerMaxReaderThread.java:134)
at org.openhab.binding.powermax.internal.connector.PowerMaxSerialConnector$SerialReaderThread.run(PowerMaxSerialConnector.java:153)

Updated configuration for the binding (unfortunately I cannot edit my old messages). There is a new setting: autoSyncTime

################################### 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=/dev/ttyUSB0

# 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=true

# 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

# Automatic sync time at openHAB startup (optional, defaults to false)
powermax:autoSyncTime=true

################################################################################################

Updated items (example).
Please note that the last version of the binding displays in the logs, at startup, what you could define as items.

Group GPowerMax "Alarm"

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 [MAP(fr.map):%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_4 "Event log 4 [%s]" (GPowerMax) {powermax="event_log:4"}
String Powermax_event_log_5 "Event log 5 [%s]" (GPowerMax) {powermax="event_log:5"}

Switch Powermax_download_setup "Setup" (GPowerMax) {powermax="download_setup", autoupdate="false"}

String Powermax_panel_mode "Panel mode [%s]" (GPowerMax) {powermax="panel_mode"}
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"}

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"}

Updated sitempa (example).
Please note that the last version of the binding displays in the logs, at startup, what you could define in sitemap.

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_download_setup mappings=[ON="Download"]
        
        Switch item=Powermax_X10_1_status2 mappings=[OFF="Off", ON="On", DIM="Dim", BRIGHT="Bright"]

        Group item=GPowerMax label="Alarm"
    }

I just updated a new version. Same link to download it: http://lg.hc.free.fr/openHAB/org.openhab.binding.powermax-1.7.0-SNAPSHOT.jar

Additional features:

  • fix for crash mentioned by @renes
  • automatic sync time (new setting available to enable it). it happens when setup is downloaded, that is when starting openHAB
  • new item to download setup - the only usage at this time for the normal user would be to force sync time
  • help for defining items and sitemap through examples logged at openHAB startup.
  • special message handling for PowerMaster

@renes: let me know if it solved your crash.

This version is almost a final version. My TODO list is largely reduced now. My main last thing to add is something that would show the state of sirens.

@Lolodomo great work by the way!!! Tested your latest version but I still get the exception with a slightly different stacktrace now:

Exception in thread “Thread-29” java.lang.ArrayIndexOutOfBoundsException: -113
at org.openhab.binding.powermax.internal.message.PowerMaxEventLogMessage.handleMessage(PowerMaxEventLogMessage.java:121)
at org.openhab.binding.powermax.internal.PowerMaxBinding.powerMaxEventReceived(PowerMaxBinding.java:577)
at org.openhab.binding.powermax.internal.connector.PowerMaxConnector.handleIncomingMessage(PowerMaxConnector.java:90)
at org.openhab.binding.powermax.internal.connector.PowerMaxReaderThread.run(PowerMaxReaderThread.java:134)
at org.openhab.binding.powermax.internal.connector.PowerMaxSerialConnector$SerialReaderThread.run(PowerMaxSerialConnector.java:153)

@renes: sorry for my stupidity, I fixed in one place (toString method) and not in the other place (handleMessage method) ! Please try again with the new uploaded jar file. I hope that it is ok this time.

That’s interesting. Mine is with partitions enabled and event logs are not correctly retrieved.
Let me know if it works well with partitions disabled.

@Lolodomo thanks! That solved the issue. Have a good new years eve.

@Lolodomo yes with partitions disabled it works like expected, eg. most recent event is at position 1 and it correctly populates until position 250.

Logging examples for defining items is a brilliant feature - thank you. Might be helpful to be able to switch it off in openhab.cfg, so the log isn’t unnecessarily cluttered once everything is running properly.

unfortunately the binding has stopped working for me with openhab 1.8.0 - I get the following in the logs:

22:38:27.489 INFO  o.o.b.p.i.m.PowerMaxCommDriver[:139]- PowerMax alarm binding: open connection using Serial port /dev/usb_serial
22:38:27.759 INFO  o.o.b.p.i.c.PowerMaxSerialConnector[:91]- open(): No Such Port Exception: null
22:38:27.760 INFO  o.o.b.p.i.PowerMaxBinding[:216]- PowerMax alarm binding: reconnection failed

any help would be appreciated!

OK - I can answer my question. The update overwrote my /etc/init.d/openhab file, hence my symlinks to the USB/serial ports were lost. Just needed to update this and everything works.

is the source code available for this?

Not yet but it is my intention to publish it.

great. glad to take a look at it. do you know if it works with 2.0 yet?

It was but as almost no 1.x binding is now working in beta 1, probably it does not work anymore. I have not yet tested since beta 1 was released.
By the way, my intention is to create a 2.0 binding in a second time.