Insteonplm binding configuration for Insteon siren module 2868-222

Bernd, (or anyone).

Just got one of the new Insteon siren modules. Houselinc won’t touch it (as expected). I’m thinking that I can link it to the modem OK, but at the minimum we will need a new device type to control it.

The dev notes are here.

Siren developer notes

Anyone have anything working for this yet?

Any ideas what to add to device_features.xml and device_types.xml. To get started? Can we do basic operations (siren on/off, chime on/off, armed/disarmed) with the message handlers we have, or do we need a new message handler?

Anyway I’m going to give it a go, I’ll update progress (if any) here.

OK, I have a “rough” set up for the siren. This is just to give some basic functionality, as without specific command handlers or message handlers, you can’t use all the functionality of the siren, but this covers simple cases. Also I am using OH2, but the instructions should work for OH1 also (but tested with OH2).

If you don’t want to get into configuring the insteonplm binding, you can get simple functionality by setting the siren up as a dimmer or switch. A Switch simply sets the siren off for the maximum time (about 4 minutes - 255 seconds) with the last sound used (chime or alarm). A Dimmer allows you to set the alarm duration as a percentage of 4 minutes (or 255 seconds), so 12% is about 30 seconds. This will work irrespective of the sirens “armed” status.

The siren has three armed settings, “home”, “away” and “both” (plus “disarmed”). The alarm can be triggered for each of these modes by group broadcasts, but I haven’t got into that, it’s complex. So you can set the armed modes, but triggering is a direct trigger, and ignores the armed modes. The armed modes can be used by linked devices though.

Functionality exposed by this set up is:

ON/OFF (like switch)
On for duration % (like dimmer)
On for specific time (in seconds)
Set alert sound (Chime or Alarm)
Arm Mode (“home”, “away”, “both”)
Disarm (and silence at same time)
Poll (to get current status, including remaining alarm time)

This asumes you are somewhat familiar with adding additional devices in the insteonplm binding. The instructions are in the insteonplm wiki https://github.com/openhab/openhab1-addons/wiki/Insteon-PLM-Binding in the “Adding new device types” section.

Here are the settings:

additional_features.xml

<xml>
<feature name="SirenAlertGroup"> <!-- just does the polling for Alert Type -->
	<message-dispatcher>PollGroupDispatcher</message-dispatcher>
	<poll-handler ext="1" cmd1="0x2E" cmd2="0x00" d1="0x01" >FlexPollHandler</poll-handler>
</feature>

<feature name="SirenTrigger">
	<message-dispatcher>DefaultDispatcher</message-dispatcher>
	<message-handler cmd="0x11" group="1">LightOnDimmerHandler</message-handler>
	<message-handler cmd="0x12" group="1" mode="FAST">LightOnDimmerHandler</message-handler>
	<message-handler cmd="0x13" group="1">LightOffDimmerHandler</message-handler>
	<message-handler cmd="0x14" group="1" mode="FAST">LightOffDimmerHandler</message-handler>
	<message-handler cmd="0x19">DimmerRequestReplyHandler</message-handler>
    <message-handler default="true">NoOpMsgHandler</message-handler>
	<command-handler command="PercentType">PercentHandler</command-handler>
	<command-handler command="OnOffType">LightOnOffCommandHandler</command-handler>
    <command-handler command="DecimalType" cmd1="0x11" value="command2">NumberCommandHandler</command-handler>
	<poll-handler ext="0" cmd1="0x19" cmd2="0x00" >FlexPollHandler</poll-handler>
</feature>

<feature name="SirenArm" timeout="5000">
	<message-dispatcher>SimpleDispatcher</message-dispatcher>
    <message-handler cmd="0x20">TriggerPollMsgHandler</message-handler>
    <message-handler cmd="0x19" ext="0" match_cmd1="0x19" rshift="6" low_byte="command2">NumberMsgHandler</message-handler> 
    <message-handler default="true">NoOpMsgHandler</message-handler>
    <command-handler command="DecimalType" ext="1" cmd1="0x20" cmd2="0x05" value="userData1">NumberCommandHandler</command-handler>
    <poll-handler ext="0" cmd1="0x19" cmd2="0x03" >FlexPollHandler</poll-handler>
</feature>

<feature name="SirenDisArm" timeout="5000">
	<message-dispatcher>SimpleDispatcher</message-dispatcher>
    <message-handler cmd="0x20">TriggerPollMsgHandler</message-handler>
    <message-handler cmd="0x19" ext="0" match_cmd1="0x19" rshift="6" low_byte="command2">NumberMsgHandler</message-handler>
    <message-handler default="true">NoOpMsgHandler</message-handler>
    <command-handler command="DecimalType" ext="1" cmd1="0x20" cmd2="0x04" value="userData1">NumberCommandHandler</command-handler> <!-- userData1 is ignored -->
	<poll-handler>NoPollHandler</poll-handler> <!-- polled by SirenArm -->
