Automating lighting for restaurant

We have a restuarant with Caseta switches and a bridge, all the lights are on Caseta dimmers.

I’ve set up the lutron app with a bunch of schedules to take the lights down to a nice level by sunset to set the moody (it’s a wine bar).

Where it breaks down is if it’s raining and dark, the lights are too bright earlier in the evening, so the staff adjust them, but then the schedules continue to run which raises them again.

Im a software developer, but I’ve never used Home Assistant and don’t have much experience with the Caseta stuff and I’d like to make sure what I want to do is possible before I dig in too deep.

I’m wondering if it’s possible with Home Assistant or some other way to do one of the following things.

  1. Have the lights dim over a period of time, up until sunset to hit a target final level. So if today they are seto to 60% at 7pm, by 8pm they’d hit 25%. tomorrow if they are at 70% at 7pm, they would still hit 25% by 8pm. the final target is what is important.

  2. Let’s say the program starts reducing at 7pm and someone adjust the lights down at 720pm as they are too high, I’d want it to continue lowering linerally based on the new value to hit the 25% target and not stop the automatic lowering

  3. Use a light sensor to set the light at all times based on the outside ambient light. This to me seems the best solution, as I can set inside light levels through the day that are directly based off the level of light outside in some ratio. As the light reduces in the evening it is constantly adjusting the inside levels and this way it works on all days, in all seasons.

Is any of this possible?

One other thing is I’d like to be able to group many of our dimmers together into one slider, so the whole restaurant can be adjusted with one swipe. Is this possible?



I don’t personally use Caseta, so I’m not sure about the details of how they, and the bridge, integrate with HA. I do, however, use many Z-Wave switches & dimmers.

All of what you want should be possible, depending possibly on how fine-grained the Caseta integration is.

BTW, if you don’t have a illuminance sensor, or before you get one, you could try out my custom illuminance integration that estimates outside light level based on current weather conditions and either sun elevation or time of day.

I would think you could use time triggers and a percentage of the percentage.

So letas say the first dimming occurs at 7, then you add a condition to this trigger if it’s below 70% then don’t do anything.
The other time triggers you could do (here I assume you want to end at 25% and it will dim this over four occasions) {{ current % - ((current % - 25%) / 4) }}

So this means whatever the staff has set the brightness to will be honored and from then on the steps are equally large until you get to the end brightness.

@pnbruckner thank you, yes i saw your integration and would try that first for sure. We don’t get direct sun as we are east facing, so that is part of the issue in the evening also.

@Hellis81 thank you, much appreciated. Glad to see we can write our own logic. It seems to me like something really obvious folks would want, linear light reduction from a starting point to a maximum ending point over a set period of time that starts at x minutes prior to sunset.

I thought i had a raspberry pi kicking around but looks like I’m going to need to grab one.

For the grouping into a single dimmer slider, is that fairly straight forward?


Yes it is.
Just add them to a group.

Thanks! That’s what I was hoping.


Ok so i have my PI, i have HA installed, I have added HACS and added your sensor and installed the openweather integration, and I’m a bit lost now.

I’m 100% new to HA, wondering if you have any guidance on how I configure the sensor to look at the sun level, cloud coverage etc. I’m not sure where the YAML goes. If I want it to use cloud coverage etc as well as sun level is that automatic or do I need to do additional configuration?


I believe the weather should give you clouds?
Or perhaps that depends on what weather integration you use.
Sun should be standard.

Not sure if you are going the correct path though.
Relying on weather and sun to set the light level will be tricky and filled with errors.
Perhaps you need a light level sensor instead that measures the light level from the sun? (a physical device)

Or just try what you had in mind from start, that the staff sets the “start” light level and the automation does the rest.

@Hellis81 good point. I was thinking I would use the weather (is it cloudy / rainy?) to set the initial start point automtically so the staff don’t have to think about it, from there the automation would take over, reducing things linearly until sunset.

But you are right, might be a good idea to just get a few things in place.

  1. Group all the lights so they can be dimmed together.
  • Question, do they all have to have the same dim level? For our lighting, at any given time, different lights are at different %'s of dimming for that light to get the overall effect. I’m wondering if I need to have a slider for the main lights, and then have all the other lights dim relative to those lights on the dimming event? Is that the best / easiest way to accomplish that part?
  1. Once I have that working, then I’d create the automation that did the auto diming betwen 90 minutes before sunset and sunset

  2. Once that is all working, could add a sensor (physical or the software one based on weather) to set the start level.


