What do you do with Openhab?

Almost every forum I’ve been in, there always seems to be a thread for this. What do you do, or want to do, with Openhab?

First, I’ll start with my story of home automation and finish with what I would like to have as a final product.

My adventure started many, many moon ago with a product called X10. It ran switches and dimmers over house wiring and worked reasonably well. But life happened and I married, family, and career. I had a hard time finding new products and it seems that X10 was a dead end.

After many years, along came the newest crop of home automation and I was then retired. I picked up Smartthings and Philips Hue and they work well. I’ve added Amazon (now defunct) and Google Home Assistant.

In dealing with Smartthings issues with reliability and Hue’s lack of automation, I started using IFTTT for many of the rules. But IFTTT is not that secure and it still lacked the ability to run complex rules. I managed to make smartthings work with using virtual switches and cascade rules, but they were still not great. I wanted something I had more control over and wanted to limit my outside interfaces to the minium.

I found Openhab with a Google search and set it up on a spare Linux box. The learning/setup curve was more than I wanted so put it aside. I then tried it on Windows and still some issues. After a few months of this on/off trial, I tried again on Linux and with only one bulb. I got it working but still not to my liking. Then came the Raspberry Pi 4 and Openhabian. I set it up and got it working quickly. I then played with one bulb and found that my IT career training started to come back. You see, I started using Unix back in the late 1970s, spent a career building automation scripts to ease my work load, and was a system admin for several Unix systems. Using command line and strict syntax was more my style. So now I use Openhab, Philips Hue Bridge, and Harmony Hub for my environment. The Smartthings Hub and Amazon are not used but I have kept Google Home Assistant connected to OpenHab Cloud. I want remote access and voice control and this gives me that. Plus, Google has connectors for many products that either not in Openhab or are not fully supported. At some point, I will have it down to a single environment but not yet.

Now I have over 40 devices, 150-200 items, and 30+ rules. I’m still working on adding all of my smart devices though some do not have bindings available or require extra steps to set up when all I want is a simple solution.This is another reason to keep Google in the system.

What I’ve learned is this. Once one gets the hang of the layout of the application, adding or changing things is easy. Rules are easy too. You don’t get immediate results with a change. I’m finding that it takes patience and any change takes time to migrate through everything. Many times I made a change, tested it, and changed it again only to find that my test failed due to me not waiting.

I will state that I use Nortell’s combo USB dongle for Z-Wave and Zigbee. The Z-Wave works great, but had some issues with Zigbee. I found that I need to restart Openhab every few days and wait for things to rediscover and wake up. Again, patience is key. Once I quit trying to bull my way through, the system is working well with few issues and the reboots are much rarer.

Now for the second part of this post. What would I want as a final product?
Well, have it work like the starships in Star Trek would be great. Short of that, having every day activities work automatically.

Right now, my “man cave” a.k.a. family room is fully automated. The TV and lights come on in the morning as I enter (motion activated and only the first time I enter). They turn off when I leave the house in case I forgot, and will turn on again after I return (just like first thing in the morning). The lights come on when rooms are dark and off when bright (this happens throughout the house). I also have fans coming on when a room is warm or the humidity is high, and off at night or when I go to bed. I’ve set up “breakers” to inhibit some rules as needed. This prevents unwanted activity and adds another level of control. I’m working of having some special lighting effects for holidays based on cron (I.E. red/green for Christmas, red for Valentines Day, green for St. Patrick’s Day, etc.)

I am looking to add cameras, alarms, and other kinds of things. I would greatly appreciate hearing about what YOU are doing and what you want/plan on doing in the future?

I apologize for the long post and poor formatting, but I want to share my environment and challenges in setting it up. I hope this inspires others to stretch themselves and come up with their own solutions.

Ron

3 Likes

A post was merged into an existing topic: What are your top 3 automations

Hi Ron - This will be my first post on this forum … not yet ready to post anything useful, but I wanted to thank you for yours and mention that I have a very similar background with automation: started with X10 back in the early 90s, grew it significantly using Shed running on a Mac and had a house full of X10 gadgets with a fairly extensive scripting running the Mac with Shed. After I moved, I started over with SmartThings and am using Webcore and Raspberry Pis with python and perl for much of the rules and scripting etc. I too looked at OpenHab a few years back and just recently bought a Raspberry Pi 4. So I am starting on the journey to migrate away from SmartThings and, hopefully, to exclusively OpenHabian based.

So your post caught my eye and hoping that perhaps there are some others that have done this journey that I can learn from. I have set up my OpenHabian and connected to my Hue Bridge and playing with lights which works fine. My hope is to be able to do a Room by Room (or something like that) migration so that I dont lose automation while I am transitioning. I’ve got a ton of Zigbee as well as Z-Wave devices and saw your mention of the Nortek’s combo USB dongle … I will look into that as I currently only have the Z-Stick for Zwave stuff.

