this post was submitted on 22 Aug 2023
21 points (100.0% liked)

homeassistant

11372 readers
23 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS
 

So, I want the following to happen, does anyone have any advice the best way to make the conditions in HA?

If it’s bright outside, close the blind and turn on the light If it’s dark outside, close the blind and turn on the light If it’s anywhere in between, keep the blind open - if it’s ‘dark enough’ turn on the light as well.

I haven’t bought any lux sensors yet. I do believe it’s a lux sensor I need. Can I make this automation with 1 (pointing outside and using that value to control both the light and blind) or would I need to have 2? (I assume, one pointing outside controlling the blind, the other in the room controlling the light?

top 15 comments
sorted by: hot top controversial new old
[–] thehatfox@lemmy.world 9 points 1 year ago (1 children)

You may get better results by using both indoor and outdoor lux sensors. Depending on the sun position, room layouts and window locations there can be a quite a difference in outdoor and indoor lux levels, which might interfere with your automations.

I use a combination of Aqara Zigbee motion sensors, which also have a lux sensor, a couple of dedicated lux sensors, and my outdoor security cameras which have a day and night sensor.

You can always try it with one and add more if you need more granularity. Every smart home is different.

[–] Nimrod@lemm.ee 1 points 1 year ago (1 children)

In my experience, aqara motion/lux sensors are pretty binary. I have one in my greenhouse to help with my lighting, but the lux value goes from 0 to max when ANY amount of light hits it.

There is no way I can tell the difference between cloudy and sunny. I can’t tell the difference between 6am (sun just over the horizon, but still behind trees) and 12 noon.

I would love to be able to detect when the sun goes behind a tree and shades my garden, but that’s just not possible with the granularity of the data I’m getting.

[–] EyesEyesBaby@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

My aqara lux sensor actually works pretty well, but I use it to determine when it gets dark; not if it's cloudy or not.

[–] CameronDev@programming.dev 6 points 1 year ago (1 children)

You might be able to get a long way without the sensors. Using a weather sensor + sunrise/sunset sensors?

I think just one sensor for outside is enough, you'll probably need to experiment with the "bright" and "dark" values. Leave a decent gap in between the two bright and dark values to avoid the blinds bouncing up and down.

You can probably make the sensor yourself with a LDR (light dependant resistor) and a microcontroller (esp32 or similar)

[–] thehatfox@lemmy.world 6 points 1 year ago (1 children)

Relying on sun positions and weather data can be a bit hit and miss for lighting automations. I originally used to limit some of my light automations to only turn on between sunset and sunrise - when it should be dark.

But often when there was heavy cloud during daylight it would be dark enough to want lights, but the available weather data I had was never accurate enough to tell heavy gloomy clouds from lighter clouds.

I added some light sensors to the mix and my automations have been a light more accident and flexible.

[–] monolift@discuss.tchncs.de 1 points 1 year ago

Yeah, I’ve played around with basing it on sunrise/sunset and a local weather api, but it often says it’s cloudy outside when it’s not, and vice versa. Or there’s various types of cloud; the API can’t differentiate.

[–] pm_me_your_trash@lemmy.zip 3 points 1 year ago (2 children)

Can't you just use time as an input? That's how I control the brightness of my lights

[–] ChlorineAddict@lemmy.world 3 points 1 year ago (2 children)

You must live near the equator where it’s always sunny and the sun always sets at the same time. As one moves near the poles the light shifts significantly with time and weather. Northern US States for example there could be light in the sky at 11p in the summer, and indistinguishable from midnight at 4:30p in the winter. If you get a particularly cloudy day or a smokey day you may need to turn on the lights to compensate.

Time is doable, but it’s pretty simplistic in terms of a set and forget home automation system to actually light and shade based on conditions which OP is asking for.

[–] pm_me_your_trash@lemmy.zip 3 points 1 year ago

I don't live near the equator. And yeah I don't use time I use the time when the sun sets and rises which works pretty good. But you're right on cloudy days I need to turn them on earlier by hand.

[–] notfromhere@lemmy.one 2 points 1 year ago* (last edited 1 year ago)

There is a US gov weather API that I believe tells the time for sunrise and sunset, so conceivably it could be done based on time that is adjusted based on the API call. Could also take into account weather conditions. I think a light sensor would help the best although I think two sensors would be ideal (one inside) because perceived brightness can be different even when illuminance is the same outside vs inside, but maybe not enough to matter in this case.

[–] monolift@discuss.tchncs.de 3 points 1 year ago

I considered this, but I want it based on outside brightness, as it affects glare in the room. I’d like the blind to be open if at all possible, i.e. when it’s duller outside.

[–] Starfighter@discuss.tchncs.de 3 points 1 year ago* (last edited 1 year ago) (1 children)

One sensor should be enough. I believe they usually mount onto the inside of the window facing outwards so that lights and movement in the room don't influence it.

The simplest way of solving this would be with technically four separate automations. However you can place them all in the same HA Automation using multiple triggers and trigger IDs. (Or have one for the blinds and one for the lights with two triggers each)

I'm going to assume the blinds are somewhat light translucent.

For the blinds use a numeric trigger that fires if the lux value is over some threshold for let's say 10 minutes. That way it won't trigger for every tiny cloud. When triggered lower the blinds.

Add another numeric trigger for moving back up when the lux value is under some threshold for 10 mins. Test to make sure that lowering or raising the blinds doesn't darken or lighten the room enough to immediately have it trigger the other trigger. If it does then increase the difference between the two thresholds.

Copy the same procedure for the lights. The timer can be shorter here, maybe try 1 minute. Make sure that the thresholds are low enough as otherwise lowering the blinds would immediately turn the lights on. I would suggest first tuning the blind triggers and then tuning the light thresholds to your liking.

If you can't set the light thresholds low enough so that the blinds don't interfere with them you'll need a somewhat smarter automation but I'd try the easy way first.

[–] monolift@discuss.tchncs.de 2 points 1 year ago

Yeah, this is what I was thinking, though I didn’t consider that the sensor facing outwards might get a different lux value if blinds are up or down with the same cloud state. I thought they’d literally be directional, having not had one before. Thanks!

[–] OminousOrange@lemmy.ca 1 points 1 year ago

I've made an automation that uses sun azimuth as the trigger (window is otherwise shaded), with outside temperature and cloud cover conditions so it'll stay open if it's cloudy or cool outside. You could add cloud cover triggers to activate while the sun is in the azimuth range to open the blind if it goes from sunny to cloudy too. Toggling the light can be an action alongside the blind.

I use the met.no integration for temperature and cloud cover entities.

[–] ErwinLottemann@feddit.de 1 points 1 year ago

the 'actual daylight level' is my main automation trigger. I used to do it using the azimuth but that didn't cover rainy days or days with a clouded sky so I added the lux sensor of my outside motion sensor into this. until the battery went out during a holiday. I now have a template sensor named 'reliable light level'. It uses the actual lux sensor as the main value, if that is not available I use the sun azimuth and do some calculations with the date and time to get a light level. after that it was a bit of trying things out to find the perfect levels for

  • turn on light in the staircase with motion
  • turn the staircase lights on completely
  • shut the blinds when it's too sunny

I do this by activating different mode booleans (dim, dark, light) so the automations are triggered by them turning on or off and Incan also check the state of these in the automation conditions.