Benefit of your experience? What have you learned that you wish you had known at the start?

I almost overlooked “the following applies to me” :slight_smile:

It is the total opposite for me… OH does ‘production’-type work = real work, and is the core for all automation, such as irrigation, pumps, gates, door and window sensors, temperature sensors, and other sensors, with OH running the property.

The smallest part is is actual “home” automation…

This will change once I have finished building the house… it will have no light switches, or switches for anything for that matter. Presence sensors, ambient lighting, auto doors, the lot.

So (for me) all but a hobby :slight_smile:

Stuff not yet mentioned:

  • on backup: well some mentioning but the most important lesson I’m missing:
    automate backups so you can forget about them else you will forget them (soon).
    Read the Amanda openHABian README.

  • have a server UPS but also consider getting a wholehouse UPS (PV + battery) !
    Even if you are no prepper.

  • have a validated fallback and/or recovery procedure (and spares) for all of your components
    That’s including all software, too !

  • Validate values before use and be defensive in programming.
    This reduces the likelihood that sensor failures or undetected bugs will get you into trouble.
    You won’t want your furnace to burn all day because the outside temp sensor broke (like my analog system did a few summers ago), but you also don’t want this to happen if the weather binding doesn’t work for whatever reason.

  • when you save a rules file, it gets parsed / processed which takes up to minutes(!) depending on HW and code. This is with rulesDSL. Note it also happens - albeit to a lesser extent - when you use VSC with the LSP server of your OH machine when it’s checking your (unfinished) code.
    Lesson: always develop on a separate dev machine ! And don’t Ctrl-S every minute.

  • you should always have a dedicated rule that in turn initializes all of your items and variables to a
    proper default state.
    Run it on OH startup and whenever things have gone wrong and you need or want to reset the system.

  • openhab:status|update|send in console are very useful to test your code
    Combine it with dedicated initialization rules to have more or less the unit testing what @yfaway meant in his previous post.

2 Likes

Huh! Don’t forget the Star Trek sound. SCNR.

1 Like

Oh man this resonates. I do plenty of that, but do try and keep the “for me alone” fun stuff separate from the rest of the house.

I place all my notes in a comment block at the bottom for each text config I have. That way they are always in my face. Great for things like rules, or odd settings that at a glance “look” wrong but have very specific reasons for their existence. 6 months later you will see something and think to yourself, OH THAT’S WRONG and then break it. But now I have a comment at the bottom that says “this stupid device has a bug bla bla bla” and BOOM now I remember.

1 Like

This will not work?

I have 1 x of them for a single socket I have but I don’t want the added plug sticking out all over the house (especially behind cabinets as can’t push them back) - just don’t look good as they’re quite big too. While you have that… database is wrong for that device (displays options when should be number input), keep meaning to update it but forget.

Shouldn’t the same in-box relays some use for light switches work with sockets too.

I am just guessing here is the US. I found that with a quick Google search.

I did have a couple with shelly relays behind first but as uk double sockets only have 1x input you cannot control both sides of the socket. Plus legally the Shelly also has to be fused down as a 32Amp ring main.

Plus these are much better looking (excuse the wifey not polishing it :stuck_out_tongue_closed_eyes:) and on last contact a local api is in development now :crossed_fingers:

1 Like

Just a note on this. There often is sensitive information stored in Things like usernames, passwords, API access keys, etc. So it’s not always so easy to avoid pushing sensitive stuff. If you do use an external service like GitHub, make sure you understand where and how the sensitive stuff is stored. And double check your staged files before committing to avoid accidentally exposing a secret.

I believe there was some talk about a better way to handle secrets in OH configs but don’t know the status.

Don’t forget to test them periodically too.

Another thing you can do in OH using UI Rules is take advantage of the Scripts to store little coding examples. For example, once you figure out how to create a Timer, add that code to a Script. Next time you need to create a Timer you will have a handy reference right there to look at.

But what you describe is exactly what good comments are for. But I recommend putting them next to or immediately above the code the comment is referring to. That way you don’t have to look at the bottom of the file first. You’ll know immediately that with the next couple lines of code “there be dragons here.”

4 Likes

May sound outlandish, but is in preparation for old age and disability.

2 Likes

What’s your solution for this? Currently mine is to make it so when I turn the light off then back on again manually (not triggered by the motion sensor), the light will stay on longer (1hr)

That’s why my house is a ‘Lazy Home’ not a ‘Smart Home’.
Alexa, going out… (turns everything non essential off)
Alexa, I’m home… (turns different on depending on time of day)
The only lights I have ‘smart’ are my external ones on PIR/Camera Motion/Time of day

1 Like