So I’ll continue to read this site and trudge along learning as I go. I am very comfortable with Linux and Raspberries and I am hoping to find some scripting solutions that rival Webcore.

It’s going to be a major task migrating but I am very concerned that SmartThings will abandon us soon or start charging a monthly fee to make it a real business. And I’m sick of being reliant on their cloud when I have a perfectly good cloud in my own house :slight_smile:

Thanks again for your post!

Mr. Reeves,
Good to hear from you. Your journey parallels mind almost exactly. I liked the Smartthings hub but did not like it having issues with every patch and update. I wanted an environment that was not reliant on internet access.

The learning curve to set thing up was the hardest part on the migration to openhap. Once I figured out the format for items and things, it got much easier. Doing thing one item at a time is the way to go. Once it is working as a basic device, build rules to control it. I use a lot of “trigger switches”, to drive my rules. A lot more work but easier for me to manage groups of things.

Another early tool is to get a sitemap built. It can hold your switched, items, and display results (again, dummy items to hold those results).

I wish you luck and I’m sure you will really like the automation possibilities, not just voice control. I don’t recall if I mentioned it in my original post but I use Google Home Assistant for voice control.

I should also note that I moved my system to a Pi 4 and it works great. It does seem to have delays to some commands and trigger events, but no failures.

Later,
Ron

1 Like

Thanks for your advice Ron … Indeed, things are working fairly well now so I will go methodically through this :slight_smile: …Yes I remember the day that I integrated voice into my X10 set up with a Mac (25 years ago) … it would speak to me the weather and various events … it was so primitive to what I have with Google Home now (using Cast-web-api on SmartThings … has problems though) … I’m sure I’ll be seeing you around here!

Best,
James

Thank you both Ron and Jim for sharing. Many of us do relate to such succession of events. Allow me to share my story, then maybe a path forward.

I too started with X10 when my son was born about 20 years ago. They had wireless baby monitors with Pan/Tilt controls and other gizmos. Invested a fortune in many of their products and recently gave a huge box to Salvation army. Fast Forward to about 3 years ago, when I got 2× Nest Thermostats. They worked fine until I went to Mexico on company business for a week in the middle of February. I got a call from the wife … “The house is cold and the furnace is broken”. It was in fact Nest deciding that, since I was away (based on my phone), the house did not need any heat. Shortly after that came the Feit Smart dimmers, the affordable WyzeCams, the smart garage opener, smart sprinkler controller, alexa/google assistants, … etc.

I’m now with about 100 IOT devices (including kids computers, whirlpool oven, garage openers, smart plugs+bulbs … ) and still searching for a way to make some of them work ‘seamlessly’ … whatever that means.

I tried both Openhab and HomeAssistant. Both have their pros-cons and now I have each on a dedicated Raspberry Pi 4. For now I operate the devices mostly on remote-control mode, with few on timers (plant lights …). Some areas (basement and laundry) have motion sensors to turn off lights when no one is around. The kids/wife know only how to turn lights on, not the other way around.

With the new/recent emphasis on Home Security, the plan is to dump the multiple Amazon EchoDots, and stay away from the various clouds. This seems a very recurring theme and based on various posts, people are slowly moving away as well.

As attractive as this technology is, and for many reasons, I still find it at times ‘overwhelming’ the amount of computer literacy that is needed. I do some coding for a living, but it’s mainly for numerical data processing… nothing that involves networking and crazy stuff like that.

So, to me this IS the biggest challenge today for Home Automation. Not everyone can write json files and develop rules from scripts, and make the whole thing ‘safe’, not on the cloud, and yet be able to access everything ‘easily’ while away from home.

The projects in the pipe-line include the following:

  1. Update/upgrade an ADT home security system (e.g. Konnected, alarmdecoder, …)
  2. DIY Smart Blinds
  3. Revisit my Sense (electricity) and Flume (water) consumption monitors and see how they can be put to good use.
  4. Wire-up an AC adapter for my Ring doorbell - recharging the battery on a regular basis gets old rather quickly
  5. Route cables through outside walls for an outdoor camera security system
  6. Ultimately have everything ‘controlled’ from a single hub/app

One other challenge is: This hobby takes so much time, that by the time one gets further down the to-do list, some hardware becomes old and one needs to keep on updating both software and often hardware.

With Home Automation, my ‘assessment’ so far is very far from ‘set it and forget it’. One has to be willing/ready to invest constant amounts of time … but who has that?

Apologies … long reply as well.

1 Like

I too used X10 devices. I have a shed full of them now. I wonder who would buy these?

Software went from heyu cron and command line to MrHouse (perl) to Domotiga to opehab 2.5and now openhab 3.

