My Config Collection (OH 1.8 ONLY!) - Might help Someone

All,

Here is my collection with a persistence group, zwave lights, sensors and siren,

Custom Scenes:
On Way Home - On way home from work, opens garage,turns on TV, etc
Movie Night - Dims lights to 20%, Turns on 70" LivingRoom TV, sets HDMI input to Kodi.
Kodi is booted from a PXE Server for whole house Kodi and profiles on multiple TV’s and devices.
Bed Time - Turns everything off.

In Use:
OpenHab 1.8.2 - Rock Solid
Zwave binding 1.9 - Flawless!
Extra bindings: exec, persist, http, orvibo, REST API
Aeon Labs, Door/window, Siren, LED Lights. Zstick2 latest FW
My Total Control HoneyWell WIFI Thermostat status and Management scripts.
Aquos 70" Sharp TV binding
WakeOnLan to turn on hosts (kodi)
Password-less SSH to shutdown hosts (kodi)
Banana PI 3 for garage control and status back to OH.
Banana PI 3 for Kodi
OwnTracks for presence detection with mqt.

New Hardware: Gigabyte GB-BXBT-2807 https://www.google.ca/search?q=Gigabyte+GB-BXBT-2807&biw=1600&bih=799&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjwz-CqzI7MAhUIPT4KHTrJCEEQ_AUIBygC
This is a little bad ass micro PC with sound, Wifi, Bluetooth, 64bit, you can easily install any OS from a thumb drive like you do on a PC. I threw a 250GB SSD and 8GB of ram in mine. This all sits inside a secure Honeywell alarm panel with battery backup. This allows for a total self sufficient alarm system if someone cuts the power or communications the alarm system portion will still run perfectly with no point of failure!

New New Hardware :wink:


New controller I’m using. Dell Netbook 10. 8+ hour battery, added a 250gb SSD so there is no moving parts.
cool little thing…Installed debian 7 on it. Paid 40 bucks for it on
craigslist.

1 Aeon Labs Door/Window Sensors (PRO: Has a protruding tamper sensor CON: Uses AA batteries)
3 EcoLink Door Window Sensors (PRO: Lithium battery, Multiple color housings come with it, very nice CON: Tamper is only internal to case not if you pull it off the wall)
2 Z-Wave Smoke/Carbon detectors (PRO: Cheap, Zwave, First Alert, Look nice, Carbon and Smoke, CON: AA Batteries)
2 EcoLink PIR (PRO: Lithium battery, Great range, work extremely well! I’ve tried sneaking up to it from every angle to disable it and it just don’t work lol CON: NONE)
6 Go-Control Dimmable LED’s (PRO: Work very well CON: NONE)
1 Zipato RGBW (PRO: Works very well overall CON: No RGBW in zwave binding 1.9)
1 Aeon Labs Gen2 Siren (PRO: LOUD, BRIGHT, Self charging battery operated, Multi-Tone CON: NONE)
1 Aeon Labs Gen5 Siren (PRO: LOUD, BRIGHT, Self charging battery operated, Multi-tone CON: NONE)
1 Aeon Labs Z-Stick2 (PRO: Cheap, Works great. No issues, works great in SUC mode and mesh redundancy. CON: None.

Groups and Rules for:
Alarm: Disarm, Arm Away and Arm Stay

FYI: I am changing code on a daily basis so if something don’t work correctly for you lmk so i can check against running code. :wink:

/etc/default/openhab

# Execution account and group. The user account should be member of group
# "openhab" if it's different than "root" and "openhab".
# Note that some bindings may require "root" access to the system.
# Default value if isn't specified - "root:root".
#USER_AND_GROUP=root:root # changed the openhab user and group in /etc/passwd to 0:0 for root permissions.

# Web server's listening ports (plain and SSL). Note that if execution account
# is different than "root" the port numbers should be greater than 1024.
# Default value if isn't specified - none, must be specified.
HTTP_PORT=80
HTTPS_PORT=443

# Console's listening port, same restriction as this for web server's ports.
# Default value if isn't specified - none, must be specified.
TELNET_PORT=5555

# Extra arguments passed to Java
JAVA_ARGS=

# Extra arguments passed to openHAB
OPENHAB_ARGS=

# Use non-default Java VM.
# Default value if isn't specified - system default Java VM.
#OPENHAB_JAVA=/usr/bin/java

# To enable debugging set to "yes" (case insensitive).
# Default value if isn't specified - debugging is disabled.
DEBUG=yes

Rules:

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openhab.core.library.types.*
import org.joda.time.DateTime
import org.openhab.core.items.*
import org.eclipse.xtext.xbase.lib.*
import org.openhab.model.script.actions.Timer
var Timer Node2_tAlive = null
var Timer Node3_tAlive = null
var Timer Node4_tAlive = null
var Timer Node5_tAlive = null
var Timer Node6_tAlive = null
var Timer Node7_tAlive = null
var Timer Node8_tAlive = null
var Timer Node9_tAlive = null
var Timer Node10_tAlive = null
var Timer Node11_tAlive = null
var Timer Node12_tAlive = null
var Timer Node13_tAlive = null
var Timer Node14_tAlive = null
var Timer Node15_tAlive = null
var Timer Node16_tAlive = null
var Timer Node17_tAlive = null
var Timer Node18_tAlive = null
var Timer timer = null
val Functions$Function2 alert = [GroupItem g, String type |
    val latest = g.members.sortBy[lastUpdate].last
    val name = latest.name.split("_")
    Notification_Proxy.postUpdate(name.get(1) + " " + name.get(2) + " " + name.get(3) + " " + type + " Alert!. " + latest.state.toString)
]


rule "Dispatch Notification"
when
    Item Notification_Proxy received update
then
    logWarn("Notification", Notification_Proxy.state.toString)
    sendMail("alerts@cidcomm.com", "Security System Alert!", Notification_Proxy.state.toString)
end







rule "Process door intrusion updates"
    Item gDoorSensors changed from CLOSED to OPEN
then
    val aState = AlarmSysStatus.state as DecimalType
    if(aState == 2 || aState == 3) {
        alert.apply(gDoorSensors, "- Intrusion")
    }
end




rule "DoorBell"
    Item gDoorSensors changed from CLOSED to OPEN
then
    executeCommandLine("mplayer /usr/share/openhab/sounds/doorbell.mp3")
end



rule "Process motion intrusion updates"
    Item gMotionSensors changed from CLOSED to OPEN
then
    if((AlarmSysStatus.state as DecimalType) == 2) {
        alert.apply(gMotionSensors, "- Intrusion")
    }
end

rule "Process smoke detector updates"
    Item gSmoke changed from CLOSED to OPEN
then
        alert.apply(gSmoke, "- CO/Smoke")
    }
end

rule "Process Tamper updates"
    Item gTamper changed from CLOSED to OPEN
then
        alert.apply(gTamper, "- Tamper")
    }
end

rule "Process Window updates"
    Item gWindows changed from CLOSED to OPEN
then
     val aState = AlarmSysStatus.state as DecimalType
     if(aState == 2 || aState == 3) {
     alert.apply(gWindows, "- Intrusion")
    }
end






rule "Process Battery Level Updates"
when
        Item gBattery received update
then
    gBattery.members.forEach[ battery |
        if((battery.state as DecimalType) < 20) {
            val name = battery.name.split("_")
            switch(name.get(1)){
                case "Kitchen":  Notification_Proxy.postUpdate("Replace the " + name.get(1) + " " + name.get(2) + " " + name.get(3) + " " + "Battery, " + battery.state.toString + "% left!")
                case "LivingRoom":  Notification_Proxy.postUpdate("Replace the " + name.get(1) + " " + name.get(2) + " " + name.get(3) + " " + "Battery, " + battery.state.toString + "% left!")
                case "BedRoom":  Notification_Proxy.postUpdate("Replace the " + name.get(1) + " " + name.get(2) + " " + name.get(3) + " " + "Battery, " + battery.state.toString + "% left!")
                case "Hall":  Notification_Proxy.postUpdate("Replace the " + name.get(1) + " " + name.get(2) + " " + name.get(3) + " " + "Battery, " + battery.state.toString + "% left!")
 }
         }
    ]
end





// Send selected temperature to MyTotalConnectComfort Portal
rule "IndHeatSet"
when
    Item IndHeatSet received command
then
    if(timer == null) {
        timer =createTimer(now.plusSeconds(20), [|
            logInfo("Security", "TIMER: Heat Timer triggered")
            SendTemp.sendCommand(IndHeatSet.state as DecimalType)
            timer = null
        ])
        logInfo("Security", "TIMER: Heat Timer Set")
    } else {
        timer.reschedule(now.plusSeconds(20))
        logInfo("Security","TIMER: Rescheduling Heat Timer")
    }
end







// Set Heat Setpoint
rule "Send SetPoint to MyTotalConnectComfort Portal"
when
    Item SendTemp received command
then
    executeCommandLine("/etc/therm.py -h " + receivedCommand)
    logInfo("Security", "RULE: Sending update to MyTotalConnectComfort Portal!")
end






// Sync Setpoint with the set temp app
rule "Update Temp App"
when
    Item IndHeat received command
then
    postUpdate(IndHeatSet, receivedCommand)
    logInfo("Security", "CRON: Syncing SetPoint data!")
end






// Run MyTotalControl Script
rule "Update values from MyTotalControl Thermostat"
when
    Time cron "0 0/5 * * * ?" // Every 5 minutes
then
    executeCommandLine("/etc/tstat")
    logInfo("Security", "CRON: Querying MyTotalConnectComfort Portal for data!")
end





// Check if we are on AC or Battery and send email if on battery
rule "CheckHostPower"
when
    Time cron "0 0/2 * * * ?" // Every 5 minutes
then
    executeCommandLine("/etc/checkac")
    logInfo("Security", "CRON: Querying AC Power status!")
