I will get to the moderator soon.
openHAB Distribution Version Information
----------------------------------------
build-no : Release Build
online-repo : https://openhab.jfrog.io/openhab/libs-release
Repository Version
----------------------------------------
openhab-distro : 2.5.10
openhab-core : 2.5.0
openhab1-addons : 1.14.0
openhab2-addons : 2.5.10
karaf : 4.2.7
I am not sure what you are asking about running from an SD card. I am using a Raspberry Pi with a micro SD card that contains the OS, Openhab, all the other stuff that comes with the Noobs package.
Here are my rules files. They contain a lot of my notes to help me remember what I was doing and why. I am not a real power user. I might go months before I might want to make a change. The notes help but they may conflict within themselves or be obsolete.
The rule "“Ignore Bogus Reports” posted Dec 6 is the one for the B&D lock. It is the one that does a translation and goes dormant every few days.
The other rule that I caught dormant one time is:
//Test to see if I can capture the time when watchdog happens
// It just uses a switch Bump_Time
rule "Capture Time"
when
// Item Bump_Time changed //use to test functionality in a classicUI sitemap.
Item WatchDogBurp changed
then
logDebug("Bump_Time changedXXX", "From On to Off")
When_Bumped.postUpdate( new DateTimeType())
end
The translate rules for the two other locks are below. These have never gone dormant. Rule “Yale YRD110 Rule” has been installed for over a year. Rule “New Yale YRD110 Rule” has been installed for a month or so. You can see that all three translate rules are identical except for changes in text fields.
rule "Yale YRD110 Rule"
// I tried to use a map file to change the text but it sometimes fsiled and reported
// stuff like {"type"\:"112","value"\:"0"} not Master code changed or user added at keypad
// refreshing the screen would "fix" it.
// So I will use a technique like I used for the B&D Lock
when
Item Porch_Alarm_Raw changed
then
//PorchDoorReportTime.postUpdate([%1$tH:%1$tM])
//Process the JSON from the raw alarm to get the Type and Value
var actionType = transform("JSONPATH", "$.type",triggeringItem.state.toString) // these SOBs are strings
var actionTypeValue = transform("JSONPATH", "$.value", triggeringItem.state.toString)
logDebug("RULE_SYSTEM", "Porch Lock: Alarm events: TFormed State: {}, StateValue: {}", actionType, actionTypeValue)
if(actionType !="0"){
switch (actionType) {
//Locking actions
case "9": {
Porch_Alarm_Virtual.postUpdate("Motor jammed")
Porch_Alarm_Virtual_Short.postUpdate("Jammed")
logDebug("RULE_SYSTEM", "{} Motor Jammed", "PorchLock")
}
case "18": {
Porch_Alarm_Virtual.postUpdate("Keypad lock")
Porch_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Keypad lock", "PorchLock")
}
case "19": {
Porch_Alarm_Virtual.postUpdate("Motor jammed")
Porch_Alarm_Virtual_Short.postUpdate("Jammed")
logDebug("RULE_SYSTEM", "{} Keypad unlock", "PorchLock")
}
case "21 ": {
if (actionTypeValue=="1"){
Porch_Alarm_Virtual.postUpdate("Manual lock by thumb")
Porch_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Manual lock by thumb", "PorchLock")
}
else{
Porch_Alarm_Virtual.postUpdate("Manual lock by touchpad")
Porch_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Manual lock by touchpad", "PorchLock")
}
}
case "22": {
Porch_Alarm_Virtual.postUpdate("Manual unlock")
Porch_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} Manual unlock", "PorchLock")
}
case "24": {
Porch_Alarm_Virtual.postUpdate("RF lock")
Porch_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} RF lock", "PorchLock")
}
case "25": {
Porch_Alarm_Virtual.postUpdate("RF unlock")
Porch_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} RF unlock", "PorchLock")
}
case "27": {
Porch_Alarm_Virtual.postUpdate("Auto re-lock cycle complete")
Porch_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Auto re-lock cycle complete", "PorchLock")
}
case "33": {
Porch_Alarm_Virtual.postUpdate("User deleted")
logDebug("RULE_SYSTEM", "{} User deleted", "PorchLock")
}
case "112": {
Porch_Alarm_Virtual.postUpdate("Master code changed or user added at keypad")
logDebug("RULE_SYSTEM", "{} Master code changed or user added at keypad", "PorchLock")
}
case "113": {
Porch_Alarm_Virtual.postUpdate("Lock has completed Handing Cycle")
logDebug("RULE_SYSTEM", "{} Lock has completed Handing Cycle", "PorchLock")
}
case "129": {
Porch_Alarm_Virtual.postUpdate("Lock has completed Handing Cycle")
logDebug("RULE_SYSTEM", "{} Lock has completed Handing Cycle", "PorchLock")
}
case "130": {
Porch_Alarm_Virtual.postUpdate("RF module (in door) power restored")
logDebug("RULE_SYSTEM", "{} RF module (in door) power restored", "PorchLock")
}
case "161": {
if (actionTypeValue=="1"){
Porch_Alarm_Virtual.postUpdate("Tamper Alarm attempts exceeded")
logDebug("RULE_SYSTEM", "{} Tamper Alarm attempts exceeded", "PorchLock")
}
else{
Porch_Alarm_Virtual.postUpdate("Front escutcheon removed")
logDebug("RULE_SYSTEM", "{} Front escutcheon removed", "PorchLock")
}
}
case "167": {
Porch_Alarm_Virtual.postUpdate("Battery low")
logDebug("RULE_SYSTEM", "{} Battery low", "PorchLock")
}
case "168": {
Porch_Alarm_Virtual.postUpdate("Battery critical")
logDebug("RULE_SYSTEM", "{} Battery critical", "PorchLock")
}
case "169": {
Porch_Alarm_Virtual.postUpdate("Battery too low")
logDebug("RULE_SYSTEM", "{} Battery too low", "PorchLock")
}
default : {
Porch_Alarm_Virtual.postUpdate ("Unknown Alarm Type " +actionType + " Value " +actionTypeValue)
logDebug("RULE_SYSTEM_Default", "{} Unknown Alarm Type " +actionType + " Value " +actionTypeValue, "PorchLock")
}
}
}
end
rule "New Yale YRD110 Rule"
// I tried to use a map file to change the text but it sometimes failed and reported
// stuff like {"type"\:"112","value"\:"0"} not Master code changed or user added at keypad
// refreshing the screen would "fix" it.
// So I will use a technique like I used for the B&D Lock
when
Item Garage_Alarm_Raw changed
then
//Process the JSON from the raw alarm to get the Type and Value
var actionType = transform("JSONPATH", "$.type",triggeringItem.state.toString) // these SOBs are strings
var actionTypeValue = transform("JSONPATH", "$.value", triggeringItem.state.toString)
logDebug("RULE_SYSTEM", "Garage Lock: Alarm events: TFormed State: {}, StateValue: {}", actionType, actionTypeValue)
if(actionType !="0"){
switch (actionType) {
//Locking actions
case "9": {
Garage_Alarm_Virtual.postUpdate("Motor jammed")
Garage_Alarm_Virtual_Short.postUpdate("Jammed")
logDebug("RULE_SYSTEM", "{} Motor Jammed", "GarageLock")
}
case "18": {
Garage_Alarm_Virtual.postUpdate("Keypad lock")
Garage_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Keypad lock", "GarageLock")
}
case "19": {
Garage_Alarm_Virtual.postUpdate("Motor jammed")
Garage_Alarm_Virtual_Short.postUpdate("Jammed")
logDebug("RULE_SYSTEM", "{} Keypad unlock", "GarageLock")
}
case "21 ": {
if (actionTypeValue=="1"){
Garage_Alarm_Virtual.postUpdate("Manual lock by thumb")
Garage_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Manual lock by thumb", "GarageLock")
}
else{
Garage_Alarm_Virtual.postUpdate("Manual lock by touchpad")
Garage_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} Manual lock by touchpad", "GarageLock")
}
}
case "22": {
Garage_Alarm_Virtual.postUpdate("Manual unlock")
Garage_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} Manual unlock", "GarageLock")
}
case "24": {
Garage_Alarm_Virtual.postUpdate("RF lock")
Garage_Alarm_Virtual_Short.postUpdate("Secured")
logDebug("RULE_SYSTEM", "{} RF lock", "GarageLock")
}
case "25": {
Garage_Alarm_Virtual.postUpdate("RF unlock")
Garage_Alarm_Virtual_Short.postUpdate("Un-Secured")
logDebug("RULE_SYSTEM", "{} RF unlock", "GarageLock")
}
case "27": {
Garage_Alarm_Virtual.postUpdate("Auto re-lock cycle complete")
logDebug("RULE_SYSTEM", "{} Auto re-lock cycle complete", "GarageLock")
}
case "33": {
Garage_Alarm_Virtual.postUpdate("User deleted")
logDebug("RULE_SYSTEM", "{} User deleted", "GarageLock")
}
case "112": {
Garage_Alarm_Virtual.postUpdate("Master code changed or user added at keypad")
logDebug("RULE_SYSTEM", "{} Master code changed or user added at keypad", "GarageLock")
}
case "113": {
Garage_Alarm_Virtual.postUpdate("Lock has completed Handing Cycle")
logDebug("RULE_SYSTEM", "{} Lock has completed Handing Cycle", "GarageLock")
}
case "129": {
Garage_Alarm_Virtual.postUpdate("Lock has completed Handing Cycle")
logDebug("RULE_SYSTEM", "{} Lock has completed Handing Cycle", "GarageLock")
}
case "130": {
Garage_Alarm_Virtual.postUpdate("RF module (in door) power restored")
logDebug("RULE_SYSTEM", "{} RF module (in door) power restored", "GarageLock")
}
case "161": {
if (actionTypeValue=="1"){
Garage_Alarm_Virtual.postUpdate("Tamper Alarm attempts exceeded")
logDebug("RULE_SYSTEM", "{} Tamper Alarm attempts exceeded", "GarageLock")
}
else{
Garage_Alarm_Virtual.postUpdate("Front escutcheon removed")
logDebug("RULE_SYSTEM", "{} Front escutcheon removed", "GarageLock")
}
}
case "167": {
Garage_Alarm_Virtual.postUpdate("Battery low")
logDebug("RULE_SYSTEM", "{} Battery low", "GarageLock")
}
case "168": {
Garage_Alarm_Virtual.postUpdate("Battery critical")
logDebug("RULE_SYSTEM", "{} Battery critical", "GarageLock")
}
case "169": {
Garage_Alarm_Virtual.postUpdate("Battery too low")
logDebug("RULE_SYSTEM", "{} Battery too low", "GarageLock")
}
default : {
Garage_Alarm_Virtual.postUpdate ("Unknown Alarm Type " +actionType + " Value " +actionTypeValue)
logDebug("RULE_SYSTEM_Default", "{} Unknown Alarm Type " +actionType + " Value " +actionTypeValue, "GarageLock")
}
}
}
end
This is the rule file for controlling my garage door opener:
//Overhead Garage Rules
rule "Return Switch to Off"
// Returns the switch stste to Off after pulsing the Opener
when
Item ChangeOverheadDoor changed
then
//logDebug("garagedoor", "From On to Off")
ChangeOverheadDoor.sendCommand(OFF)
end
rule "If Open At 10:PM, close it"
when
Time cron //"0/10 * * ? * *" // ten seconds
//"0 0/1 * * * ?" // Every minute
"0 0 22 * * ?" // At 10 PM
//"0 0/5 * * * ?" // I don't remember
then
if(GarageOverheadState.state.toString=="open") //crap I tried everything before I stumbled on this
{//logError("garagedoor", "inside if") //Try if (GarageOverheadState.state == “closed”) next time.
ChangeOverheadDoor.sendCommand(ON)
//createTimer(now.plusSeconds(5))
ChangeOverheadDoor.sendCommand(OFF)}
sendMail("7169136751@txt.att.net", "Text Notification, Garage Door Closing at 10:00 PM")
//logError("garagedoor", "just after if")
// if (GarageLightState.state.toString=="off")
// (sendMail("7169136751@txt.att.net", "Text Notification, Garage lights On at 10:00 PM"))
end
rule "If Garage Light is On at 10:PM, send text"
when
Time cron //"0/10 * * ? * *" // ten seconds
//"0 0/1 * * * ?" // Every minute
"0 0 22 * * ?" // At 10 PM "0 0 22 * * ?"
//"0 0/5 * * * ?" // I don't remember
then
logInfo("garagelight", "Time Match")
{if (GarageLightState.state.toString=="On") //The mapp converts Off to OFF
{
logInfo("garagelight", "Light State Match")
//From OH Mail Actions sendMail(String to, String subject, String message)
sendMail("7169136751@txt.att.net", "Text Notification", "Garage lights On at 10:00 PM")
}
}
end
Below is my original home rules file which contains a collection of rules. I have edited out email addresses and phone numbers.
//This is the rules file
// These "Opening" texts are from mqtt. my.map just gives a replacement text to go to the UI
// sendMail("email address"."Will become the subject",the state from the mqtt)
// How to do an OR>>> if(triggeringItem.state == "Closing" || triggeringItem.state == "Opening")
//******Door***************
rule "Send Any Door via Mail and Text"
when
Member of DoorSensors changed
then
if(triggeringItem.state == "Opening" || triggeringItem.state=="OpeningOrTampRemoved")
{if (SendEmailMode.state == ON)
// The line below puts an entry in the OpenHAB log.
{logInfo("Door", "Sending notification via Email because {} is Opening.",triggeringItem.name)
// The line below sends an email
sendMail("XXX@XXX.com", "Mail Notification, door opening" ,triggeringItem.name)
}
if (SendTextMode.state == ON)
{logInfo("Door", "Sending notification via Text because {} is Opening.",triggeringItem.name)
sendMail("nnnnnnnnnnn@txt.att.net", "Text Notification, door opening" ,triggeringItem.name)
// sendMail("nnnnnnnnnn@txt.att.net", "Text Notification, door opening" ,triggeringItem.name)
}
}
end
///**********Window*****
rule "Send Any Window via Mail and Text"
when
Member of WindowSensors changed
then
if(triggeringItem.state == "Opening")
{if (SendEmailMode.state == ON)
{logInfo("Window", "Sending notification via Email because {} is Opening.",triggeringItem.name)
sendMail(XXXX@XXXX.com", "Mail Notification, Window opening" ,triggeringItem.name)
}
if (SendTextMode.state == ON)
{logInfo("Window", "Sending notification via Text because {} is Opening.",triggeringItem.name)
sendMail("NNNN@txt.att.net", "Text Notification, Window opening" ,triggeringItem.name)
}
}
end
//*********SmokeHeat
rule "Send Any SmokeHeat via Mail"
when
Member of SmokeHeat changed
then
//if(triggeringItem.state == "Opening")
if(triggeringItem.state == "Smoke" || triggeringItem.state == "Heat")
{if (SendEmailMode.state == ON)
//{logInfo("SmokeHeat", "Sending notification via Email because {} is Opening.",triggeringItem.name)
{logInfo("SmokeHeat", "Sending notification via Email because {} is Smoke.",triggeringItem.name)
sendMail("XXXX@XXXX.com", "Mail Notification, SmokeHeat" ,triggeringItem.name)
}
}
end
rule "Send Any SmokeHeat Text Message" //We should be able to eliminaate this.
when
Member of SmokeHeat changed
then
//if(triggeringItem.state == "Opening")
if(triggeringItem.state == "Smoke" || triggeringItem.state == "Heat")
{if (SendTextMode.state == ON)
//{logInfo("SmokeHeat", "Sending notification via Text because {} is Opening.",triggeringItem.name)
{logInfo("SmokeHeat", "Sending notification via Email because {} is Smoke.",triggeringItem.name)
sendMail("NNNN@txt.att.net", "Text Notification, SmokeHeat" ,triggeringItem.name)
}
}
end
//******************GlassBreak Need to update when we find out the GlassBreak code
rule "Send Any GlassBreak via Mail"
when
Member of GlassBreak changed
then
if(triggeringItem.state != "Alive") // Under Test
{if (SendEmailMode.state == ON)
{logInfo("GlassBreak", "Sending notification via Email because {} Heat or Smoke.",triggeringItem.name)
sendMail("XXXX@XXXX.com", "Mail Notification, GlassBreak" ,triggeringItem.name)
}
}
end
rule "Send Any GlassBreak Text Message"
when
Member of GlassBreak changed
then
if(triggeringItem.state != "Alive") // Under Test
{if (SendTextMode.state == ON)
{logInfo("GlassBreak", "Sending notification via Text because {} Heat or Smoke",triggeringItem.name)
sendMail("NNNN@txt.att.net", "Text Notification, GlassBreak" ,triggeringItem.name)
}
}
end
//**************This is a test of sending a Lock/unlock command to the porch when the porch door changes.
//************I don't know what that ^^^^^^^^^^^^ means. I think this closes the locks at 10 PM (and now the Overhead garage door)
rule "Send lock to porch, garage, and Front lock"
when
Time cron //"0/10 * * ? * *" // ten seconds
//"0 0/1 * * * ?" // Every minute
"0 0 22 * * ?" // At 10 PM
//"0 0/5 * * * ?" // I don't remember
then
//logError("garagedoor", "reached time cron")
Porch_Lock_Door.sendCommand(ON)
Garage_Lock_Door.sendCommand(ON)
Front_Lock_Door.sendCommand(ON)
//logError("garagedoor", "just before if")
//if(GarageOverheadState.state.toString.contains("open")) //crap I tried everything before I stumbled on this
end
Yes it is. Even if it is dormant, when the command goes out to lock at 10:00PM it locks just like the Yale locks.