</feature>
<!--
Name Armed / Disarmed / countdown state
bit 0 - bit 5 - Remaining Arming Countdown time
bit 6 - Home armed
bit 7 - Away armed
Remaining number of seconds in a countdown
The value can be any number from 0-45
This value loosely corresponds to the number of
seconds of remaining countdown time.
 -->
 
<feature name="SirenAlertType" timeout="5000">
	<message-dispatcher>DefaultDispatcher</message-dispatcher>
    <!-- handles direct ack after siren type has been changed-->
    <message-handler cmd="0x19">TriggerPollMsgHandler</message-handler>
    <!-- handles direct extended message after query -->
	<message-handler cmd="0x2E" ext="1" match_cmd1="0x2E" low_byte="userData7">NumberMsgHandler</message-handler>
    <command-handler command="DecimalType" ext="1" cmd1="0x2E" cmd2="0x00" d1="0x01" d2="0x05" value="userData3">NumberCommandHandler</command-handler>
	<poll-handler>NoPollHandler</poll-handler> <!-- polled by SirenAlertGroup -->
</feature>
<!--
NOTE: This is the same command used to set a
dimmable device's Ramp Rate

Name Siren Alert Type
Description The siren has two Alert types, Chime and Loud Siren
Size 1 byte
Description Value
Chime The siren will emit a ding-dong chime 00
Loud Siren The siren will emit a 120db Siren 01
 -->
 
<feature name="SirenPoll" timeout="5000">
	<message-dispatcher>DefaultDispatcher</message-dispatcher>
    <!-- handles direct ack by triggering poll-->
    <message-handler cmd="0x19">TriggerPollMsgHandler</message-handler>
	<message-handler default="true">NoOpMsgHandler</message-handler>
    <command-handler command="DecimalType" ext="1" cmd1="0x2E" cmd2="0x00" d1="0x01" value="userData3">NumberCommandHandler</command-handler>
	<poll-handler>NoPollHandler</poll-handler>
</feature>
</xml>

additional_devices.xml

<xml>
<device productKey="F00.00.23">
     <model>2868</model>
     <description>Siren Module</description>
     <feature name="trigger">SirenTrigger</feature>
     <feature name="arm">SirenArm</feature>
     <feature name="disarm">SirenDisArm</feature>
     <feature name="poll">SirenPoll</feature>
     <feature_group name="alert_group" type="SirenAlertGroup">
       <feature name="alarmtype">SirenAlertType</feature>
     </feature_group>
     <feature name="lastheardfrom">GenericLastTime</feature>
 </device>
 
 </xml>

items

Switch  hallwaySirenSwitch          "Siren Switch [%s]"         <siren>            {insteonplm="XX.XX.XX:F00.00.23#trigger"}
Dimmer  hallwaySirenDimmer          "Siren Dimmer [%d%%]"       <siren>            {insteonplm="XX.XX.XX:F00.00.23#trigger"}
Number  hallwaySirenSwitchDuration  "Siren ON Duration [%s]"    <siren>             {insteonplm="XX.XX.XX:F00.00.23#trigger"}
Number  hallwaySirenArm              "Arm Siren [MAP(armed.map):%s]"    <siren>      {insteonplm="XX.XX.XX:F00.00.23#arm", autoupdate=false}
Number  hallwaySirenDisArm           "Disarm Siren [%d]" <siren>                      {insteonplm="XX.XX.XX:F00.00.23#disarm", autoupdate=false}
Number  hallwaySirenAlarmType        "Siren Sound [%d]"  <siren>                      {insteonplm="XX.XX.XX:F00.00.23#alarmtype", autoupdate=false}
Number  hallwaySirenPoll             "Siren Poll"        <siren>                      {insteonplm="XX.XX.XX:F00.00.23#poll", autoupdate=false}

sitemap

Switch item=hallwaySirenSwitch mappings=[ON="TEST", OFF="SILENCE"]
Switch item=hallwaySirenDimmer mappings=[0="OFF", 12="30 Sec", 24="1 min", 35="90 sec", 47="2 min", 100="4 min"]
Slider item=hallwaySirenDimmer
Switch item=hallwaySirenSwitchDuration mappings=[0="OFF", 30="30 Sec", 60="1 min", 90="90 sec", 120="2 min"]
Switch item=hallwaySirenAlarmType mappings=[0="CHIME", 1="ALARM"]
Switch item=hallwaySirenArm mappings=[1="HOME", 3="AWAY",2="BOTH"]
Switch item=hallwaySirenDisArm mappings=[0="DISARM"]
Switch item=hallwaySirenPoll mappings=[0="POLL"]

