What are your top 3 automations

I could do with some inspiration for some good rules/configs, so I’d love to know what rules you have added that are really cool

  1. Using my nest thermometer to signal a find my iPhone
  2. Hooking up my door bell to flash the lights when the door bell rings, and send me a push notification
  3. Using a Arduino to mimic a bye bye standbye controller to allow me to automate some spare home easy plug controllers (pausing plex switches lights one now, when the nest says I’m away it turns off all the lights, tv, xbox, etc)
3 Likes
  1. Turning on or off the lights based on the time of day, the weather conditions, and whether someone is home. It isn’t all the cool in practice but it has a ton of special cases that taught me a lot about how the rules engine and language works and how to use them to their best capabilities.

2a) Our Nest is in a room we rarely go so I use openHAB’s presence to tell the Nest when we are away or not. I use the NH binding and some Bluetooth sensors distributed through the house to detect the presence of our phones.

2b) We don’t have an air conditioner but we do have a basement which is up to 20 degrees cooler than the top floor of the house in the late afternoon in the summer. I’ve set up openHAB to turn on the fan to recirculate some of the cooler air in the basement as if it were an air conditioner.

  1. I have door reminders set up so if a certain set of doors is left open for more than an hour during the day I get an alert. If a certain set of doors are open when I leave the house I get an alert. If a certain set of doors are opened at night I get an alert.

My home automation is pretty boring but my standards for a home automation problem are pretty high. It has to work in the background as much as possible. It has to be 99% reliable. It has to be easier to use than the non-automated approach. And it has to solve a real problem I have, not be something to do just because I can.

3 Likes

I am 100 pct with @rlkoshak on the “solve a real problem” requirement, so here’s a couple of my favorites.

  1. Our second floor guest area gets much hotter in summer/cooler in winter than other parts of the house (west-facing corner room…do the math ) . Got a secondary Temp/Humidity zwave device to keep in that room and integrated its readings with my main zwave thermostat control logic pattern and guest presence detection to “tickle” the HVAC system if guest area is too far out of bounds with comfort.

  2. Set up a brief script to run against one of my side-lamps in the living room and the motion detectors and front-door contacts to run as “I’m working and I see you” as an automation UI affordance. Basically the script does a 3 second dimmer “wink at me” cycle. Easy way to see that automation is working without having to log into any UI anywhere.

  3. Set some deep late-night only rules to turn on a series of lights if one of the bedroom doors is opened …lights up pathways downstairs and into kitchen as likely destination, timeout quickly if motion detector in kitchen does not trip within 2 minutes.

1 Like

I agree with Rich and Bob: identify the most annoying ‘real’ world problems and find your own smart solutions.
Might sound a little bit boring, but my favorite automation is my HVAC system to optimize room temperatures.
That is a challenging, complex task if you take care of furnace and hot water control, windows, AC, ventilation, current and future weather, presence information, energy savings etc. And a rewarding one.

Some more ideas of what I implemented and found to be useful:

  • a doorbell that makes lamps blink in different rooms (I’m working in the basement where you don’t hear the bell) plus some garden lights .

  • a switchable foil on my bathroom window to become opaque when someone enters the room.

  • a rain sensor that, if triggered, speaks an announcement (to make me hurry retrieve the clothing off the garden).

  • multiple ‘nighttime’ and one ‘leave house’ physical switch at the front door that activate light scenes and security related functions. For example, ‘nighttime’ turns off most of the lights, dims some of the others, checks if all windows are closed and sends me a status message to my mobile, and enables the alarm system after a couple of minutes. ‘Leaving’ currently only turns off lights. But it could also enable the alarm system, turn down the heating and start simulation of presence (more or less random lighting or sounds).
    Actually, it’s no extra switches, but specific action taken when I triple click on actuator-connected traditional light switches.
    In general, that’s much more feasible than to use the smartphone every time. WAF is much higher, too.

  • I use a geo-tracking app on our mobiles to make my smarthome know when one of the mobiles enters or leaves either home or some other defined area. I use this to ramp up the heating in my wife’s room when she’s leaving her workplace.

  • my basement’s beer-loaded fridge starts cooling only if the weather forecast for next day is ‘warm’.
    (now that’s a useful one, isn’t it !)

  • optimized ventilation based on presence
    My ventilation unit is noisy and located atop my bed room, so I automatically turn it down at bed time, based on presence detection.
    Ventilation also happens to drop cold air right on my wife’s head when she’s at her favorite place.
    So I added a valve to auto-close when she’s sitting there.

  • all sorts of automated lighting:
    ** dimmed lights during nighttime
    ** welcome lighting scenery when the car is arriving (known via geo tracking).
    ** light scenes depending on time of day (agressive-cold white in the morning, warm red-ish in the evening, dim light blue during the night) or based on TV or alarm status (dimmed lights if TV is on, flashing or all-on if an alarm is set off) and so on.

  • an automated TV cabinet door to open when I use my receiver’s remote.
    It’s opening the TV cabinet, turns on AVR and TV und adjusts the living room’s lighting.
    There’s also a ‘cinema mode’ to closes all of the room’s roller shutters / blinds, and turns the sound system into ‘blockbuster’ surround mode.

  • my personal favorite is a mechanism that uses movement detectors in everybody’s room and power metering to identify who is first to raise in the morning, then I play an announcement through my Pi saying “dear wife[son, daughter], Good Morning, and please get me a coffee”. But only if I turned on my bed’s light before (identified through power metering plug-socket).
    Yes, this solves a real world problem:
    before, neither of us was daring to bring in the coffee because he/she didn’t know if the other one was already awake (and to wake up one of us can be life threatening :sweat_smile: )