end





// Check if livingroom tv is on
rule "CheckLivingRoomTV"
when
    Time cron "0 0/2 * * * ?" // Every 5 minutes
then
    executeCommandLine("/etc/checktv")
    logInfo("Security", "CRON: Querying LivingRoom TV status!")
end





// Check if kodi is on in the livingroom
rule "CheckLivingRoomKodi"
when
    Time cron "0 0/2 * * * ?" // Every 5 minutes
then
    executeCommandLine("/etc/checkkodi")
    logInfo("Security", "CRON: Querying LivingRoom Kodi status!")
end





// Check if battery is below 25% and send email if so
rule "CheckBatteryPercentage"
when
    Time cron "0 0/2 * * * ?" // Every 5 minutes
then
    executeCommandLine("/etc/checkbattery")
    logInfo("Security", "CRON: Querying Battery Percentage!")
end





// Turn evening lights on
rule "Turn on tv Light"
when
    //Time cron "0 0 19 * * ?" // 7pm every day
    Item Sunset_Time_Task received update ON
then
    Lower_LivingRoom_TV_Light.sendCommand(50)
    Lower_LivingRoom_DoorWay_Light.sendCommand(50)
    Lower_Kitchen_Patio_Light.sendCommand(ON)
    logInfo("Security", "SCHEDULE: Turning on evening lights!")
end





// Turn evening lights off
rule "Turn off tv Light"
when
    Time cron "0 30 23 * * ?" // 19:00:00, every day, every month, every weekday, don't care about year
then
    gAllLights.sendCommand(OFF)
    logInfo("Security", "SCHEDULE: Turning off evening lights!")
end





// SCENE: On way home
rule "OnWayHome"
when
     Item OnWayHomeScene received command
then
     if (receivedCommand == 1) {
     SharpTVPower.sendCommand(ON)
     relay1.sendCommand(ON)
     Thread::sleep(8000)
     SharpTVInput.sendCommand(0)
     logInfo("Security", "SCENE: OnWayHome Activated!")
end





// SCENE: All off
rule "AllOff"
when 
     Item AllOffScene received command
then
     if (receivedCommand == 1) {
     SharpTVPower.sendCommand(OFF)
     gAllLights.sendCommand(OFF)
     LRKodiPC.sendCommand(0)
     logInfo("Security", "SCENE: AllOff Activated!")
end





// SCENE: All Lights off
rule "rAllLightsOff"
when
     Item sAllLightsOff received command
then
     if (receivedCommand == 1) {
     gAllLights.sendCommand(OFF)
     logInfo("Security", "SCENE: All Lights Off Activated!")
end





// SCENE: All Lights on
rule "rAllLightsOn"
when
     Item sAllLightsOn received command
then
     if (receivedCommand == 1) {
     gAllLights.sendCommand(ON)
     logInfo("Security", "SCENE: All Lights On Activated!")
end





// SCENE: Movie Time
rule "MovieTime"
when
     Item MovieTimeScene received command
then
     if (receivedCommand == 1) {
     SharpTVPower.sendCommand(ON)
     Lower_LivingRoom_TV_Light.sendCommand(20)
     Lower_LivingRoom_DoorWay_Light.sendCommand(20)
     LRKodiPC.sendCommand(1)
     Thread::sleep(8000)
     SharpTVInput.sendCommand(4)
end





// Alarm Arm and Disarm
rule "rArmState"
when
    Item AlarmArmDisarm received command
then
    {
        if (receivedCommand == 3)
            {
                logInfo("Security", "SECURITY: Armed Stay!")
                postUpdate(AlarmSysStatus, 3)
                sendMail("jay@cidcomm.com", "Security System Alert!", "System Armed Stay!")
                executeCommandLine("aplay /usr/share/openhab/sounds/armedstay.wav")
            }
        if (receivedCommand == 2)
            {
                logInfo("Security", "SECURITY: Armed Away!")
                postUpdate(AlarmSysStatus, 2)
                sendMail("jay@cidcomm.com", "Security System Alert!", "System Armed Away!")
                executeCommandLine("aplay /usr/share/openhab/sounds/armedaway.wav")
            }
        if (receivedCommand == 1)
            {
                logInfo("Security", "SECURITY: Disarmed")
                postUpdate(AlarmSysStatus, 1)
                gAllSirensSwitch.sendCommand(OFF)
                sendMail("jay@cidcomm.com", "Security System Alert!", "System Disarmed!")
                executeCommandLine("aplay /usr/share/openhab/sounds/disarmed.wav")
        if (receivedCommand == 0)
            {
                logInfo("Security", "SECURITY: No Update")
}
 }}}
end





// Alarm System Active Action
rule "rAlarmActivated"
when
    Item gMotionSensors changed from CLOSED to OPEN or
    Item gDoorSensors changed from CLOSED to OPEN
then
 {    
    if (AlarmSysStatus.state == 2 && gMotionSensors.state == OPEN)
        {
        logInfo("Security", "SECURITY: ARMED-AWAY Motion Intrusion Detected!")
        gAllLights.sendCommand(ON)
        Thread::sleep(3000)
        gAllSirensSet.sendCommand(259)
        Thread::sleep(1200000)
        gAllSirensSwitch.sendCommand(OFF)
        }
    if (AlarmSysStatus.state == 2 && gDoorSensors.state == OPEN)
        {
        logInfo("Security", "SECURITY: ARMED-AWAY Door Intrusion Detected!")
        gAllLights.sendCommand(ON)
        Thread::sleep(3000)
        gAllSirensSet.sendCommand(259)
        Thread::sleep(1200000)
        gAllSirensSwitch.sendCommand(OFF)
        }
    if (AlarmSysStatus.state == 3 && gDoorSensors.state == OPEN)
        {
        logInfo("Security", "SECURITY: ARMED-STAY Door Intrusion Detected!")
        gAllLights.sendCommand(ON)
        Thread::sleep(3000)
        gAllSirensSet.sendCommand(259)
        Thread::sleep(1200000)
        gAllSirensSwitch.sendCommand(OFF)
        }
}}}}
end




// Garage Door Timer Lights
rule "rGarageDoorLights"
when
     Item relay1 received command
then
     if (receivedCommand == ON) {
     gGarageLights.sendCommand(ON)
     logInfo("Security", "Garage Lights On!")
     Thread::sleep(300000)
     gGarageLights.sendCommand(OFF)
     logInfo("Security", "EXT-TIMER: Garage Lights Off!")

end




// Garage Interior Door Timer Lights
rule "rGarageInteriorDoorLights"
when
     Item Lower_Kitchen_MainDoor_Sensor changed from CLOSED to OPEN
then
     gGarageLights.sendCommand(ON)
     logInfo("Security", "Garage Lights On!")
     Thread::sleep(300000)
     gGarageLights.sendCommand(OFF)
     logInfo("Security", "INT-TIMER: Garage Lights Off!")

end




// Node Health checks

rule "Node2Status"
when
    Item Node2 changed
then
    logInfo("Status", "NODE CHECK: Checking Node2 Status.")
    Node2_tAlive?.cancel()
    Node2_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N2", "Node2 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node2 Appears dead. Please Investigate.")
    ]
end

rule "Node3Status"
when
    Item Node3 changed
then
    logInfo("Status", "NODE CHECK: Checking Node3 Status.")
    Node3_tAlive?.cancel()
    Node3_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N3", "Node3 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node3 Appears dead. Please Investigate.")
    ]
end

rule "Node4Status"
when
    Item Node4 changed
then
    logInfo("Status", "NODE CHECK: Checking Node4 Status.")
    Node4_tAlive?.cancel()
    Node4_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N4", "Node4 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node4 Appears dead. Please Investigate.")
    ]
end

rule "Node5Status"
when
    Item Node5 changed
then
    logInfo("Status", "NODE CHECK: Checking Node5 Status.")
    Node5_tAlive?.cancel()
    Node5_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N5", "Node5 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node5 Appears dead. Please Investigate.")
    ]
end

rule "Node6Status"
when
    Item Node6 changed
then
    logInfo("Status", "NODE CHECK: Checking Node6 Status.")
    Node6_tAlive?.cancel()
    Node6_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N6", "Node6 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node6 Appears dead. Please Investigate.")
    ]
end

rule "Node7Status"
when
    Item Node7 changed
then
    logInfo("Status", "NODE CHECK: Checking Node7 Status.")
    Node7_tAlive?.cancel()
    Node7_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N7", "Node7 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node7 Appears dead. Please Investigate.")
    ]
end

rule "Node8Status"
when
    Item Node8 changed
then
    logInfo("Status", "NODE CHECK: Checking Node8 Status.")
    Node8_tAlive?.cancel()
    Node8_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N8", "Node8 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node8 Appears dead. Please Investigate.")
    ]
end

rule "Node9Status"
when
    Item Node9 changed
then
    logInfo("Status", "NODE CHECK: Checking Node9 Status.")
    Node9_tAlive?.cancel()
    Node9_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N9", "Node9 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node9 Appears dead. Please Investigate.")
    ]
end

rule "Node10Status"
when
    Item Node10 changed
then
    logInfo("Status", "NODE CHECK: Checking Node10 Status.")
    Node10_tAlive?.cancel()
    Node10_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N10", "Node10 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node10 Appears dead. Please Investigate.")
    ]
end

rule "Node11Status"
when
    Item Node11 changed
then
    logInfo("Status", "NODE CHECK: Checking Node11 Status.")
    Node11_tAlive?.cancel()
    Node11_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N11", "Node11 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node11 Appears dead. Please Investigate.")
    ]
end

rule "Node12Status"
when
    Item Node12 changed
then
    logInfo("Status", "NODE CHECK: Checking Node12 Status.")
    Node12_tAlive?.cancel()
    Node12_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N12", "Node12 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node12 Appears dead. Please Investigate.")
    ]