My servers have been Linux always. Ubuntu servers from 8.04 to 20.04. I have migrated them to proxmox now (another fantastic software) and they are VM’s.

Internet has gone from dial up to adsl to NBN (Australia)

Hardware went from X10 to wifi to zigbee. I still have wifi and zigbee and only just removed the last X10 devices which were the really great hawkeye X10 motion detectors. I replaced them with the Phillips Hue motion as they also have temperature and light sensing.

I can open garage doors turn on lights and IP webcams. No external access. No voice, no IFTTT. Everything is local on site. If I want external access I use openvpn which is in the firewall software I use called ipfire and it is running on proxmox as a VM as well.

OH3 is great once you figure out how it works. I only use JavaScript rules. Yes I know the old DSL rules will work with OH3 but a change is good.

1 Like

Here’s my story: I have an old Z-wave controller that works fine. I wanted to get some zigbee and wifi devices because they seem to be cheaper. So, I bought a zigbee starter kit that came with two lightbulbs. I got a zigbee motion detector and quickly found out that the zigbee controller could not properly control the lights with the detector, so I decided to get a Raspberry and make an OpenHAB controller, which would handle all three protocols with the addition of a Nortek Z-Wave/Zigbee radio.

So far, I have made a simple webpage that I can call up on my phone and turn the lights on and off. I also implemented a rule that triggers on motion detector change-of-state and runs a script to handle the logic. I am in the camp that says you enable lights on motion and disable lights on no motion for x minutes. I have read differing opinions on this and I think it depends on what motion sensor you have. Some automatically retrigger during motion and some do not. Some also timeout quicker than others.

I plan to eventually take over the Z-wave devices and control everything from OpenHAB.

Here’s my code for the webpage, in case it could help another newbie get started.

<!DOCTYPE html>
<!--
	Here's my first working webpage to operate my openHABian 3.
	This took way longer to create due to not being a highly practiced coder, not a lot of simple how-to 
	info on all the blogs, and some weird inconsistencies in the file locations depending on how openHAB 
	was installed. 
	
	In my installation, which is a Raspberry Pi 3 with the downloaded and flashed openHabian SD card image, this 
	index.html file goes in /etc/openhab/html on the Raspberry Pi. 
	The browser url is then http://openhabian:8080/static/index.html which is only accessable on the local network.
	Both the file location and the url seem to inexplicably vary depending on your hardware, version, 
	and installation method. Good luck finding where yours ended up!
	
	I hope this helps others starting out to get a basic understanding of how to send 
	commands to your controller via a local web page.
-->
<html lang="en">
<meta charset="UTF-8">
<title>Jim's Home Controller</title>
<meta name="viewport" content="width=device-width,initial-scale=1">

<link rel="icon" href="http://openhabian:8080/res/icons/apple-touch-icon.png">
<style> .inline { display: inline; } </style>

<body>

<div class="">
 <h1>Jim's openHAB control page</h1>
 <table>
	<tr><td>All lights</td>
		<td><button onclick="allOff()">OFF</button></td>
		<td><button onclick="allOn()">  ON</button></td></tr>
	<tr><td>Desk Lamp</td>
		<td><button onclick="dLampOff()">OFF</button></td>
		<td><button onclick="dLampOn()">  ON</button></td></tr>
	<tr><td>Computer Screen</td> 
		<td><button onclick="cScreenOff()">OFF</button></td>
		<td><button onclick="cScreenOn()">  ON</button></td></tr>
</table>
<table>
	<tr><td>Can Light 1</td>
		<td><button onclick="canOne0()">OFF</button></td>
		<td><button onclick="canOne1()">  1</button></td>
		<td><button onclick="canOne2()">  2</button></td>
		<td><button onclick="canOne3()">  3</button></td>
		<td><button onclick="canOne4()">  4</button></td>
		<td><button onclick="canOne5()">  5</button></td></tr>
	<tr><td>Can Light 2</td>
		<td><button onclick="canTwo0()">OFF</button></td>
		<td><button onclick="canTwo1()">  1</button></td>
		<td><button onclick="canTwo2()">  2</button></td>
		<td><button onclick="canTwo3()">  3</button></td>
		<td><button onclick="canTwo4()">  4</button></td>
		<td><button onclick="canTwo5()">  5</button></td></tr>
 </table>