6 Likes

Hi

For me the main parts are also heating and light.

  • For the heating it is based on location (geofence), time of the day (put down in the evening, put up in the morning either by “alarm clock” or by time if I didn’t set the alarm clock for a day) and also environment (currently window open/close, in the future additionally based on outdoor temperature).

  • For lights I have, besides the “normal” why-use-a-switch-if-you-can-use-a-smartphone scenarios, I’ve some rules that switch/dimm lights depending on time (e.g. sunset, sunrise), motion (e.g. switch on light with low brightness when getting up at night, more brightness after the alarm clock starts), events (e.g. TV switched on/off) and any combination of these. But one of my best is to switch off all lights in the flat when leaving home, and switch them back on as they were before when returning and still dark.

All this doesn’t sound really interesting, but when you think about the possible side effects (no I don’t want the light to be dimmed, just because I switch on TV; only if there was no light before), you get a really lot of work.

Also the switches for light in my flat are in places where you can’t really use them if you don’t want go the next meters in darkness, so it solves real-world-problems :wink:

Regards
Dieter

The automation I value the most is notifying my sister or myself if my elderly mother has not been seen moving around her home for some period of time, so we can contact her to make sure she is OK. I installed an ecobee3 thermostat and remote wireless sensors in her house, so not only does the desired setpoint follow her around the house to keep her comfortable, but the occupancy sensors keep resetting a timer when they trip, and if the timer is allowed to expire, it sends an SMS to my sister and a my.openHAB notification to me. I wrote it up here.

6 Likes

Very practical, and potentially life saving - nice one!

If its dark and a door opens the outdoor and indoor light nearby will turn on.

Driveway lights turn on if its dark and a vehical enters the driveway.

Send an alert if a thermostat actual temp is more than a degree off the set point, possible issue with HVAC.

1 Like

I use StellaZ ZWave TRVs and a Gcal schedule to control heat around my house, which needs to vary on a two week cycle, which most commercial thermostats can’t handle. That’s my top automation. Easy to override if necessary.

I also use PSM03 ZWave PIR/Presence/Temperature detectors for lots of functions. They switch my landing light on when my 5yo kid wants to go to the toilet (she’s too short to reach the switches), the porch light on when someone arrives and as a fire and burglar alarm trigger. I combine it with Sonos to speak alerts, warnings and alarms and probably scare the hell out of anyone that tries to break in.

My home entertainment now switches off at 01:00 unless I reply to an NMA Android notification at 23:45. As I frequently fall asleep in front of the TV, this has saved me about 30% on my electricity bill.

In my humble opinion, home automation is all about the boring stuff. It should go unnoticed and just make life a little better.

I love to cook and have some old and new kitchen knives. They all cut the same but the old ones have handles that are hard to wash. The new ones have handles that merge with the blade and are easy to wash.

HA is the same. We all have light switches and thermostats already but it’s nice not to have to think about them because our rules do it for us.

Cheers
Vitch

  • Indoor motion detectors trigger lights dimmed after sunset and before sunrise
  • A switch to suppress motion detectors for a short period (2min) - to pass hallways in darkness :wink:
  • If last smartphone disappears from WiFi and window/door contacts are open, that smartphone is notified
  • Magic mirror in entrance hall that shows a floor plan of all open windows/doors and all lights that are switched on :smiley:

wow. I want that magic mirror! :slightly_smiling:
is there a way to have an English diy?

My inspiration for the magic mirror is this project (English): https://www.raspberrypi.org/blog/magic-mirror/

However, the openhab integration is not included there and I did not yet write anything about the software of my mirror. Maybe I’ll do that if I find some time, but there are so many things with higher priority at the moment… :wink:

Oh my… Well if you don’t, I’m going to try and replicate it. This is probably one of the coolest magic mirror’s I’ve seen to date… Thanks for posting.

What bluetooth sensors do you use?

Raspberry Pi 3, Raspberry Pi Zero W, and BT dongles plugged into older Raspberry Pis that don’t have BT on the board. These machines are already installed in these locations with other jobs so deploying the BT there is just because of opportunity. I’ve not deployed any specifically to get BT sensing capabilities.

I use sensorReporter or reelyActive to detect the presence of BT devices nearby. Unfortunately, reelyActive only sniffs for broadcast BTLE messages and most devices use a random MAC that cycles frequently so it isn’t much good for detecting specific devices (e.g. Rich’s iPhone is present). sensorReporter is fiddly and needs a lot of tuning to prevent false positives and false negatives.

For now, I’ve managed to get my network based phone detection reliable enough that I’ve actually turned off the BT sensors for now. I will probably go back to reelyActive at some point if I ever have the opportunity to deploy more Pis and what not around the house. I can then use them to keep track of what room, or even what floor our phones are on. I might be able to do something interesting with that information…

Thanks for the detailed reply. How does the network based phone detection identify which room you are in?

It doesn’t. Determining what room my phone is in is a future project that I may never get around to implementing. I just use the network to determine whether one of us is home for presence detection. iPhones are notoriously difficult to detect on the network using simple approaches because they go to sleep when not being used and stop responding to pings. The ne Network binding addresses this by adding in the ability to do an arping. I’ve implemented an older approach that uses hping3 to force the iPhone’s network to wake up and arp to see if it is online. There is also and iCloud integration thread that lets one query the location and other information about the iPhone from Apple’s iCloud.

But if you are interested in tracking a phone’s location on a room by room basis using WiFi and have Android based phones, check out FIND (search github and these forums) which uses the signal strength of all the WiFi APs your phone can see to triangulate its position in your house.

I have set a “fixed” offset on the Astro Sun Local set#event. I’m using this to turn on lights in the evening.

I want to predict the need to turn on a light based on how bright it is. OK, I could deploy light sensors. So, this is in search of a different (OK, cheapskate) approach… This falls into the “I’m sure it is possible, anything is possible” category. The question is how? And has anybody done it?

Use a local weather conditions to determine the cloud cover and use that to determine if I should turn the lights on earlier than the set#event.

Mike

P.S. My #1 is Nest control & my #2 is lighting control. #3 will come when I master these :wink:

This is essentially what I do. Honestly, I’d recommend investing the $6 in a NodeMCU with a photoresistor. I would say that the cloudy approach is maybe 50% useful. But since you ask, here it is. Note the following:

I’ll let you look at the DPs for the Time of Day stuff.

I’ve created two Groups for each time of day, one Group to contain those lights that should turn on at the start of that time period and another to contain those lights that should turn off at the start of the time period. I’m using Associated Items naming. I’ve also a Group for those lights that should turn on and off when it is cloudy as well as a Group to store the override flags (i.e. when a light is manually turned ON or OFF, do not change that light based on how cloudy it is, just leave it ON or OFF until the next time period).

Group:Switch:OR(ON, OFF) gLights_ON_MORNING    (gLights_ON)
Group:Switch:OR(ON, OFF) gLights_OFF_MORNING   (gLights_OFF)
Group:Switch:OR(ON, OFF) gLights_ON_DAY        (gLights_ON)
Group:Switch:OR(ON, OFF) gLights_OFF_DAY       (gLights_OFF)
Group:Switch:OR(ON, OFF) gLights_ON_AFTERNOON  (gLights_ON)
Group:Switch:OR(ON, OFF) gLights_OFF_AFTERNOON (gLights_OFF)
Group:Switch:OR(ON, OFF) gLights_ON_EVENING    (gLights_ON)
Group:Switch:OR(ON, OFF) gLights_OFF_EVENING   (gLights_OFF)
Group:Switch:OR(ON, OFF) gLights_ON_NIGHT      (gLights_ON)
Group:Switch:OR(ON, OFF) gLights_OFF_NIGHT     (gLights_OFF)
Group:Switch:OR(ON, OFF) gLights_ON_BED        (gLights_ON)
Group:Switch:OR(ON, OFF) gLights_OFF_BED       (gLights_OFF)
Group:Switch:OR(ON, OFF) gLights_ON_WEATHER
Group:Switch:OR(ON, OFF) gLights_WEATHER_OVERRIDE

The following Rule turns on/off the light based on the time of day:

val logName = "lights"