end

rule "Node13Status"
when
    Item Node13 changed
then
    logInfo("Status", "NODE CHECK: Checking Node13 Status.")
    Node13_tAlive?.cancel()
    Node13_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N13", "Node13 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node13 Appears dead. Please Investigate.")
    ]
end

rule "Node14Status"
when
    Item Node14 changed
then
    logInfo("Status", "NODE CHECK: Checking Node14 Status.")
    Node14_tAlive?.cancel()
    Node14_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N14", "Node14 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node14 Appears dead. Please Investigate.")
    ]
end

rule "Node15Status"
when
    Item Node15 changed
then
    logInfo("Status", "NODE CHECK: Checking Node15 Status.")
    Node15_tAlive?.cancel()
    Node15_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N15", "Node15 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node15 Appears dead. Please Investigate.")
    ]
end

rule "Node16Status"
when
    Item Node16 changed
then
    logInfo("Status", "NODE CHECK: Checking Node16 Status.")
    Node16_tAlive?.cancel()
    Node16_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N16", "Node16 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node16 Appears dead. Please Investigate.")
    ]
end

rule "Node17Status"
when
    Item Node17 changed
then
    logInfo("Status", "NODE CHECK: Checking Node17 Status.")
    Node17_tAlive?.cancel()
    Node17_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N17", "Node17 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node17 Appears dead. Please Investigate.")
    ]
end

rule "Node18Status"
when
    Item Node18 changed
then
    logInfo("Status", "NODE CHECK: Checking Node18 Status.")
    Node18_tAlive?.cancel()
    Node18_tAlive = createTimer(now.plusHours(8)) [|
        logWarn("N18", "Node18 appears to be dead")
        sendMail("jay@cidcomm.com", "Security System Alert!", "Node18 Appears dead. Please Investigate.")
    ]
end



rrd4j.persist:

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    // if no strategy is specified for an item entry below, the default list will be used
    default = everyMinute
}

Items {
    // Persist ALL items in the persist GROUP
    persist* : strategy = everyMinute, everyChange, restoreOnStartup
}

Proximity Detection Demo:

Kind of a hodge podge but slowly cleaning it up as I add more… :wink:

10 Likes

Openhab.cfg

## Openhab Persistance ###
persistence:default=rrd4j

### Main Config ###
mail:hostname=10.2.100.10
mail:port=25
mail:username=
mail:password=
mail:from=me@here.com
mail:tls=false

### Z-Wave ###
# The Z-Wave controller port. Valid values are e.g. COM1 for Windows and /dev/ttyS0 or
# /dev/ttyUSB0 for Linux
zwave:port=/dev/ttyUSB0
zwave:masterController = true
zwave:healtime = 2
zwave:softReset = true
zwave:setSUC = false

### Sharp TV ###
sharptv:livingroom.host=10.1.100.27
sharptv:livingroom.port=10002
sharptv:livingroom.user=admin
sharptv:livingroom.pass=password

### Weather ###
weather:apikey.ForecastIo=mykey
weather:location.home.name=Home
weather:location.home.latitude=00.0000
weather:location.home.longitude=-00.0000
weather:location.home.provider=ForecastIo
weather:location.home.language=en
weather:location.home.updateInterval=15
weather:location.home.woeid=2416511

### Astro ###
# The latitude
astro:latitude=00.0000

# The longitude
astro:longitude=-00.0000

# Refresh interval for azimuth and elevation calculation in seconds
# (optional, defaults to disabled)
astro:interval=3600

MytotalControl Script to attach to the cloud to manage and get updates for OH.

#!/usr/bin/python

# By Brad Goodman
# http://www.bradgoodman.com/
# brad@bradgoodman.com
# Customized by Jamie R. Cid for 2016.
# Jay@cidcomm.com

####################### Fill in settings below #######################

USERNAME="me@here.com"
PASSWORD="mypass"
DEVICE_ID=12345

############################ End settings ############################

import urllib2
import urllib
import json
import datetime
import re
import time
import math
import base64
import time
import httplib
import sys
import getopt
import os
import stat
import subprocess
import string

AUTH="https://mytotalconnectcomfort.com/portal"

cookiere=re.compile('\s*([^=]+)\s*=\s*([^;]*)\s*')

def client_cookies(cookiestr,container):
  if not container: container={}
  toks=re.split(';|,',cookiestr)
  for t in toks:
    k=None
    v=None
    m=cookiere.search(t)
    if m:
      k=m.group(1)
      v=m.group(2)
      if (k in ['path','Path','HttpOnly']):
        k=None
        v=None
    if k:
      #print k,v
      container[k]=v
  return container

def export_cookiejar(jar):
  s=""
  for x in jar:
    s+='%s=%s;' % (x,jar[x])
  return s



def get_login(action, value=None, hold_time=1):

    cookiejar=None
    #print
    #print
    #print "Run at ",datetime.datetime.now()
    headers={"Content-Type":"application/x-www-form-urlencoded",
            "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Encoding":"sdch",
            "Host":"mytotalconnectcomfort.com",
           "DNT":"1",
            "Origin":"https://mytotalconnectcomfort.com/portal",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
        }
    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com")
    conn.request("GET", "/portal/",None,headers)
    r0 = conn.getresponse()
    #print r0.status, r0.reason

    for x in r0.getheaders():
      (n,v) = x
      #print "R0 HEADER",n,v
      if (n.lower() == "set-cookie"):
        cookiejar=client_cookies(v,cookiejar)
    #cookiejar = r0.getheader("Set-Cookie")
    location = r0.getheader("Location")

    retries=5
    params=urllib.urlencode({"timeOffset":"240",
        "UserName":USERNAME,
        "Password":PASSWORD,
        "RememberMe":"false"})
    #print params
    newcookie=export_cookiejar(cookiejar)
 #print "Cookiejar now",newcookie
    headers={"Content-Type":"application/x-www-form-urlencoded",
            "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Encoding":"sdch",
            "Host":"mytotalconnectcomfort.com",
            "DNT":"1",
            "Origin":"https://mytotalconnectcomfort.com/portal/",
            "Cookie":newcookie,
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
        }
    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com")
    conn.request("POST", "/portal/",params,headers)
    r1 = conn.getresponse()
    #print r1.status, r1.reason

    for x in r1.getheaders():
      (n,v) = x
      #print "GOT2 HEADER",n,v
      if (n.lower() == "set-cookie"):
        cookiejar=client_cookies(v,cookiejar)
    cookie=export_cookiejar(cookiejar)
    #print "Cookiejar now",cookie
    location = r1.getheader("Location")

 if ((location == None) or (r1.status != 302)):
        #raise BaseException("Login fail" )
        print("ErrorNever got redirect on initial login  status={0} {1}".format(r1.status,r1.reason))
        return


   # Skip second query - just go directly to our device_id, rather than letting it
    # redirect us to it.

    code=str(DEVICE_ID)

    t = datetime.datetime.now()
    utc_seconds = (time.mktime(t.timetuple()))
    utc_seconds = int(utc_seconds*1000)
    #print "Code ",code

    location="/portal/Device/CheckDataSession/"+code+"?_="+str(utc_seconds)
    #print "THIRD"
    headers={
            "Accept":"*/*",
            "DNT":"1",
            #"Accept-Encoding":"gzip,deflate,sdch",
            "Accept-Encoding":"plain",
            "Cache-Control":"max-age=0",

         "Cache-Control":"max-age=0",
            "Accept-Language":"en-US,en,q=0.8",
            "Connection":"keep-alive",
            "Host":"mytotalconnectcomfort.com",
            "Referer":"https://mytotalconnectcomfort.com/portal/",
            "X-Requested-With":"XMLHttpRequest",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
            "Cookie":cookie
        }
    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com")
    #conn.set_debuglevel(999);
    #print "LOCATION R3 is",location
    conn.request("GET", location,None,headers)
    r3 = conn.getresponse()
    if (r3.status != 200):
      print("Error Didn't get 200 status on R3 status={0} {1}".format(r3.status,r3.reason))
      return


    # Print thermostat information returned

    if (action == "status"):

        #print r3.status, r3.reason
        rawdata=r3.read()

       j = json.loads(rawdata)
        #print "R3 Dump"
        #print json.dumps(j,indent=2)
        #print json.dumps(j,sort_keys=True,indent=4, separators=(',', ': '))
        #print "Success:",j['success']
        #print "Live",j['deviceLive']
        print "Indoor Temperature:",j['latestData']['uiData']["DispTemperature"]
        print "Indoor Humidity:",j['latestData']['uiData']["IndoorHumidity"]
        print "Cool Setpoint:",j['latestData']['uiData']["CoolSetpoint"]
        print "Heat Setpoint:",j['latestData']['uiData']["HeatSetpoint"]
        print "Hold Until :",j['latestData']['uiData']["TemporaryHoldUntilTime"]
        print "Status Cool:",j['latestData']['uiData']["StatusCool"]
        print "Status Heat:",j['latestData']['uiData']["StatusHeat"]
        print "Status Fan:",j['latestData']['fanData']["fanMode"]

        return

    headers={
            "Accept":'application/json; q=0.01',
            "DNT":"1",
            "Accept-Encoding":"gzip,deflate,sdch",
            'Content-Type':'application/json; charset=UTF-8',
            "Cache-Control":"max-age=0",
            "Accept-Language":"en-US,en,q=0.8",

          "Connection":"keep-alive",
            "Host":"mytotalconnectcomfort.com",
            "Referer":"https://mytotalconnectcomfort.com/portal/",
            "X-Requested-With":"XMLHttpRequest",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
            'Referer':"/TotalConnectComfort/Device/CheckDataSession/"+code,
            "Cookie":cookie
        }


    # Data structure with data we will send back

    payload = {
        "CoolNextPeriod": None,
        "CoolSetpoint": None,
        "DeviceID": DEVICE_ID,
        "FanMode": None,
        "HeatNextPeriod": None,
        "HeatSetpoint": None,
        "StatusCool": 0,
        "StatusHeat": 0,
        "SystemSwitch": None
    }

   }


    # Calculate the hold time for cooling/heating

    t = datetime.datetime.now();

    stop_time = ((t.hour+hold_time)%24) * 60 + t.minute
    stop_time = stop_time/15


    # Modify payload based on user input

    if (action == "cool"):
      payload["CoolSetpoint"] = value
      payload["StatusCool"] = 1
      payload["StatusHeat"] = 1
      payload["CoolNextPeriod"] = stop_time

    if (action == "heat"):
      payload["HeatSetpoint"] = value
      payload["StatusCool"] = 1
      payload["StatusHeat"] = 1
      payload["HeatNextPeriod"] = stop_time

    if (action == "cancel"):

  if (action == "cancel"):
      payload["StatusCool"] = 0
      payload["StatusHeat"] = 0

    if (action == "fan"):
      payload["FanMode"] = value


    # Prep and send payload

    location="/portal/Device/SubmitControlScreenChanges"

    rawj=json.dumps(payload)

    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com");
    #conn.set_debuglevel(999);
    #print "R4 will send"
    #print rawj
    conn.request("POST", location,rawj,headers)
    r4 = conn.getresponse()
    if (r4.status != 200):
      print("Error Didn't get 200 status on R4 status={0} {1}".format(r4.status,r4.reason))
      return
    else:
        print "Success in configuring thermostat!"

       print "Success in configuring thermostat!"
    #  print "R4 got 200"


