How to control non-smart desk lamp / general lights-logic

I am new to home automation, and I am currently setting up a raspberry-pi/HA based solution in my appartment. I already got myself a couple of z-wave based motion sensors, which I want to trigger lights.

Now I am having this desk lamp which is having a manual switch, which means I will not be able to smartify this lamp easily. One thing I can do, however, is to get somthing like this:


and then leave the lamp always running, but only control it via HA.

This might work out for simple logic (turn on by motion, turn off if 10 minutes no motion), but how should I go about more complex logic? E. g. there could be a situation when I don’t want to turn it on, or I want to manually turn it off. In this case, it will be cumbersome to turn the lamp off using the HA app (especially since it unfortunately does not support widgets), and of course turning the lamp off with the manual switch will break automation.

Second situation would be my living room lights which I want to control using IR LED attached to the pi (the lamp can work with a remote control, fortunately). So the logic would be to turn the lamp on on motion, and turn off after some time without motion. If I imagine watching TV with this, it would at some point really piss me off because it will toggle lights when motion is detected, and toggle again when I am lying/sitting still for a while.
This could be solved with conditions which evaluate the TV state itself (luckily I am running a webOS 2 TV which can be controlled by HA), but what if at some point I want lights + TV? But during a creepy movie I want no lights + TV?
I know this is probably the perfect example for predefined scenes, however I am wondering if switching the scene would not equal the effort of just manually switching the lights? :thinking:

I mean at some point I really fancy trying out voice control (using snips), which would solve this and at the same time be pretty cool, however I doubt I can accomplish this any time soon, and this would not work in all rooms.

How do you guys do this kind of automation? Is there anything I haven’t considered yet, or will this just not be possible with lamps like this?

Hope this post was not too confusing.
Looking forward for any thoughts and opinions to guide a newbie :slight_smile:

ps: I stumbled upon node-red, and I am really amazed by this. This should/will be part of my setup.

What you expressed are my main concerns about Home Automation, plus this: can I still use the house if any component of the sistem breaks? What’s the time and effort needed to return to a “liveable” state? E.g. if the RPi starts giving out “magic smoke” will I live for a couple days in a dark and cold house reading books with a candle light?

My current solution is this:

  • Heating is managed by a rock-solid commercial product (Honeywell thermostat), no ESP8266 or Arduino DIY. As a backup I can manually turn on the heater, with no temperature control but at least I won’t be cold.

  • Lights: I installed remote controlled plugs and wired sonoffs only for “floor” lamps. In every room I have at least one main traditional ceiling lamp, and one or more floor lamps, desk lamps, led strips controlled by automation. If anything breaks, or I’m in a hurry and don’t have a remote handy the plain old switch is always on the wall.

  • Ease of use: this is the hardest part, and I still don’t have a great solution. My workarounds (some are going to be dismissed) are:

    • HA app on phones (of course)
    • one iPad between kitchen and living room with HADashboard
    • a couple Dash Buttons near the entrance (lights on) and bedside (lights off)
    • a pair of 8-button 433MHz remotes from old radio controlled plugs (like this )
    • a pair of cheap 2-button 433 remotes ( this )

I’m pretty satisfied with my current setup, and the Wife Complaint Rate is low enough :grin:

Look into the sonoff remember to keep it "wife friendly " that is it works the old ways

1 Like

@patrick_jane

It’s totally possible, I do this with my automations all the time. There’s certain things I don’t want to automate when I have guests over as an example. Or I have things that run when I’m on vacation to simulate I’m home so the automations only trigger when the Vacation scene is on. The best way to do this is to add conditions to your automation. For your use case, the condition would be if your media_player is idle or stopped so it won’t run when it’s playing.

Another trick I use is input_booleans. Think of them as toggle switches. I use them often as options or settings. For example, if I have a movie scene (using an input_boolean) and if it’s on and I didn’t want the light to turn off, I’d add a condition in my automation that only runs if the input_boolean.movie_scene is off.

Node-Red is really useful. For me, I use it primarily for enabling scenes and switches that aren’t compatible with the Echo. Sure, you could go snips, but for the price of a dot, I think you’ll have a less frustrating experience. Just my 2 cents on that.

I have lots of examples, let me know if you need something to get your started. Have fun…oh and kiss goodbye the next 3 months of your life :smile: Once you see the potential, you’ll be writing to your YAML’s all night for days on end.

Only 3 months!? I started in July and I’m no where near done! This has become almost a second full time job! :laughing:

It’s a pretty fun job, tho If you like that kind of thing…:wink:

1 Like

@finity
Good point! I’ve been doing it for over a year and still find stuff to add. Drives my wife nuts at times. I was being overly optimistic

Just a note to this: You won’t break automation when you’re turning off your fibaro wall plug manually. It’s the same way turned off, as you would do with the app. There is a little button which can change the device state on the front. So when the automation kicks in the next time, it will turn on.

Another trick I use is input_booleans. Think of them as toggle switches. I use them often as options or settings. For example, if I have a movie scene (using an input_boolean) and if it’s on and I didn’t want the light to turn off, I’d add a condition in my automation that only runs if the input_boolean.movie_scene is off.

Okay but still you will have to switch scenes somehow, either by voice command, app or something. Means you still change a switch, be it the light switch itself or the scene switch.
But you are right, I think I can build some better logic with conditions. One thing would be to ignore motion sensor when netflix is playing, but don’t ignore it when anything else is playing.

Also I have 2 more motion sensors in other rooms, so I could basically detect when no one is left in the room, and then also turn off lights.

Sure, you could go snips, but for the price of a dot, I think you’ll have a less frustrating experience. Just my 2 cents on that.

Not gonna happen :slight_smile: No cloud-internet-whatsoever-sh*t is going to be attached to my network :slight_smile:

Just a note to this: You won’t break automation when you’re turning off your fibaro wall plug manually. It’s the same way turned off, as you would do with the app. There is a little button which can change the device state on the front. So when the automation kicks in the next time, it will turn on.

That might be true but I was actually referring to the switch on the desk lamp, not the wall plug (which will be buried somewhere under the desk.

My thoughts exactly.

Most of my automations happen automatically, by detecting motion/door/window sensors and presence detection. For the odd occasion where that isn’t possible, I have 433MHz remotes around that are detected by the OpenMQTT Gateway, and various things happen (like switching on plugs that are under the desk, or making sure lights do not turn on while I’m watching a film). The remotes are kept at strategic points around the house.

I also use HTTP Shortcuts on my android phone to turn switches on and off without using the web interface. The web interface is only used for debugging.

@patrick_jane

A condition such as media_player ‘idle’ or ‘stopped’ won’t require you to change something manually but you should probably still want manual controls. Your smart home will never be able to read your mind. As many conditions as you can think of, there’s always one you didn’t.

As for cloud voice control, yeah it’s a personal preference, but if you’re worried about the gov spying on you, you shouldn’t use internet at all, and definitely not a SmartPhone. All, I’m saying is it’s way easier and cheaper to buy a Dot than make your own.