// Theory of operation: Turn off the light that are members of gLights_OFF_<TOD> and
// then turn on the lights that are members of gLights_ON_<TOD>. Reset the overrides.
rule "Set lights based on Time of Day"
when
  Item vTimeOfDay changed
then
  // reset overrides
  gLights_WEATHER_OVERRIDE.postUpdate(OFF)

  val offGroupName = "gLights_OFF_"+vTimeOfDay.state.toString
  val onGroupName = "gLights_ON_"+vTimeOfDay.state.toString

  logInfo(logName, "Turning off lights for " + offGroupName)
  val GroupItem offItems = gLights_OFF.members.filter[ g | g.name == offGroupName ].head as GroupItem
  offItems.members.filter[ l | l.state != OFF ].forEach[ l | l.sendCommand(OFF) ]

  logInfo(logName, "Turning on lights for " + onGroupName)
  val GroupItem onItems = gLights_ON.members.filter[ g| g.name == onGroupName ].head as GroupItem
  onItems.members.filter[ l | l.state != ON].forEach[ l | l.sendCommand(ON) ]

end

Here is the Rule that runs when the isCloudy Item changes. I only adjust the lights based on coudy conditions during the DAY.

// Thoery of operation: If it is day time, turn on/off the weather lights when cloudy conditions
// change. Trigger the rule when it first becomes day so we can apply cloudy to lights then as well.
rule "Turn on lights when it is cloudy"
when
  Item vIsCloudy changed or
  Item vTimeOfDay changed
then
  // We only care about daytime
  if(vTimeOfDay.state != "DAY") return;

  // give the side effects of time of day time to complete
  if(triggeringItem.name == "vTimeOfDay") Thread::sleep(500)

  logInfo(logName, "It is DAY and cloudy changed: " + vIsCloudy.state.toString)

  // Apply the cloudy state to all the lights in the weather group
  gLights_ON_WEATHER.members.forEach[ l |

          val overrideName = l.name+"_Override"
          val override = gLights_WEATHER_OVERRIDE.members.findFirst[ o | o.name == overrideName ] as SwitchItem

          if(override.state != ON && l.state != vIsCloudy.state) l.sendCommand(vIsCloudy.state as OnOffType)

          logInfo(logName, l.name + if(override.state == ON) " is overridden" else " is not overridden")
  ]
end

Notice how I only turn on/off the light if the associated override switch is OFF.

Next we have the rule that detects when there is a manual override on a light:

// Theory of operation: any change in the relevant lights that occur more than five seconds after
// the change to DAY or after a change caused by cloudy is an override
rule "Watch for overrides"
when
  Member of gLights_ON_WEATHER
then
  // wait a minute before reacting after vTimeOfDay changes, ignore all other times of day
  if(vTimeOfDay.state != "DAY" || vTimeOfDay.lastUpdate("mapdb").isAfter(now.minusMinutes(1).millis)) return;

  // Assume any change to a light that occurs more than n seconds after time of day or cloudy is a manual override
  val n = 5
  val causedByClouds = vIsCloudy.lastUpdate("mapdb").isAfter(now.minusSeconds(n).millis)
  val causedByTime = vTimeOfDay.lastUpdate("mapdb").isAfter(now.minusSeconds(n).millis)

  if(!causedByClouds && !causedByTime) {
    logInfo(logName, "Manual light trigger detected, overriding cloudy control for " + triggeringItem.name)
    postUpdate(triggeringItem.name+"_Override", "ON")
  }
end

This rule assumes that any change in state to a member of the weather controlled lights that occurs more than five seconds is a manual override and the override switch is set to ON.

Finally, how is vIsCloudy populated? Like I said before, I use Wunderground. There is a binding now but if you want to use HTTP directly there is a posting Comprehensive Wunderground using HTTP Binding Example that shows that.

Notice, with the above you can have any number of Lights and you can control their behaviors through Group membership alone. If you add or remove Lights or want to change a Light’s behavior all you have to do is change its membership. You never have to touch the Rules.

Finally, I just updated a lot of these rules to take advantage of changes to OH 2.3 (Member of Rule trigger) so there may be a bug that I’ve not seen yet in them. But it has been running for about a day and this part seems to work.

6 Likes

Thanks!

Unbelievably, I can pretty much follow this! Very comprehensive and thorough. I definitely have a lot to learn when it comes to rules. Your structured design ensures proper and consistent behavior. I had already begun to think of modularizing “common code”. For example, the rules that determine if we’re home or not based on location or the state of certain sensors in the house. Your Design Patterns formally codifies what I had in mind.

I do have one quick question… what is “mapdb” in this “.lastUpdate(“mapdb”).isAfter(now.minusMinutes(1).millis)” syntax?

Mike