def printUsage():
    print
    print "Cooling: -c temperature -t hold_time"
    print "Heating: -h temperature -t hold_time"
    print "Status: -s"
    print "Cancel: -x"
    print "Fan: -f [0=auto|1=on]"
    print
    print "Example: Set temperature to cool to 80f for 1 hour: \n\t therm.py -c 80 -t 1"
    print
    print "If no -t hold_time is provided, it will default to one hour from command time."
    print


def main():

    if sys.argv[1] == "-s":
        get_login("status")
        sys.exit()

    if sys.argv[1] == "-x":

     get_login("cancel")
        sys.exit()

    if (len(sys.argv) < 3) or (sys.argv[1] == "-help"):
        printUsage()
        sys.exit()

    if sys.argv[1] == "-c":
        get_login("cool", sys.argv[2])
        sys.exit()

    if sys.argv[1] == "-h":
        get_login("heat", sys.argv[2])
        sys.exit()

    if sys.argv[1] == "-f":
        get_login("fan", sys.argv[2])
        sys.exit()

if __name__ == "__main__":


############################ End settings ############################

 import urllib2
 import urllib
 import json
 import datetime
 import re
 import time
 import math
 import base64
 import time
 import httplib
 import sys
 import getopt
 import os
 import stat
 import subprocess
 import string

AUTH="https://mytotalconnectcomfort.com/portal"

cookiere=re. for t in toks:
    k=None
    v=None
    m=cookiere.search(t)
    if m:
      k=m.group(1)
      v=m.group(2)
      if (k in ['path','Path','HttpOnly']):
        k=None
        v=None
    if k:
      #print k,v
      container[k]=v
  return container

def export_cookiejar(jar):
  s=""
  for x in jar:
    s+='%s=%s;' % (x,jar[x])
  return s

dcompile('\s*([^=]+)\s*=\s*([^;]*)\s*')

def client_cookies(cookiestr,container):
  if not container: container={}
  toks=re.split(';|,',cookiestr)

def get_login(action, value=None, hold_time=1):

    cookiejar=None
    #print
    #print
    #print "Run at ",datetime.datetime.now()
    headers={"Content-Type":"application/x-www-form-urlencoded",
            "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Encoding":"sdch",
            "Host":"mytotalconnectcomfort.com",
            "DNT":"1",
            "Origin":"https://mytotalconnectcomfort.com/portal",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
        }
    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com")
    conn.request("GET", "/portal/",None,headers)
    r0 = conn.getresponse()
    #print r0.status, r0.reason

    for x in r0.getheaders():
      (n,v) = x
      #print "R0 HEADER",n,v
      if (n.lower() == "set-cookie"):
        cookiejar=client_cookies(v,cookiejar)
    #cookiejar = r0.getheader("Set-Cookie")

   location = r0.getheader("Location")

    retries=5
    params=urllib.urlencode({"timeOffset":"240",
        "UserName":USERNAME,
        "Password":PASSWORD,
        "RememberMe":"false"})
    #print params
    newcookie=export_cookiejar(cookiejar)
    #print "Cookiejar now",newcookie
    headers={"Content-Type":"application/x-www-form-urlencoded",
            "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Encoding":"sdch",
            "Host":"mytotalconnectcomfort.com",
            "DNT":"1",
            "Origin":"https://mytotalconnectcomfort.com/portal/",
            "Cookie":newcookie,
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
        }
    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com")
    conn.request("POST", "/portal/",params,headers)
    r1 = conn.getresponse()
    #print r1.status, r1.reason

  for x in r1.getheaders():
      (n,v) = x
      #print "GOT2 HEADER",n,v
      if (n.lower() == "set-cookie"):
        cookiejar=client_cookies(v,cookiejar)
    cookie=export_cookiejar(cookiejar)
    #print "Cookiejar now",cookie
    location = r1.getheader("Location")

    if ((location == None) or (r1.status != 302)):
        #raise BaseException("Login fail" )
        print("ErrorNever got redirect on initial login  status={0} {1}".format(r1.status,r1.reason))
        return


   # Skip second query - just go directly to our device_id, rather than letting it
    # redirect us to it.

    code=str(DEVICE_ID)

    t = datetime.datetime.now()
    utc_seconds = (time.mktime(t.timetuple()))
    utc_seconds = int(utc_seconds*1000)
    #print "Code ",code

  location="/portal/Device/CheckDataSession/"+code+"?_="+str(utc_seconds)
    #print "THIRD"
    headers={
            "Accept":"*/*",
            "DNT":"1",
            #"Accept-Encoding":"gzip,deflate,sdch",
            "Accept-Encoding":"plain",
            "Cache-Control":"max-age=0",
            "Accept-Language":"en-US,en,q=0.8",
            "Connection":"keep-alive",
            "Host":"mytotalconnectcomfort.com",
            "Referer":"https://mytotalconnectcomfort.com/portal/",
            "X-Requested-With":"XMLHttpRequest",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
            "Cookie":cookie
        }
    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com")
    #conn.set_debuglevel(999);
    #print "LOCATION R3 is",location
    conn.request("GET", location,None,headers)
    r3 = conn.getresponse()
    if (r3.status != 200):
      print("Error Didn't get 200 status on R3 status={0} {1}".format(r3.status,r3.reason))

   return


    # Print thermostat information returned

    if (action == "status"):

        #print r3.status, r3.reason
        rawdata=r3.read()
        j = json.loads(rawdata)
        #print "R3 Dump"
        #print json.dumps(j,indent=2)
        #print json.dumps(j,sort_keys=True,indent=4, separators=(',', ': '))
        #print "Success:",j['success']
        #print "Live",j['deviceLive']
        print "Indoor Temperature:",j['latestData']['uiData']["DispTemperature"]
        print "Indoor Humidity:",j['latestData']['uiData']["IndoorHumidity"]
        print "Cool Setpoint:",j['latestData']['uiData']["CoolSetpoint"]
        print "Heat Setpoint:",j['latestData']['uiData']["HeatSetpoint"]
        print "Hold Until :",j['latestData']['uiData']["TemporaryHoldUntilTime"]
        print "Status Cool:",j['latestData']['uiData']["StatusCool"]
        print "Status Heat:",j['latestData']['uiData']["StatusHeat"]
        print "Status Fan:",j['latestData']['fanData']["fanMode"]

      return

    headers={
            "Accept":'application/json; q=0.01',
            "DNT":"1",
            "Accept-Encoding":"gzip,deflate,sdch",
            'Content-Type':'application/json; charset=UTF-8',
            "Cache-Control":"max-age=0",
            "Accept-Language":"en-US,en,q=0.8",
            "Connection":"keep-alive",
            "Host":"mytotalconnectcomfort.com",
            "Referer":"https://mytotalconnectcomfort.com/portal/",
            "X-Requested-With":"XMLHttpRequest",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
            'Referer':"/TotalConnectComfort/Device/CheckDataSession/"+code,
            "Cookie":cookie
        }


    # Data structure with data we will send back

    payload = {
        "CoolNextPeriod": None,
        "CoolSetpoint": None,

     "DeviceID": DEVICE_ID,
        "FanMode": None,
        "HeatNextPeriod": None,
        "HeatSetpoint": None,
        "StatusCool": 0,
        "StatusHeat": 0,
        "SystemSwitch": None
    }


    # Calculate the hold time for cooling/heating

    t = datetime.datetime.now();

    stop_time = ((t.hour+hold_time)%24) * 60 + t.minute
    stop_time = stop_time/15


    # Modify payload based on user input

    if (action == "cool"):
      payload["CoolSetpoint"] = value
      payload["StatusCool"] = 1
      payload["StatusHeat"] = 1

     payload["CoolNextPeriod"] = stop_time

    if (action == "heat"):
      payload["HeatSetpoint"] = value
      payload["StatusCool"] = 1
      payload["StatusHeat"] = 1
      payload["HeatNextPeriod"] = stop_time

    if (action == "cancel"):
      payload["StatusCool"] = 0
      payload["StatusHeat"] = 0

    if (action == "fan"):
      payload["FanMode"] = value


    # Prep and send payload

    location="/portal/Device/SubmitControlScreenChanges"

    rawj=json.dumps(payload)

    conn = httplib.HTTPSConnection("mytotalconnectcomfort.com");
    #conn.set_debuglevel(999);

   #print "R4 will send"
    #print rawj
    conn.request("POST", location,rawj,headers)
    r4 = conn.getresponse()
    if (r4.status != 200):
      print("Error Didn't get 200 status on R4 status={0} {1}".format(r4.status,r4.reason))
      return
    else:
        print "Success in configuring thermostat!"
    #  print "R4 got 200"