</div>
</body>
<script>
/*********** BEGIN JavaScript for Jim's OpenHAB Control Page **********

	Here's the javascript to send the REST requests to the openHAB. Obviously you need to edit the
	item names to match your items and/or things. 
*/
	function cScreenOn()  { sendCommand("ComputerScreen", "ON"); }
	function cScreenOff() { sendCommand("ComputerScreen", "OFF"); }
	function dLampOn()    { sendCommand("DeskLamp",       "ON"); }
	function dLampOff()   { sendCommand("DeskLamp",	      "OFF"); }

	function canOne0() { sendCommand("AduroSmartcanLamp1",  "OFF"); }
	function canOne1() { sendCommand("AduroSmartcanLamp1",    "1"); }
	function canOne2() { sendCommand("AduroSmartcanLamp1",   "20"); }
	function canOne3() { sendCommand("AduroSmartcanLamp1",   "45"); }
	function canOne4() { sendCommand("AduroSmartcanLamp1",   "70"); }
	function canOne5() { sendCommand("AduroSmartcanLamp1",  "100"); }

	function canTwo0() { sendCommand("AduroSmartcanLamp2",    "0"); }
	function canTwo1() { sendCommand("AduroSmartcanLamp2",    "1"); }
	function canTwo2() { sendCommand("AduroSmartcanLamp2",   "20"); }
	function canTwo3() { sendCommand("AduroSmartcanLamp2",   "45"); }
	function canTwo4() { sendCommand("AduroSmartcanLamp2",   "70"); }
	function canTwo5() { sendCommand("AduroSmartcanLamp2",  "100"); }
	
	function allOn() {
		sendCommand("DeskLamp","ON");
		sendCommand("ComputerScreen","ON");
		sendCommand("AduroSmartcanLamp1", "15");
		sendCommand("AduroSmartcanLamp2", "15"); }
	function allOff() {
		sendCommand("DeskLamp", "OFF");
		sendCommand("ComputerScreen", "OFF");
		sendCommand("AduroSmartcanLamp1", "0");
		sendCommand("AduroSmartcanLamp2", "0"); }
/*
	sendCommand() is the javascript function to send a commend to the openHAB. You shouldn't need to edit this except 
	for the urlBase variable which may need a different location on your device. Not sure all the setting are needed, 
	but I copied this from somewhere and it works, so I leave it alone.
*/
	function sendCommand(item, data) {
		var urlBase = "http://openhabian:8080/rest/items/"
		var url=urlBase + item;
		var xhr = new XMLHttpRequest();
		xhr.open("POST", url);
		xhr.setRequestHeader("Content-Type", "text/plain");
		xhr.setRequestHeader("Accept", "application/json");
		xhr.onreadystatechange = function () {
		   if (xhr.readyState === 4) {
			  console.log(xhr.status);
			  console.log(xhr.responseText);
		   };
		}
		xhr.send(data); }
		

/*********** END OF SCRIPT ***************/
</script>

And, likewise, here is the script that gets triggered when the motion detector changes state (OFF to ON and ON to OFF):

// This script runs when motion detector changes state.
// When motion is detected it turns on the lights and computer screen
// On any change in motion detector state it deletes any existing timers it had previously created.
// When motion stops it creates a new countdown timer with a function to turn off the lights after the specified delay.
// If Motion is detected, it deletes the timer, along with its function, so the lights stay on.
// 
// Is this Office Motion Timeout in Scripts folder?
// No. This is defined in rule. Not sure where it is stored.
// I can't get logging to work. 

var timeout = 10;// Number of minutes to timeout with no motion

var ScrExec = Java.type("org.openhab.core.model.script.actions.ScriptExecution");
var ZDT = Java.type("java.time.ZonedDateTime");
var Motion = items.AduroSmartEriaMotionSensor_MotionPresence;

if (this.MyTimer !== undefined) {
  this.MyTimer.cancel();
  this.MyTimer = undefined;
}
//logInfo("events", "Occ change detected {}", 1) 
if (Motion === ON) {
  //logInfo("events", "Motion detected {}", 2)
  events.sendCommand('ComputerScreen', "ON");
  events.sendCommand('DeskLamp', "ON");
  events.sendCommand('AduroSmartcanLamp1', "25");
  events.sendCommand('AduroSmartcanLamp2', "25");
} 
else { // Motion switched to OFF
  this.MyTimer = ScrExec.createTimer(ZDT.now().plusMinutes(timeout), function(){
      events.sendCommand('ComputerScreen', "OFF");
      events.sendCommand('DeskLamp', "OFF"); 
      events.sendCommand('AduroSmartcanLamp1', "0");
      events.sendCommand('AduroSmartcanLamp2', "0");
    }
  );
}

That’s my story so far. Reply if you find this helpful or if I can explain anything.

With OH to provide the great new main UI and even in addition the older sitemaps UI,
why did you build your own control webpage ? It’s all (well most) already there …

1 Like

Good question. Honestly, I was having trouble getting scripts to work in rules, so I wanted to try some external scripts in a browser. Once I got them working I figured I might as well go ahead and make a little web app. I’m still fumbling with a lot of unanswered questions, but the more I tinker the more I figure out.

I’m with Jim, I put together my own little web interface… well… just because I wanted it to look just so

For me it was figuring out how to get the browser to react to SSE
this old thread helped me