I have several different solutions depending on the particular situation. From simplest to most complex:

  1. As Rich pointed out, there are places where the simple light-motion sensor pair is sufficient and the chances of running into the early light off problem are small enough to ignore.

  2. Instead of just tying the light state to the state of a single motion sensor, the light is keyed to the ON/OFF state of a group which includes a couple of different inputs. This gives several inputs equal weight in activating the light and keeping it on with the motion sensor only being one of them.

  3. For wall switches that support multiple actions, single clicks control the light directly, but different multiple clicks give different lengths of time the light stays on before returning control the motion sensor.

  4. A few places, such as the master bedroom, have quite complicated logic based on time of day, which trigger has turned the light-on, etc. The current state of whether the light is permitted to turn off with the motion sensor is then stored in a metadata value for the light that is set by various rules.

1 Like

JustinG has provided the high level descriptions of the various option. In terms of inputs, I use smart plugs and smart TV in the same manner as the motion sensors. If they are on, they indicate room occupancy. This mechanism can be generalized to other devices as well, depend on each system.

Even for single click device, you can improve the logic a bit. For example, by default the time out is 5 minutes. However if the user manually turns on the device right after it was turned off, then the time out can be doubled to 10 minutes, and so on. This is what I was about to do for my system, but the wife is happy enough with the current settings.

1 Like

I use the wasp in a box method to control the lights, tv and basically everything. Read the link to understand how it works but basically, if I’m home, everything stays on. It’s easier for me to make this work because I live alone in a third floor flat. There is only one door in or out (unless you are spiderman) In the morning, the lights roll thru a circadian cycle. At 6:30 am, they come on very low dimmer and red. As the timer runs, they slowly turn from red to golden yellow. Then they get progressively brighter. It mimics the natural light of the sunrise, but timed to make me on time for work. After 9 am, the lights are tied to a light sensor which is pointed out a window. When the outside light is bright, the interior lights dim down (or off). When its cloudy, the interior lights become brighter. This mode also has a slower circadian cycle which starts with a very cool bright white color in the morning and over the day, fades to a warm yellowish color by about 4 pm. Then astro binding kicks in and rolls thru another cycle of turning the lights to their evening settings as the sun sets.
I do use motion sensors in the bathrooms and closets and other places where they are appropreate, automatically adjusting the light level depending on the time of the day so you don’t blind yourself if you get out of bed in the middle of the night. You are not going to be in these rooms long enough to not be able to use a timer to turn the lights off. It is mostly lazyness, knowing you can walk out of the room and a few minutes later the light will shut itself off.

1 Like

I completely get this is meant to be ‘home automation’…

For me though, I use it more for the following (non exhaustive) :

‘Ease’:

  • I haven’t got to get up and turn said light on
  • Don’t need to check everything when I go out
  • I can check everything if I’m out

‘Control’:

  • Smart Trv’s - less boiler run time, accurate individual room temps
  • Dumb device conversion
  • Intrusion (doors/windows/motion) - previous alarm panel just gsm so now get notifications if no presence too (handy if WiFi but no gsm signal)

‘Information’:

  • Notifications through the app for things such as low batteries
  • Energy usage
  • Covid too now

Yes I do have some automation, probably 20 rules or so, but asking Alexa to do something from any place in my house (or even from the car as have echo auto’s) does not have the irritation of a light coming on and waking the baby up or going off when I least need it to. Plus with Alexa groups/rooms I can get her to turn all sockets off or all lights with one command.

I just think that sometimes things are automated for the sake of it being automated, and often causes more issues than it solves.

Everyone has their own view, that’s just mine :wink:

I know this is going to seem bizarre but I am the complete total opposite. I want everything to just work with no intervention at all.
I’ll give an example. I struggled at first to get the music to play automatically. I used to sit in silence when all I had to do was say ‘Alexa, play pandora’. I knew I could do that, but I wanted it to do it itself without asking. ??? I know… weird. To me, it almost felt like cheating. I have an echo and I do use Alexa for a few things. I like Alexa to tell me things I didn’t know. ‘Andy the phone is ringing’
I learned openHAB and am part of this community because I want my house to be as automated as possible. I want everything to just work. And when it does, it is like magic. I freaks visitors out!

2 Likes

So how exactly does she know…

Mostly my presence. If I’m home, I kind of like the music playing. But not first thing in the morning, I like it quiet in the morning. And not so loud during certain times. Mostly time of day type decision making. Rich’s time of day is, to me, the basis of every decision. It forms the foundation of the system. Then the wasp in box algorithm makes the next level of decision making, if I am home do xyz during this time of day however, do abc this other time of day.

With enough sensors, we can discern almost any condition. I have a motion sensor in the bathroom. It runs on a timer (actually the expire binding) Works perfect except… when I get in the shower. Steam confuses PIRs. The shower curtain makes it worse. So… how do we figure out if the shower is running? How about a esp8266 with a temperature probe connected to the hot water pipe on the water heater. The pipe goes from room temp to hot pretty quickly. Bathroom timer runs for three minutes and if no more motion is detected, turn off the light, unless… it is morning time of day and the sensor on the water heater just went up, then reset another timer for ten or 15 minutes instead.
This to me is the power of openHAB. The only limits are your own technical abilities and your ingenuity

2 Likes