def printUsage():
    print
    print "Cooling: -c temperature -t hold_time"
    print "Heating: -h temperature -t hold_time"
    print "Status: -s"
    print "Cancel: -x"
    print "Fan: -f [0=auto|1=on]"
    print
    print "Example: Set temperature to cool to 80f for 1 hour: \n\t therm.py -c 80 -t 1"
    print
    print "If no -t hold_time is provided, it will default to one hour from command time."
    print

   print


def main():

    if sys.argv[1] == "-s":
        get_login("status")
        sys.exit()

    if sys.argv[1] == "-x":
        get_login("cancel")
        sys.exit()

    if (len(sys.argv) < 3) or (sys.argv[1] == "-help"):
        printUsage()
        sys.exit()

    if sys.argv[1] == "-c":
        get_login("cool", sys.argv[2])
        sys.exit()

    if sys.argv[1] == "-h":
        get_login("heat", sys.argv[2])
        sys.exit()

    if sys.argv[1] == "-f":
        get_login("fan", sys.argv[2])
        sys.exit()

if __name__ == "__main__":
    main()

My HoneyWell Wifi Thermostat scripts for status and management.

#!/bin/bash
#
# Script by Jamie R. Cid
# jay@cidcomm.com
#
#Get data from MyTotalControl and send to OH. This grabs one copy of the data and stores it instead of doing it for every request below. That's how you get blocked ;)
echo Getting Data from MyTotalControl Website
/etc/thermostat.py -s > /var/log/honeywell.log
TEMPDATA="/var/log/honeywell.log"
#
#
echo Checking Indoor Temp
TEMPSTATUS=$( grep "Indoor Temperature" $TEMPDATA | sed -n -e 's/^.*Indoor Temperature: //p')
curl --header "Content-Type: text/plain" --request POST --data "$TEMPSTATUS" http://10.1.100.23:10005/rest/items/IndTemp
echo $TEMPSTATUS
#
echo Checking Heat Setpoint
HEATSTATUS=$( grep "Heat Setpoint" $TEMPDATA | sed -n -e 's/^.*Heat Setpoint: //p')
curl --header "Content-Type: text/plain" --request POST --data "$HEATSTATUS" http://10.1.100.23:10005/rest/items/IndHeat
curl --header "Content-Type: text/plain" --request POST --data "$HEATSTATUS" http://10.1.100.23:10005/rest/items/IndHeatSet
echo $HEATSTATUS
#
echo Checking Heat On/Off Status
HEATERSTATUS=$( grep "Status Heat" $TEMPDATA | sed -n -e 's/^.*Status Heat: //p')
curl --header "Content-Type: text/plain" --request POST --data "$HEATERSTATUS" http://10.1.100.23:10005/rest/items/IndHeaterStatus
echo $HEATERSTATUS
#
echo Checking Fan Status
FANSTATUS=$( grep "Status Fan" $TEMPDATA | sed -n -e 's/^.*Status Fan: //p')
curl --header "Content-Type: text/plain" --request POST --data "$FANSTATUS" http://10.1.100.23:10005/rest/items/IndFanStatus
echo $FANSTATUS
#
echo Checking Hold Status
HOLDSTATUS=$( grep "Hold Until" $TEMPDATA | sed -n -e 's/^.*Hold Until : //p')
curl --header "Content-Type: text/plain" --request POST --data "$HOLDSTATUS" http://10.1.100.23:10005/rest/items/IndHoldStatus
echo $HOLDSTATUS


exit 0


My Netbook check battery percentage script: (ran every 2 min from rules)

#!/bin/bash

# This gets all details of the battery to send out in below email
batterystatus=$(/usr/bin/upower -i /org/freedesktop/UPower/devices/battery_BAT1| grep -E 'percentage')

# This gets the integer percentage of current battery capacity
powerstatus=$(/usr/bin/upower -i /org/freedesktop/UPower/devices/battery_BAT1| grep -E 'percentage' | awk '{print $2}' | cut -c -3)

# if batterystatus < 25% send email
if [ "$powerstatus" -lt 25 ]
then
    echo "Battery State is LOW"
    echo "OpenHab battery"$batterystatus | mail -s "OpenHab Status (Low Battery!)" -a "From: "OpenHab" <noreply@cidcomm.com>" alerts@cidcomm.com
    curl --header "Content-Type: text/plain" --request POST --data "$powerstatus" http://10.1.100.23:10005/rest/items/HostBatteryPercentage
else
    echo "Battery State Nominal"
    #echo $batterystatus | mail -s "OpenHab Status (Battery OK!)" -a "From: "OpenHab" <noreply@cidcomm.com>" jay@cidcomm.com
    curl --header "Content-Type: text/plain" --request POST --data "$powerstatus" http://10.1.100.23:10005/rest/items/HostBatteryPercentage
# Debug Output
#echo $batterystatus
#echo $powerstatus
fi

My netbook check power status script: (ran every 2 min from rules)

#!/bin/bash

# This gets all battery details for emailing below
powerstats=$(/usr/bin/upower -i /org/freedesktop/UPower/devices/battery_BAT1)

# This gets the current battery charging or discharging details
ac=$(/usr/bin/upower -i /org/freedesktop/UPower/devices/battery_BAT1| grep 'state' | awk '{print $2}')

# if on battery send email
if [ "$ac" = discharging ]
then
    echo "OpenHab on Battery!(AC LOSS)"
    echo $powerstats | mail -s "OpenHab Status (AC LOSS!)" -a "From: "OpenHab" <noreply@cidcomm.com>" alerts@cidcomm.com
    curl --header "Content-Type: text/plain" --request POST --data "$ac" http://10.1.100.23:10005/rest/items/HostBatteryState
else
    echo "OpenHab on AC!"
    #echo $powerstats | mail -s "OpenHab Status (OK!)" -a "From: "OpenHab" <noreply@cidcomm.com>" jay@cidcomm.com
    curl --header "Content-Type: text/plain" --request POST --data "$ac" http://10.1.100.23:10005/rest/items/HostBatteryState
fi


Nice. Anything updated ?

Hi Jen,

Yes Tons lol… Stand by ill go through and update them now and let ya kno.

Items File:

/* Group for persistence */
Group persist
Group:Number:MIN gBattery "Minimum Battery Level [%d]" <temperature>
Group:Contact:OR(OPEN,CLOSED) gMotionSensors (All)
Group:Contact:OR(OPEN,CLOSED) gDoorSensors (All)
Group:Contact:OR(OPEN,CLOSED) gTamper (All)
Group:Contact:OR(OPEN,CLOSED) gSmoke(All)
Group:Contact:OR(OPEN,CLOSED) gWindows(All)
Group gGarageLights (All)
Group gAllLights (All)
Group gAllSirensSwitch (All)
Group gAllSirensSet (All)
Group gBattery (All)
String Notification_Proxy

/* Garage */
Number Switch1 "Door Status  [MAP(garage.map):%d]" <garage> (persist) 
Switch relay1 "Garage" <garage> (persist) { autoupdate="false",http=">[ON:GET:http://10.1.100.200/index.php?trigger=1] >[OFF:GET:http://10.1.100.200/index.php?trigger=1]" }
Dimmer Garage_Left_Light "Left Garage: [%d %%]" <hue> (persist,gAllLights,gGarageLights) { zwave="16:command=SWITCH_MULTILEVEL" }
Dimmer Garage_Right_Light "Right Garage: [%d %%]" <hue> (persist,gAllLights,gGarageLights) { zwave="17:command=SWITCH_MULTILEVEL" }

/* Temperature */
Number IndHeat "Set Point [%.0f °F]" <temperature> (persist)
Number Temperature "Temperature [%.2f °F]" <temperature> (persist) {weather="locationId=home, type=temperature, property=current, unit=fahrenheit"}
Number Humidity "Humidity [%d %%]" <temperature> (persist) {weather="locationId=home, type=atmosphere, property=humidity"}
String Condition "Condition [%s]" <temperature> (persist) {weather="locationId=home, type=condition, property=text"}
DateTime ObservationTime "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" <temperature> (persist) {weather="locationId=home, type=condition, property=observationTime"}
Number Clouds "Clouds [%.0f %%]" <temperature> (persist) {weather="locationId=home, type=clouds, property=percent"}
Number Visibility_Mph "Visibility [%.2f mi]" <temperature> (persist) {weather="locationId=home, type=atmosphere, property=visibility, unit=mph"}
Number Wind_Speed_Mph "Windspeed [%.2f mph]" <temperature> (persist) {weather="locationId=home, type=wind, property=speed, unit=mph"}
Number IndHoldStatus "Hold Status [MAP(thermostat2.map):%d]" <temperature> (persist)
Number IndHeaterStatus "Heat Fan [MAP(thermostat.map):%d]" <temperature> (persist)
Number IndFanStatus "Manual Fan [MAP(thermostat.map):%d]" <temperature> (persist)
Number IndTemp "Indoor Temp [%.0f °F]" <temperature> (persist)
Number SendTemp "[%.0f °F]" (persist) 
Number IndHeatSet "Heating [%.0f °F]" (persist)
String IndHeatRes "Resume Schedule" <temperature> (persist) { autoupdate="false",exec=">[ON:python /etc/therm.py -x] >[OFF:python /etc/therm.py -x]" }