If you want this then perhaps create more than one group?
So “left” lights are grouped, “center” lights or however you want.
That will probably be easier.
It’s possible to control each of them individually but if you have groups then it will be easier.

Start with this and report back what the entities are called and how they compare percentage wise.

Sorry for not knowing, but is this a local integration you are using? And the dimming is being done on mains powered dimmers?

You must provide the illuminance integration sensor with one, and only one, input entity. It will use the main state of that entity. If the main state is numeric, it will assume it is a cloud coverage % sensor. If not, then it will assume it is an entity that provides a weather condition. In either case, it will adjust the estimated illuminance (which is derived from the sun’s position, or the time of day, depending on how you configured it) based on the coverage % or condition.

That’s “Home Assistant 201”. :wink: I.e., if you’re used to adding & configuring HA only via the UI, then this is an advanced topic (although it used to really be the only way to configure HA.) See:

If you want to use the sun’s position, then that is the default. Per the docs for this integration, your configuration.yaml entry should look something like this:

  - platform: illuminance
    # Name of new sensor entity
    name: Home Outdoor Illuminance
    # Existing entity that provides current weather conditions
    entity_id: weather.home

Of course you can change the name to whatever you like. And the value provided for entity_id depends on which weather, or weather related sensor, entity you want to use as input. You have to decide what you want to use, then get its actual entity ID and use that in the configuration.

Thanks, I have groups - they actually came over from the Casetta device, I can change them.

The thing we need for example is:

Bar Group
six pendants (over bar)
6 task lights (over staf)
1 led strip under bar top for ambience

Setting at dusk may be something like:
Pendants at 55%
task lights at 78%
led strip at 30%

Can i create a slider that would adjust those all relative to where they start with a single swipe?

If not, would it make sense to do something like
When the bar pendants are adjusted, adjust the task lights down to be equal to 1.25 * the level of the bar pendants?

Thanks, that’s great, I’ll check out the VS Code integration.


Sorry, missed a couple of questions you had.

Local integration, all Lutron Casetta switches with hub. Mains powered dimmers.

I’ve got a few groups now

Bar Lights
Booth Pendants
Main task lights.

You can do this in a few ways.
Either you make one light (group) the “master” as you say and the rest follow this.
This will work great for everyday use when you always follow the same schedule and you never make the bar lights 100 percent because someone at the bar asks for more light.

You could also create a template light, this light is a fictive light and all groups follow this fictive master.

You could make it more complex by creating numbers for each group.
Three numbers representing the percentage of what the master light is.
So let’s say you create a fictive light as the master then you create a variable number that you can regulate the percentage of the master this light should be at.
A quick example is light.master is set to 100%, then we have a input_number.bar_lights that is set to 0.55.
This means you get 55% on the lights because the master light will also affect the percentage you now have master control and each group control, and you can automate to either just change the master light or each group.

So the answer to this question:

Is yes and you can do a lot more.
I doubt you can think of something that we can’t help you solve


Ok that all makes sense. I guess the next question is, where do I do this?

I’ve been pocking around and I see automations, scripts, scenes. Just need an idea of where to start, a primer walk through post or video or something.

The very first thing I want to do is to migrate the existing schedules into HA and have them dim from the set point to my target night time point linearly and to not go back up in value if someone adjusts them over the 90 minutes the schedule is running, just continue decreasing.

I understand the the logic, just not exactly sure where to put all this stuff.

I have the VS Code server installed now so have access to that.

Anywhere you can point me for a primer would be helpful. thanks!

Well I spent the weekend playing, and yeah, this is slick!

I have everything set up except the auto dim, but have a simple plan for that where it will just decrease a percent every few minutes from sunset -90 minutes until it reaches the minimum. If the lights are adjusted, it just keeps dropping.

I’ll also give them a “Stop” Button of some sort if they want to totally override it.

I’ve done this all just through the automation and scenes UI so far. Will look at the scripting more as i get into this.

Also got our alarm integrated in via

Thanks for the help everyone.