Just in case anyone is interested here are my item and rule files. It’s truncated but you’ll get the idea. Might want to go through it carefully if you’re going to use them since I did a mass find and replaces to change some names to protect the innocent. Also, my disclaimer, this is one of the first rules and item files I ever created in OH. The rules can likely be cleaned up a ton but it’s inefficiencies do not affect me at the moment. What I didn’t mention before is that i’m using specifically the eventbus portion of the MQTT binding. The eventbus is configured to publish all updates and commands to the subscription topics. So when a zone changes my other OH sees it as a command and I don’t have to setup each individual item to a MQTT topic. The only items that require special binding information are items i’d want to control the panel. You’ll notice that a lot of the items have MQTT binding info attached. You can likely just remove or comment those out. My OH setup is a bit different than most(i’m assuming), I actually have 9 OH instances running and there’ll be more by the time i’m done. These items are what I call sensitive items and they’re additionally publishing to “global” topics that all instances subscribes to so I know the message regarding it’s state was absolutely received by all devices. Obviously, since this OH instance is plugged directly into the NX-586E it can send any command it wants to the panel. This is acceptable for me as I have a ton of security around the server itself. The server is not configured to relay external commands to the panel and you’ll require physical access to the server to make that change. Follow this way of thinking and you should be safe, in theory…
I know this topic was started for a request for a binding, but I guess my point is I don’t think it’s necessary (IMHO) at all. Respectfully, the time spent on that can be used doing other, cooler things. But just in case someone does it anyway and it’s awesome, subscribing to this thread.
Item file:
Group Fire
Group NX8ESensors
Group NX8E_ExteriorDoors
String NX8E_Panel "Security System [%s]" (Security) {serial="/dev/ttyS1"}
Switch NX8E_Arm "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch NX8E_Arm_Proxy "Virtual Keypad" (Security) {mqtt="<[MainHouse:/security/state/arm/command:command:default],>[MainHouse:/security/state/arm/state:state:*:default]"}
Switch NX8E_DisArm "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch NX8E_Away "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch NX8E_Ready "Virtual Keypad" (Security)
Switch NX8E_Power "Virtual Keypad" (Security)
Switch NX8E_Stay "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
String NX8E_Stay_Status "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:*:default]"}
Switch NX8E_ComingSystem "Virtual Keypad" (Security)
Switch NX8E_Exit "Virtual Keypad" (Security)
Switch NX8E_Cancel "Virtual Keypad" (Security)
Switch NX8E_Fire "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch NX8E_Medical "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch NX8E_Police "Virtual Keypad" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
String NX8E_Display1 "Virtual Keypad" (Security)
String NX8E_Display2 "Virtual Keypad" (Security)
Switch NX8E_ExteriorDoors_Status "Exterior Doors" (Security)
Switch NX8E_1 "Virtual Keypad" (Security)
Switch NX8E_2 "Virtual Keypad" (Security)
Switch NX8E_3 "Virtual Keypad" (Security)
Switch NX8E_4 "Virtual Keypad" (Security)
Switch NX8E_5 "Virtual Keypad" (Security)
Switch NX8E_6 "Virtual Keypad" (Security)
Switch NX8E_7 "Virtual Keypad" (Security)
Switch NX8E_8 "Virtual Keypad" (Security)
Switch NX8E_9 "Virtual Keypad" (Security)
Switch NX8E_0 "Virtual Keypad" (Security)
Switch Door_Foyer "Foyer Door" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Door_Kitchen "Kitchen Door" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Door_KitchenSlider "Kitchen Slider" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Door_TVRoom "TV Room Door" (Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Motion_Kitchen "Kitchen Motion" (Security)
Switch Motion_Kitchen1 "Kitchen1 Motion" (Security)
Switch Motion_FamilyRoom "Family Room Motion" (Security)
Switch Motion_TVRoom "TV Room Motion" (Security)
Switch Motion_MasterBedRoom "Master BedRoom Motion" (Security)
Switch Motion_Hallway_SF "Hallway Second Floor Motion" (Security) {mqtt=">[MainHouse:/sfhallway/sensors/motion/command:command:*:default]"}
Switch Smoke_Kitchen "Kitchen Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_Kitchen1 "Kitchen1 Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_FamilyRoom "TV Room Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_Foyer "Foyer Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_MasterBedRoom "Master BedRoom Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_Hallway_SF "Second Floor Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_Kayden "Kayden Room Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Switch Smoke_Korey "Korey Room Smoke Detector" (Fire,Security) {mqtt=">[MainHouse:/System/Broadcast:command:ON:${itemName} Is now ${command}],>[MainHouse:/System/Broadcast:command:OFF:${itemName} Is now ${command}]"}
Rules:
var String Security_buffer = ""
//*********** System Status **********//
rule "Security Keypad Update"
when
System started or
Time cron "0 */1 * * * ?"
then
logInfo("SecurityStatus", "Keypad Query")
sendCommand(NX8E_Panel, "Q000")
end
rule "NX8E_Panel Sensors Update"
when
System started or
Time cron "0 */1 * * * ?"
then
logInfo("NX8E_PanelStatus", "Sensor Query")
sendCommand(NX8E_Panel, "Q201")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q033")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q034")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q035")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q036")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q009")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q010")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q011")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q012")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q013")
Thread::sleep(1000)
sendCommand(NX8E_Panel, "Q014")
end
rule "NX8E_Panel Output Defaults"
when
System started or
Time cron "0 0 */13 * * ?"
then
logInfo("NX8E_PanelStatus", "Setting CLI Output Defaults")
sendCommand(NX8E_Panel, "T")
sendCommand(NX8E_Panel, "a")
sendCommand(NX8E_Panel, "I")
sendCommand(NX8E_Panel, "P")
sendCommand(NX8E_Panel, "Z")
sendCommand(NX8E_Panel, "n")
logInfo("NX8E_PanelStatus", "Complete CLI Output Defaults")
end
//******** System Status **********//
rule "NX8E Status"
when
Item NX8E_Panel received update or
System started
then
NX8E_Panel_buffer = NX8E_Panel_buffer + NX8E_Panel.state.toString.trim
println("NX8E_Panel_buffer -> " + NX8E_Panel_buffer)
// Conditions start here ///
// *******SYSTEM STATUS ***************** //
if(NX8E_Panel_buffer.contains("LA1")){
if(NX8E_Arm.state != ON){
sendCommand(NX8E_Arm,"ON")
}}
if(NX8E_Panel_buffer.contains("LS1")){
if(NX8E_Stay.state != ON){
sendCommand(NX8E_Stay,"ON")
}}
if(NX8E_Panel_buffer.contains("System Armed")){
if(NX8E_DisArm.state != OFF){
sendCommand(NX8E_DisArm,"OFF")
}}
if(NX8E_Panel_buffer.contains("LA0")){
if(NX8E_Arm.state != OFF){
sendCommand(NX8E_Arm,"OFF")
}}
if(NX8E_Panel_buffer.contains("Type code to arm")){
if(NX8E_DisArm.state != ON){
sendCommand(NX8E_DisArm,"ON")
}}
if(NX8E_Panel_buffer.contains("LS0")){
if(NX8E_Stay.state != OFF){
sendCommand(NX8E_Stay,"OFF")
}}
if(NX8E_Panel_buffer.contains("LR0")){
if(NX8E_Ready.state != OFF){
sendCommand(NX8E_Ready,"OFF")
}} else
if(NX8E_Panel_buffer.contains("LR1")){
if(NX8E_Ready.state != ON){
sendCommand(NX8E_Ready,"ON")
}}
// *******PANEL POWER STATUS ****************** //
if(NX8E_Panel_buffer.contains("LP1")){
if(NX8E_Power.state != ON){
sendCommand(NX8E_Power,"ON")
}} else
if(NX8E_Panel_buffer.contains("LP0")){
if(NX8E_Power.state != OFF){
sendCommand(NX8E_Power,"OFF")
}}
//******* Door Sensors ************
if(NX8E_Panel_buffer.contains("ZN036f")){
if(Door_Kitchen.state != OFF){
sendCommand(Door_Kitchen,"OFF")
}} else
if(NX8E_Panel_buffer.contains("ZN036F")){
if(Door_Kitchen.state != ON){
sendCommand(Door_Kitchen,"ON")
}}
if(NX8E_Panel_buffer.contains("ZN035f")){
if(Door_KitchenSlider.state != OFF){
sendCommand(Door_KitchenSlider,"OFF")
}} else
if(NX8E_Panel_buffer.contains("ZN035F")){
if(Door_KitchenSlider.state != ON){
sendCommand(Door_KitchenSlider,"ON")
}}
if(NX8E_Panel_buffer.contains("ZN033f")){
if(Door_Foyer.state != OFF){
sendCommand(Door_Foyer,"OFF")
}} else
if(NX8E_Panel_buffer.contains("ZN033F")){
if(Door_Foyer.state != ON){
sendCommand(Door_Foyer,"ON")
}}
if(NX8E_Panel_buffer.contains("ZN034f")){
if(Door_TVRoom.state != OFF){
sendCommand(Door_TVRoom,"OFF")
}} else
if(NX8E_Panel_buffer.contains("ZN034F")){
if(Door_TVRoom.state != ON){
sendCommand(Door_TVRoom,"ON")
}}
// *******MOTION DETECTOR STATUS ****************** //
if(NX8E_Panel_buffer.contains("ZN009F")){
if (Motion_TVRoom.state != ON){
sendCommand(Motion_TVRoom, ON)
}} else
if(NX8E_Panel_buffer.contains("ZN009f")){
if (Motion_TVRoom.state != OFF){
sendCommand(Motion_TVRoom, "OFF")
}}
if(NX8E_Panel_buffer.contains("ZN014F")){
if (Motion_FamilyRoom.state != ON){
sendCommand(Motion_FamilyRoom, "ON")
}} else
if(NX8E_Panel_buffer.contains("ZN014f")){
if (Motion_FamilyRoom.state != OFF){
sendCommand(Motion_FamilyRoom, "OFF")
}}
if(NX8E_Panel_buffer.contains("ZN010F")){
if (Motion_Kitchen.state != ON){
sendCommand(Motion_Kitchen, "ON")
}} else
if(NX8E_Panel_buffer.contains("ZN010f")){
if (Motion_Kitchen.state != OFF){
sendCommand(Motion_Kitchen, "OFF")
}}
if(NX8E_Panel_buffer.contains("ZN013F")){
if (Motion_Kitchen1.state != ON){
sendCommand(Motion_Kitchen1, "ON")
}} else
if(NX8E_Panel_buffer.contains("ZN013f")){
if (Motion_Kitchen1.state != OFF){
sendCommand(Motion_Kitchen1, "OFF")
}}
if(NX8E_Panel_buffer.contains("ZN011F")){
if (Motion_MasterBedRoom.state != ON){
sendCommand(Motion_MasterBedRoom, "ON")
}} else
if(NX8E_Panel_buffer.contains("ZN011f")){
if (Motion_MasterBedRoom.state != OFF){
sendCommand(Motion_MasterBedRoom, "OFF")
}}
if(NX8E_Panel_buffer.contains("ZN012F")){
if (Motion_Hallway_SF.state != ON){
sendCommand(Motion_Hallway_SF, "ON")
}} else
if(NX8E_Panel_buffer.contains("ZN012f")){
if (Motion_Hallway_SF.state != OFF){
sendCommand(Motion_Hallway_SF, "OFF")
}}
NX8E_Panel_buffer = ""
end
//***** SYSTEM INTERACTION ***********//
//Panel
rule "Alexa Arming"
when
// Time cron "0 */1 * * * ?"
Item NX8E_Arm_Proxy received command ON
then
// if(NX8E_Arm_Proxy.state == ON){
sendCommand(NX8E_Panel, "S")
logInfo("NX8E_PanelStatus", "Alexa Arming")
// }
end
rule "Exterior Doors"
when
Item NX8E_ExteriorDoors received update or
System started
then
if(NX8E_ExteriorDoors.members.filter(s | s.state == ON).size > 0){
NX8E_ExteriorDoors_Status.sendCommand("ON")
if(NX8E_Away.state == ON){
NX8E_ComingHome.sendCommand("ON")
Thread::sleep(1000)
NX8E_ComingHome.sendCommand("OFF")
}
}
else
if(NX8E_ExteriorDoors.members.filter(s | s.state == ON).size == 0){
NX8E_ExteriorDoors_Status.sendCommand("OFF")
}
end
rule "NX8E Stay Status"
when
Item NX8E_Stay received update or
System started
then
if(NX8E_Stay.state==ON){
NX8E_Stay_Status.sendCommand("Active")
}
else
if(NX8E_Stay.state==OFF){
NX8E_Stay_Status.sendCommand("Inactive")
}
end
rule "NX8E_Stay_Status Initialize"
when
System started or
Time cron "0 */5 * * * ?"
then
if (NX8E_Stay_Status.state.toString.matches ("1") || NX8E_Stay_Status.state.toString.matches ("0")|| NX8E_Stay_Status.state.toString.matches ("Uninitialized")) {
sendCommand(NX8E_Stay_Status, ("Inactive"))
}
end
rule "House Status"
when
Item NX8E_Arm received update or
System started
then
if(NX8E_Arm.state==ON && NX8E_Stay.state == OFF){
logInfo("NX8E_PanelStatus", "System Status CHANGED, AWAY DETECTED - Time out STARTED")
var Timer alarmTimeout
if(alarmTimeout!=null){
alarmTimeout.cancel
alarmTimeout = null}
alarmTimeout = createTimer(now.plusMinutes(1)) [|
logInfo("NX8E_PanelStatus", "System Status CHANGED, AWAY DETECTED")
if(NX8E_Arm.state==ON && NX8E_Stay.state == OFF){
logInfo("NX8E_PanelStatus", "System Status CHANGED, State is AWAY")
NX8E_Away.sendCommand("ON")
}
]
}
else
if(NX8E_Arm.state==ON && NX8E_Stay.state == ON){
logInfo("NX8E_PanelStatus", "System Status CHANGED, State is Stay")
NX8E_Away.sendCommand("OFF")
}
else
if(NX8E_Arm.state==OFF){
logInfo("NX8E_PanelStatus", "System Status CHANGED, State is Stay")
NX8E_Away.sendCommand("OFF")
}
end