/* Kitchen Items */
Contact Lower_Kitchen_Motion_Sensor "Motion: [%s]" <door> (persist,gMotionSensors) {zwave="6:command=SENSOR_BINARY"}
Contact Lower_Kitchen_Motion_Sensor_Tamper "Motion Tamper: [%s]" <lock> (persist,gTamper) {zwave="6:command=ALARM"}
Number Lower_Kitchen_Motion_Sensor_Battery "Motion Battery: [%d %%]" <battery> (persist,gBattery) {zwave="6:command=BATTERY"}
Number Meter_Energy "Total energy usage [%.2f KWh]" <energy> (persist,gDashboard) { zwave="4:command=meter,meter_scale=E_KWh,refresh_interval=60"}
Number Meter_Power "Power consumption [%.2f W]" <energy> (persist) { zwave="4:command=meter,meter_scale=E_W,refresh_interval=60"}
Contact Lower_Kitchen_Patio_Sensor "Patio Door: [%s]" <door> (persist,gDoorSensors) {zwave="10:command=SENSOR_BINARY"}
Contact Lower_Kitchen_Patio_Sensor_Tamper "Tamper: [%s]" <lock> (persist,gTamper) {zwave="10:command=ALARM, refresh_interval=20"}
Number Lower_Kitchen_Patio_Sensor_Battery "Battery: [%d %%]" <battery> (persist,gBattery) {zwave="10:command=BATTERY"}
Contact Lower_Kitchen_MainDoor_Sensor "Garage Door: [%s]" <door> (persist,gDoorSensors) {zwave="9:command=SENSOR_BINARY"}
Contact Lower_Kitchen_MainDoor_Sensor_Tamper "Tamper: [%s]" <lock> (persist,gTamper) {zwave="9:command=ALARM, refresh_interval=20"}
Number Lower_Kitchen_MainDoor_Sensor_Battery "Battery: [%d %%]" <battery> (persist,gBattery) {zwave="9:command=BATTERY"}
Dimmer Lower_Kitchen_Patio_Light "Patio Door [%d %%]" <hue> (persist,gAllLights) { zwave="2:command=SWITCH_MULTILEVEL" }
Dimmer Lower_Kitchen_Sink_Light "Kitchen Sink: [%d %%]" <hue> (persist,gAllLights) { zwave="15:command=SWITCH_MULTILEVEL" }

/* LivingRoom Items */
Dimmer Lower_LivingRoom_DoorWay_Light "Doorway Light: [%d %%]" <hue> (persist,gAllLights) { zwave="18:command=SWITCH_MULTILEVEL" }
Dimmer Lower_LivingRoom_TV_Light "TV Light [%d %%]" <hue> (persist,gAllLights) { zwave="3:command=SWITCH_MULTILEVEL" }
Contact Lower_LivingRoom_Motion_Sensor "Motion: [%s]" <door> (persist,gMotionSensors) {zwave="8:command=SENSOR_BINARY"}
Contact Lower_LivingRoom_Motion_Sensor_Tamper "Motion Tamper: [%s]" <lock> (persist,gTamper) {zwave="8:command=ALARM"}
Number Lower_LivingRoom_Motion_Sensor_Battery "Motion Battery: [%d %%]" <battery> (persist,gBattery) {zwave="8:command=BATTERY"}
Contact Lower_LivingRoom_FrontDoor_Sensor "Front Door: [%s]" <door> (persist,gDoorSensors) {zwave="11:command=SENSOR_BINARY"}
Contact Lower_LivingRoom_FrontDoor_Sensor_Tamper "Tamper: [%s]" <lock> (persist,gTamper) {zwave="11:command=ALARM, refresh_interval=20"}
Number Lower_LivingRoom_FrontDoor_Sensor_Battery "Battery: [%d %%]" <battery> (persist,gBattery) {zwave="11:command=BATTERY"}

/* Bedrooms */
Contact Upper_BedRoom_Window_Sensor "Zach Window: [%s]" <contact> (persist,gWindows) {zwave="7:command=basic,respond_to_basic=true"}
Contact Upper_BedRoom_Window_Sensor_Tamper "Tamper: [%s]" <lock> (persist,gTamper) {zwave="7:command=ALARM"}
Number Upper_BedRoom_Window_Sensor_Battery "Battery: [%d %%]" <battery> (persist,gBattery) {zwave="7:command=BATTERY"}
Switch Upper_BedRoom_Power_Switch "Entertainment:" <hue> (persist) { zwave="4:command=SWITCH_BINARY" }

/* TV */
Switch SharpTVPower "TV Power" <television> { autoupdate="false",exec=">[ON:python3 /etc/orvibo/orvibo.py -i 10.1.100.28 -e /etc/orvibo/tv/sharp-power.ir] >[OFF:python3 /etc/orvibo/orvibo.py -i 10.1.100.28 -e /etc/orvibo/tv/sharp-power.ir]" }
String SharpTVInput "TV Input" <television> { autoupdate="false",sharptv = "uid=livingroom, bindingType=input" }
Switch SharpTVMute "TV Mute" <television> { autoupdate="false",exec=">[ON:python3 /etc/orvibo/orvibo.py -i 10.1.100.28 -e /etc/orvibo/tv/sharp-mute.ir] >[OFF:python3 /etc/orvibo/orvibo.py -i 10.1.100.28 -e /etc/orvibo/tv/sharp-mute.ir]" }
String LivingRoomTVState "TV Status: [%s]" <television>
String KodiState "Kodi Status: [%s]" <television>

/*Media Center */
String LRKodiPC "LivingRoom Kodi" <television> { autoupdate="false",exec=">[0:ssh root@10.1.100.29 shutdown -h now] >[1:wakeonlan 90:2b:34:18:24:a2]" }

/* Astro */
DateTime Sunrise_Time "SunRise [%1$tr]" <moon> (persist) { astro="planet=sun, type=rise, property=start" }
DateTime Sunset_Time "SunSet [%1$tr]" <sun>  (persist) { astro="planet=sun, type=set, property=end" }
Switch Sunset_Time_Task (persist) { astro="planet=sun, type=set, property=end" }

/* Aeon Labs Siren - set sound/volume and activate*/
Number Lower_Kitchen_Siren_Number "Kitchen Siren" <siren> (persist,gAllSirensSet) { zwave="5:command=configuration,parameter=37" }
Number Upper_Hall_Siren_Number "Upper Hall Siren" <siren> (persist,gAllSirensSet) { zwave="12:command=configuration,parameter=37" }

/* Aeon Labs Siren - switch to turn on/off sirens*/
Switch Lower_Kitchen_Siren_Switch "Kitchen Siren" <siren> (persist,gAllSirensSwitch) { zwave="5:command=switch_binary" }
Switch Upper_Hall_Siren_Switch "Upper Hall Siren" <siren> (persist,gAllSirensSwitch) { zwave="12:command=switch_binary" }

/* First Alert Carbon and Smoke alarm */
Contact    Lower_LivingRoom_Smoke_Sensor "LivingRoom Smoke Alarm [%s]" <fire> (persist,gSmoke) { zwave="14:command=ALARM" }
Number    Lower_LivingRoom_Smoke_Sensor_Battery "Smoke Alarm Battery [%s %%]" <battery> (persist,gBattery) { zwave="14:command=BATTERY" }
Contact Upper_Hall_Smoke_Sensor "Hall Smoke Alarm [%s]" <fire> (persist,gSmoke) { zwave="13:command=ALARM" }
Number  Upper_Hall_Smoke_Sensor_Battery "Smoke Alarm Battery [%s %%]" <battery> (persist,gBattery) { zwave="13:command=BATTERY" }

/* Scene Switches */
Number OnWayHomeScene <house> {autoupdate="false"}
Number AllOffScene <house> {autoupdate="false"}
Number MovieTimeScene <house> {autoupdate="false"}
Number sAllLightsOff <house> {autoupdate="false"}
Number sAllLightsOn <house> {autoupdate="false"}

/* Alarm System */
Number AlarmSysStatus "System Status: [MAP(alarm.map):%d]" <shield> (persist)
Number AlarmArmDisarm "Alarm Arm / Disarm:" <shield> (persist) {autoupdate="false"}

/* OpenHab System */
Number HostBatteryPercentage "Host Battery Percentage: [%d %%]" <battery> (persist)
String HostBatteryState "Host Battery State: [%s]" <battery> (persist)

/* Node Check */
DateTime Node2 "Node2 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="2:command=INFO,item=LAST_UPDATE"}
DateTime Node3 "Node3 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="3:command=INFO,item=LAST_UPDATE"}
DateTime Node4 "Node4 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="4:command=INFO,item=LAST_UPDATE"}
DateTime Node5 "Node5 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="5:command=INFO,item=LAST_UPDATE"}
DateTime Node6 "Node6 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="6:command=INFO,item=LAST_UPDATE"}
DateTime Node7 "Node7 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="7:command=INFO,item=LAST_UPDATE"}
DateTime Node8 "Node8 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="8:command=INFO,item=LAST_UPDATE"}
DateTime Node9 "Node9 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="9:command=INFO,item=LAST_UPDATE"}
DateTime Node10 "Node10 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="10:command=INFO,item=LAST_UPDATE"}
DateTime Node11 "Node11 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="11:command=INFO,item=LAST_UPDATE"}
DateTime Node12 "Node12 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="12:command=INFO,item=LAST_UPDATE"}
DateTime Node13 "Node13 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="13:command=INFO,item=LAST_UPDATE"}
DateTime Node14 "Node14 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="14:command=INFO,item=LAST_UPDATE"}
DateTime Node15 "Node15 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="15:command=INFO,item=LAST_UPDATE"}
DateTime Node16 "Node16 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="16:command=INFO,item=LAST_UPDATE"}
DateTime Node17 "Node17 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="17:command=INFO,item=LAST_UPDATE"}
DateTime Node18 "Node18 Update [%1$ta %1$td-%1$tm %1$tr]" (persist) {zwave="18:command=INFO,item=LAST_UPDATE"}