transform armed.map

0=0
1=1
2=3
3=2
-=Unknown
NULL=Unknown

You need the transform as the value returned by the armed status is a bitmap (2 bits for away, home) and the setting is a value 1,2,3 = home, both, away, so the one does not map to the other.

Note that the Number for setting the alarm on time is 0-255 in seconds, and does update on a poll, but will give the % remaining (of 255). The Dimmer item updates the same way on a poll (and when it hits 0), so if you want the remaining alarm time, poll, then read the dimmer or Number item, which gives you the % of 255s time left ie if there is 2 minutes alarm time left you should get 50%.

WARNING: I have found that if you hit the Siren with too many commands (like to many polls), it stops responding, and needs a power cycle to fix it. Yes, an Alarm that stops responding to commands if you query it, or send commands to it too often - not the most reliable of alarms!

This is just a quick set up for basic functions, there may be errors in my implementation, feel free to improve! Hopefully Bernd or someone will come up with a proper message and command handler for this device eventually, and we can use the full functionality.

Until then, enjoy!

Hi Nicholas,

Just saw this now. Nice work! Why not submit it as a pull request? Just document the issues with polling too often so people now it’s not 100% reliable. Building an alarm system on Insteon messaging is a risky idea anyways.

Bernd

Hi Guys,

I’m trying to add a simple “beep” feature to this original code, but I’m having trouble with the xml. I keep getting an error when restarting openhab.

Here is the XML I’ve added, along with the error.

more_features.xml

 <feature name="SirenBeep">
 	<message-dispatcher>DefaultDispatcher</message-dispatcher>
 	<message-handler cmd1="0x13" cmd2="0x01">LightOnSwitchHandler</message-handler>
 	<command-handler command="OnOffType">LightOnOffCommandHandler</command-handler>
 	<poll-handler>NoPollHandler</poll-handler>
 </feature>

more_devices.xml

<feature name="beep">SirenBeep</feature>

siren.items

Switch  hallwaySirenBeep          "Siren Beep [%s]"         <siren>            {insteonplm="xxxxx:F00.00.23#beep"}

Error Log

2018-12-18 11:24:10.165 [ERROR] [org.apache.felix.configadmin ] - [org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService, id=366, bundle=229/mvn:org.openhab.binding/org.openhab.binding.insteonplm/1.12.0]: Unexpected problem updating configuration org.openhab.insteonplm

java.lang.StringIndexOutOfBoundsException: String index out of range: -2

at java.lang.String.substring(String.java:1931) [?:?]

at org.openhab.binding.insteonplm.internal.utils.Utils.from0xHexString(Utils.java:54) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.internal.device.FeatureTemplateLoader.s_parseMessageHandler(FeatureTemplateLoader.java:125) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.internal.device.FeatureTemplateLoader.s_parseFeature(FeatureTemplateLoader.java:90) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.internal.device.FeatureTemplateLoader.s_readTemplates(FeatureTemplateLoader.java:63) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.internal.device.DeviceFeature.s_readFeatureTemplates(DeviceFeature.java:386) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.internal.device.DeviceFeature.s_readFeatureTemplates(DeviceFeature.java:407) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.InsteonPLMActiveBinding.processBindingConfiguration(InsteonPLMActiveBinding.java:316) [229:org.openhab.binding.insteonplm:1.12.0]

at org.openhab.binding.insteonplm.InsteonPLMActiveBinding.updated(InsteonPLMActiveBinding.java:272) [229:org.openhab.binding.insteonplm:1.12.0]

at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [8:org.apache.felix.configadmin:1.8.16]

at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [8:org.apache.felix.configadmin:1.8.16]

at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [8:org.apache.felix.configadmin:1.8.16]

at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [8:org.apache.felix.configadmin:1.8.16]

at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [8:org.apache.felix.configadmin:1.8.16]

at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]

at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]

at java.lang.Thread.run(Thread.java:748) [?:?]

Any assistance is appreciated.

Do you have the tag on the first line and tag on the last. I’ve made that mistake before.

Yes, they are there.

I made a little bit of a change to the feature, but now it just triggers the alarm rather just beeping.

<feature name="SirenBeep">
<message-dispatcher>DefaultDispatcher</message-dispatcher>
<command-handler command="OnOffType" cmd1="0x30" cmd2="0x01">LightOnOffCommandHandler</command-handler>
<poll-handler>NoPollHandler</poll-handler>
</feature>

Also, is there someway to monitor this files changes without restarting OH?

I’ll try to take a look, but you know… Christmas.

I hate to bump this but I’m circling back. I haven’t been able to get this working. I guess I’m just not clear of the XML syntax required for a feature. Do I need a message-handler for this? Any assistance would be appreciated.