Integrate landscape lighting

Hi -
Our house has pre-existing landscape lighting that relys on a 2-wire photo sensor to come on at dusk. I am trying to understand how I could go about integrating this system with openhab2, I am currently most familiar with the zwave.

Is there something I could replace the light sensor with to simulate the “it’s dark now” signal that the sensor is sending?


What do you want to achieve? is there something wrong?
Why you need the lighting within openHAB?

you could replace the sensor with a whole variety of things - hence we need to know your requirements.

Heh, I should have been more clear. The light sensor doesn’t work well, partially because it’s in the shade a lot.

So I’d like to just integrate the landscape lights in with the rest of the lighting I already have controlled via openhab2.

All right then!
Do you have zwave already in place? Then it would be the goto technology I think. You could then turn it on, when the zwave light sensor tells.

… Or you could just use the astro binding sun:civilDawn, sun:civilDusk so it would just go on and off at your locations’ data.

Hello -

I too grew very frustrated with the photo sensors and mechanical timers that typically control outdoor landscape lighting.

@binderth pointed you in the exact direction of what I choose to move forward with and has been rock solid ever since I deployed it.

I changed the electrical outlets where my landscape lighting transformers are plugged into AC power to Zwave outlets - this is the model that I used but any will do:

Once the outlets were included into my Z-Wave network I removed the analog timers and photo cells and created the following rules.

The rule utilizes the ASTRO BINDING to get SUNSET and SUNRISE times which I use to turn the lights on and off.

rule "turn landscape lighting on"
    Channel 'astro:sun:home:set#event' triggered START 

rule "turn landscape lighting off"
    Channel 'astro:sun:home:rise#event' triggered START 


I also have used an alternate version of this rule utilizing CRON to turn the lights on and off at specific times rather than at SUNSET and SUNRISE.

Let me know if you have any questions.


Thanks everyone for the suggestions. Ordered an outdoor zwave power adapter and will be adding that to control the lights.

Been wanting to look into the astro binding to control some of my other lights, thanks for the examples


Hi @KidSquid

Your “rule” is quite straightforward, and works fine…
But what if my raspberry goes down for whatever reason (power outage, etc.) and comes up again past SUNSET, is there any way we can turn the lights automatically although we’ve “missed” the trigger?

PD: Sorry @dbadia for hijacking the thread, but I think this might be useful for you too! :smile:

Hello -

I really haven’t had issues with stability so your suggested scenario had not been considered.

I guess you look at implementing a timer that lasts for X number of hours after the light has been turned on and then save that information into one of the persistence databases. You could then have another rule check to see if those timers had expired upon restart and turn off what’s needed.

I’m sure some of the great maintainers and experts could help you out with some code suggestions if needed. If you come up with a solution please post it here for others to use.


At first I encountered also no severe stabiltiy problems with OH2 yet! :wink:
But: to be on the safe side you could use persistance and some intelligent rules as KidSquid pointed out.

You can tell OH2 in rules what to do at systemstart. So just to be sure, your light is on even OH2 was out at the sunset-event, you can just adjust your rules as described here:

But then again: I always like to think of openHAB2 of a means to automate things and actions I’d otherwise have to do manually. That means two Things:

  1. always have the “original” way handy (in your case a physical switch for your lighting)
  2. don’t rely only on openHAB2 (or any other home automation), so if you see your lighting not ON, you could just as easily turn it ON with your physical switch… :wink:

Thanks @binderth

I guess this weekend I’ll be diving into Rich Koshak’s

Looks like a good investment in the long run.