1 Like

Sitemap File:

sitemap default label="Jays House - Main Menu"
{
      
     
        Frame label="" {
        Text label="Scene Menu" icon="house" {
        Frame label="Scenes" {
        Switch item=OnWayHomeScene label="On Way Home" mappings=[1="Activate"]
        Switch item=AllOffScene label="Bed Time" mappings=[1="Activate"]
        Switch item=MovieTimeScene label="Movie Time" mappings=[1="Activate"]
        Switch item=sAllLightsOff label="All Lights Off" mappings=[1="Activate"]
        Switch item=sAllLightsOn label="All Lights On" mappings=[1="Activate"]

     }}}
        Frame label="" {
        Text label="Weather Menu" icon="temperature" {
        Frame label="" {
        
        Text item=Sunrise_Time
        Text item=Sunset_Time
        Text item=Temperature
        Text item=Humidity
        Text item=Condition
        Text item=Clouds
        Text item=Visibility_Mph
        Text item=Wind_Speed_Mph
     }}}
        Frame label="" {
        Text label="Home Thermostat" icon="house" {
        Frame label="" {

        Text item=IndHoldStatus
        Text item=IndHeaterStatus
        Text item=IndFanStatus
        Text item=IndTemp
        Text item=IndHeat
        Setpoint item=IndHeatSet icon="temperature" minValue=60 maxValue=75 step=1
        Switch item=IndHeatRes icon="temperature" label="Resume Schedule" mappings=[ON="Resume"]
     }}}
    Frame label="" {
        Text label="Garage" icon="garage" {
        Frame label="Garage Items" {
        Text item=Switch1 valuecolor=[0="green",1="red"]
        Switch item=relay1 label="Open/Close" mappings=[ON="Activate"]
        Slider item=Garage_Right_Light
        Slider item=Garage_Left_Light
     }}}
        Frame label="" {
        Text label="Media Menu" icon="television" {
        Frame label="TV Items" {
        Switch item=SharpTVPower label="TV Power:" mappings=[ON="Power"]
        Switch item=SharpTVInput label="TV Input:" mappings=[0="TV",4="Kodi"]
        Switch item=SharpTVMute label="TV Mute:" mappings=[ON="Mute"]
        Switch item=LRKodiPC label="Kodi Power:" mappings=[0="Off",1="On"]
        Text item=LivingRoomTVState valuecolor=[ON="green",OFF="red"]
        Text item=KodiState valuecolor=[ON="green",OFF="red"]
     }}}
        Frame label="" {
        Text label="Rooms"  icon="house" {
        Group label="Kitchen" icon="kitchen" {
        Frame label="Kitchen Items" {
        Group label=Lights icon="hue" {
        Slider item=Lower_Kitchen_Sink_Light
        Slider item=Lower_Kitchen_Patio_Light
        }
        Group label=Motion icon="sensor" {
        Text item=Lower_Kitchen_Motion_Sensor
        Text item=Lower_Kitchen_Motion_Sensor_Tamper
        Text item=Lower_Kitchen_Motion_Sensor_Battery
        }
        Group label=Doors icon="sensor" {
        Text item=Lower_Kitchen_MainDoor_Sensor
        Text item=Lower_Kitchen_MainDoor_Sensor_Tamper
        Text item=Lower_Kitchen_MainDoor_Sensor_Battery
        Text item=Lower_Kitchen_Patio_Sensor
        Text item=Lower_Kitchen_Patio_Sensor_Tamper
        Text item=Lower_Kitchen_Patio_Sensor_Battery
        }}}
        Group label="LivingRoom" icon="groundfloor" {
        Frame label="LivingRoom Items" {
        Group label=Lights icon="hue" {
        Slider item=Lower_LivingRoom_TV_Light
        Slider item=Lower_LivingRoom_DoorWay_Light
        }
        Group label=Motion icon="sensor" {
        Text item=Lower_LivingRoom_Motion_Sensor
        Text item=Lower_LivingRoom_Motion_Sensor_Tamper
        Text item=Lower_LivingRoom_Motion_Sensor_Battery
        }
        Group label=Doors icon="sensor" {
        Text item=Lower_LivingRoom_FrontDoor_Sensor
        Text item=Lower_LivingRoom_FrontDoor_Sensor_Tamper
        Text item=Lower_LivingRoom_FrontDoor_Sensor_Battery
        }
        Group label=Smoke icon="sensor" {
        Text item=Lower_LivingRoom_Smoke_Sensor
        Text item=Lower_LivingRoom_Smoke_Sensor_Battery
        }}}
        Group label=Zach icon="boy0" {
        Frame label="Zachs Items" {
        Text item=Upper_BedRoom_Window_Sensor
        Text item=Upper_BedRoom_Window_Sensor_Tamper
        Text item=Upper_BedRoom_Window_Sensor_Battery
        Switch item=Upper_BedRoom_Power_Switch
        Text item=Meter_Energy
        Text item=Meter_Power
        }}
        Group label=Jay icon="parents" {
        Frame label="Jay's Items" {
        Text item=Upper_Hall_Smoke_Sensor
        Text item=Upper_Hall_Smoke_Sensor_Battery
        Switch item=Upper_Hall_Siren_Switch
        Switch item=Lower_Kitchen_Siren_Switch
        Text item=HostBatteryPercentage
        Text item=HostBatteryState
        Text item=Node2
        Text item=Node3
        Text item=Node4
        Text item=Node5
        Text item=Node6
        Text item=Node7
        Text item=Node8
        Text item=Node9
        Text item=Node10
        Text item=Node11
        Text item=Node12
        Text item=Node13
        Text item=Node14
        Text item=Node15
        Text item=Node16
        Text item=Node17
        Text item=Node18
        }}}}
        Frame label="" {
        Text label="Alarm Menu" icon="shield" {
        Frame label="Alarm System" {
        Text item=AlarmSysStatus valuecolor=[1="green",2="red",3="orange"]
        Switch item=AlarmArmDisarm label="Arm / Disarm:" mappings=[1="DISARM",3="ARM-STAY",2="ARM-AWAY"]
        }}}
}

1 Like

Should be all current now…

one more, voicerss-cli.pl

Script to convert TTS to wave files for static usage. Used to be for google but converted to voicerss. Make sure you add your API key in the file. Search for “YOURAPIKEY” in the file.

Usage is:
/etc/voicerss-cli.pl -t “window is open.” -o /usr/share/openhab/sounds/windoisopen.wav

There are settings in the file you can adjust like speed etc…

#!/usr/bin/env perl

#
# Script that uses VoiceRSS Translate for text to speech synthesis.
#
# Copyright (C) 2016, Jamie R Cid
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2.
#

use warnings;
use strict;
use Getopt::Std;
use File::Temp qw(tempfile);
use CGI::Util qw(escape);
use LWP::UserAgent;

my %options;
my @text;
my @mp3list;
my @soxargs;
my $samplerate;
my $input;
my $speed   = 1.0;
my $lang    = "en-us";
my $tmpdir  = "/tmp";
my $timeout = 10;
my $url     = "http://api.voicerss.org";
my $mpg123  = `/usr/bin/which mpg123`;
my $sox     = `/usr/bin/which sox`;

VERSION_MESSAGE() if (!@ARGV);

getopts('o:l:r:t:f:s:hqv', \%options);

# Dislpay help messages #
VERSION_MESSAGE() if (defined $options{h});
lang_list("dislpay") if (defined $options{v});

if (!$mpg123 || !$sox) {
    say_msg("mpg123 or sox is missing. Aborting.");
    exit 1;
}
chomp($mpg123, $sox);

# Get input text #
if (defined $options{t}) {
    $input = $options{t};
} elsif (defined $options{f}) {
    if (open(my $fh, "<", "$options{f}")) {
        $input = do { local $/; <$fh> };
        close($fh);
    } else {
        say_msg("Cant read file $options{f}");
        exit 1;
    }
} else {
    say_msg("No text passed for synthesis.");
    exit 1;
}

if (defined $options{l}) {
# check if language setting is valid #
    my %lang_list = lang_list("list");
    if (grep { $_ eq $options{l} } values %lang_list) {
        $lang = $options{l};
    } else {
        say_msg("Invalid language setting. Aborting.");
        exit 1;
    }
}

if (defined $options{r}) {
# set audio sample rate #
    if ($options{r} =~ /\d+/) {
        $samplerate = $options{r};
    } else {
        say_msg("Invalid sample rate, using default.");
    }
}

if (defined $options{s}) {
# set speed factor #
    if ($options{s} =~ /\d+/) {
        $speed = $options{s};
    } else {
        say_msg("Invalind speed factor, using default.");
    }
}

for ($input) {
# Split input to comply with google tts requirements #
    s/[\\|*~<>^\n\(\)\[\]\{\}[:cntrl:]]/ /g;
    s/\s+/ /g;
    s/^\s|\s$//g;
    if (!length) {
        say_msg("No text passed for synthesis.");
        exit 1;
    }
    $_ .= "." unless (/^.+[.,?!:;]$/);
    @text = /.{1,100}[.,?!:;]|.{1,100}\s/g;
}

my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/5.0 (X11; Linux; rv:8.0) Gecko/20100101");
$ua->timeout($timeout);

foreach my $line (@text) {
# Get speech data from google and save them in temp files #
    $line =~ s/^\s+|\s+$//g;
    last if (length($line) == 0);
    $line = escape($line);
    #my $request = HTTP::Request->new('GET' => "$url?tl=$lang&q=$line&client=openHAB");
    my $request = HTTP::Request->new('GET' => "$url?key=YOURAPIKEY&hl=$lang&src=$line&c=mp3&f=ulaw_44khz_stereo");
        my $response = $ua->request($request);
    if (!$response->is_success) {
        say_msg("Failed to fetch speech data.");
        exit 1;
    } else {
        my ($mp3fh, $mp3name) = tempfile(
            "tts_XXXXXX",
            SUFFIX => ".mp3",
            DIR    => $tmpdir,
            UNLINK => 1,
        );
        if (!open($mp3fh, ">", "$mp3name")) {
            say_msg("Cant read temp file $mp3name");
            exit 1;
        }
        print $mp3fh $response->content;
        close $mp3fh;
        push(@mp3list, $mp3name);
    }
}

# create a temp wav file to concatenate all sound data #
my ($wav_fh, $wav_name) = tempfile(
    "tts_XXXXXX",
    SUFFIX => ".wav",
    DIR    => $tmpdir,
    UNLINK => 1,
);

# decode mp3s and concatenate #
if (system($mpg123, "-q", "-w", $wav_name, @mp3list)) {
    say_msg("mpg123 failed to process sound file.");
    exit 1;
}

# Sex sox args and process wav file #
if (defined $options{o}) {
    @soxargs = ($sox, "-q", $wav_name, $options{o});
    push(@soxargs, ("rate", $samplerate)) if ($samplerate);
} else {
    @soxargs = ($sox, "-q", $wav_name, "-d");
}
push(@soxargs, ("tempo", "-s", $speed)) if ($speed != 1);

if (system(@soxargs)) {
    say_msg("sox failed to process sound file.");
    exit 1;
}

exit 0;

sub say_msg {
# Print messages to user if 'quiet' flag is not set #
    my $message = shift;
    warn "$0: $message" if (!defined $options{q});
    return;
}

sub VERSION_MESSAGE {
# Help message #
    print "Text to speech synthesis using google voice.\n\n",
         "Supported options:\n",
         " -t <text>      text string to synthesize\n",
         " -f <file>      text file to synthesize\n",
         " -l <lang>      specify the language to use, defaults to 'en' (English)\n",
         " -o <filename>  write output as WAV file\n",
         " -r <rate>      specify the output sampling rate in Hertz (default 22050)\n",
         " -s <factor>    specify the output speed factor (default 1.2)\n",
         " -q             quiet (Don't print any messages or warnings)\n",
         " -h             this help message\n",
         " -v             suppoted languages list\n\n",
         "Examples:\n",
         "$0 -l en -t \"Hello world\"\n Have the synthesized speech played back to the user.\n",
         "$0 -o hello.wav -l en -t \"Hello world\"\n Save the synthesized speech as a wav file.\n\n";
    exit 1;
}

sub lang_list {
# Display the list of supported languages to the user or return it as a hash #
    my $opt = shift;
    my %sup_lang = ("Afrikaans", "af", "Albanian", "sq", "Amharic", "am", "Arabic", "ar",
        "Armenian", "hy", "Azerbaijani", "az", "Basque", "eu", "Belarusian", "be", "Bengali", "bn",
        "Bihari", "bh", "Bosnian", "bs", "Breton", "br", "Bulgarian", "bg", "Cambodian", "km",
        "Catalan", "ca", "Chinese (Simplified)", "zh-CN", "Chinese (Traditional)", "zh-TW",
        "Corsican", "co", "Croatian", "hr", "Czech", "cs", "Danish", "da", "Dutch", "nl",
        "English", "en", "Esperanto", "eo", "Estonian", "et", "Faroese", "fo", "Filipino", "tl",
        "Finnish", "fi", "French", "fr", "Frisian", "fy", "Galician", "gl", "Georgian", "ka",
        "German", "de", "Greek", "el", "Guarani", "gn", "Gujarati", "gu", "Hacker", "xx-hacker",
        "Hausa", "ha", "Hebrew", "iw", "Hindi", "hi", "Hungarian", "hu", "Icelandic", "is",
        "Indonesian", "id", "Interlingua", "ia", "Irish", "ga", "Italian", "it", "Japanese", "ja",
        "Javanese", "jw", "Kannada", "kn", "Kazakh", "kk", "Kinyarwanda", "rw", "Kirundi", "rn",
        "Klingon", "xx-klingon", "Korean", "ko", "Kurdish", "ku", "Kyrgyz", "ky", "Laothian", "lo",
        "Latin", "la", "Latvian", "lv", "Lingala", "ln", "Lithuanian", "lt", "Macedonian", "mk",
        "Malagasy", "mg", "Malay", "ms", "Malayalam", "ml", "Maltese", "mt", "Maori", "mi",
        "Marathi", "mr", "Moldavian", "mo", "Mongolian", "mn", "Montenegrin", "sr-ME", "Nepali", "ne",
        "Norwegian", "no", "Norwegian (Nynorsk)", "nn", "Occitan", "oc", "Oriya", "or", "Oromo", "om",
        "Pashto", "ps", "Persian", "fa", "Pirate", "xx-pirate", "Polish", "pl", "Portuguese (Brazil)", "pt-BR",
        "Portuguese (Portugal)", "pt-PT", "Portuguese", "pt", "Punjabi", "pa", "Quechua", "qu", "Romanian", "ro",
        "Romansh", "rm", "Russian", "ru", "Scots Gaelic", "gd", "Serbian", "sr", "Serbo-Croatian", "sh",
        "Sesotho", "st", "Shona", "sn", "Sindhi", "sd", "Sinhalese", "si", "Slovak", "sk",
        "Slovenian", "sl", "Somali", "so", "Spanish", "es", "Sundanese", "su", "Swahili", "sw",
        "Swedish", "sv", "Tajik", "tg", "Tamil", "ta", "Tatar", "tt", "Telugu", "te", "Thai", "th",
        "Tigrinya", "ti", "Tonga", "to", "Turkish", "tr", "Turkmen", "tk", "Twi", "tw", "Uighur", "ug",
        "Ukrainian", "uk", "Urdu", "ur", "Uzbek", "uz", "Vietnamese", "vi", "Welsh", "cy",
        "Xhosa", "xh", "Yiddish", "yi", "Yoruba", "yo", "Zulu", "zu");

    if ($opt eq "dislpay") {
        print "Supported Languages list:\n";
        printf("%-22s:  %s\n", $_, $sup_lang{$_}) foreach (sort keys %sup_lang);
        exit 1;
    } elsif ($opt eq "list") {
        return %sup_lang;
    }
}

1 Like

Appreciate you for sharing the code. You helped me.

1 Like

Your very welcome Jen that’s what its here for. Glad i could help!

You have softReset=true, but doc says don’t . are you not facing any issues ?

Not At all. 100% solid and stable.

*** Config files update 7/3/16 - Changes: Added code to change siren sounds based on Alarm, Fire, etc… ***

Please check rules for syntax errors

rule "Process smoke detector updates"
Item gSmoke changed from CLOSED to OPEN
then
alert.apply(gSmoke, “- CO/Smoke”)
}
end

rule "Process Tamper updates"
Item gTamper changed from CLOSED to OPEN
then
alert.apply(gTamper, “- Tamper”)
}
end

has orphaned }

/ Alarm Arm and Disarm
rule “rArmState"
when
Item AlarmArmDisarm received command
then
{
if (receivedCommand == 3)
{
logInfo(“Security”, “SECURITY: Armed Stay!”)
postUpdate(AlarmSysStatus, 3)
sendMail("jay@cidcomm.com”, “Security System Alert!”, “System Armed Stay!”)
executeCommandLine(“aplay /usr/share/openhab/sounds/armedstay.wav”)
}
if (receivedCommand == 2)
{
logInfo(“Security”, “SECURITY: Armed Away!”)
postUpdate(AlarmSysStatus, 2)
sendMail("jay@cidcomm.com", “Security System Alert!”, “System Armed Away!”)
executeCommandLine(“aplay /usr/share/openhab/sounds/armedaway.wav”)
}
if (receivedCommand == 1)
{
logInfo(“Security”, “SECURITY: Disarmed”)
postUpdate(AlarmSysStatus, 1)
gAllSirensSwitch.sendCommand(OFF)
sendMail("jay@cidcomm.com", “Security System Alert!”, “System Disarmed!”)
executeCommandLine(“aplay /usr/share/openhab/sounds/disarmed.wav”)
if (receivedCommand == 0)
{
logInfo(“Security”, “SECURITY: No Update”)
}
}}}
end

// Alarm System Active Action
rule "rAlarmActivated"
when
Item gMotionSensors changed from CLOSED to OPEN or
Item gDoorSensors changed from CLOSED to OPEN
then
{
if (AlarmSysStatus.state == 2 && gMotionSensors.state == OPEN)
{
logInfo(“Security”, “SECURITY: ARMED-AWAY Motion Intrusion Detected!”)
gAllLights.sendCommand(ON)
Thread::sleep(3000)
gAllSirensSet.sendCommand(259)
Thread::sleep(1200000)
gAllSirensSwitch.sendCommand(OFF)
}
if (AlarmSysStatus.state == 2 && gDoorSensors.state == OPEN)
{
logInfo(“Security”, “SECURITY: ARMED-AWAY Door Intrusion Detected!”)
gAllLights.sendCommand(ON)
Thread::sleep(3000)
gAllSirensSet.sendCommand(259)
Thread::sleep(1200000)
gAllSirensSwitch.sendCommand(OFF)
}
if (AlarmSysStatus.state == 3 && gDoorSensors.state == OPEN)
{
logInfo(“Security”, “SECURITY: ARMED-STAY Door Intrusion Detected!”)
gAllLights.sendCommand(ON)
Thread::sleep(3000)
gAllSirensSet.sendCommand(259)
Thread::sleep(1200000)
gAllSirensSwitch.sendCommand(OFF)
}
}}}}
end

bold ones needed ?

1 Like

Not sure. Try and see. Mine isnt broke so im not fixing it :wink:

thanks, All good now.