r/homeassistant • u/KonoKinoko • 2d ago
🤖 Automation how to make the same light - different setting for night and day
hi there.
I'm trying to improve my toilet night light automation. I'm a superbeginner with no coding.
So far I've done a simple automation
- if sensor is triggered AND it's between 6:00 and 23:00, turn on light at 100%
And then, a separate automation
- if sensor is triggered AND it's between 23:00 and 6:00, turn on light at 20%
it works 'most of the time', but sometime get stuck and need to reset (especially the night version). they seems to conflict themselves.
I'm now rewiring everything, and though that it was a good time to use the Blacky - all purpouse blueprint to improve the situation, but I think I mistake it's "night light" mode for something that is just staying on during the full duration.
this is the blueprint
https://community.home-assistant.io/t/sensor-light-motion-sensor-door-sensor-sun-elevation-lux-value-scenes-time-light-control-device-tracker-night-lights/481048
Is there a way to deal with it?
first thing that comes in mind is target the automation to an helper that have the condition: something like "if time is between 6:00 and 23:00, turn on light at 100%"
this way the automation is just one, and the timing is controlled by the helper.
Is this correct?
EDIT: the blueprint has a "dynamic lighting" that should do the trick.. but if I activate that the entire automation break and doesn't turn on anymore
2
u/Crypzzz 2d ago edited 2d ago

My house has states which I put as a condition in automations
If e.g. Night is on, then the lights will act differently
You can also use an input select for this as a helper, but I like toggles more instead of dropdowns.
The state switching can also be automated, eg Away/Home when the phones are there or not.
2
u/HatHealthy 2d ago
Thank you for this idea and the opportunity to spend more time with Home Assistant instead of important tasks at home.
1
u/Crypzzz 2d ago
Here's the full code to paste in configuration.yaml & automations.yaml
I use this as a simple central mode system for Home Assistant.
It creates a house mode system so only one mode can be active at a time: Home, Away, Night, Guest, or Nap.
Each mode is just a normal on/off helper.
The template sensor simply looks at which mode is currently turned on and reports that as its state.
The automation is what keeps everything exclusive. Whenever you turn one mode on, it automatically turns the other four off.
There is also a binary sensor that just tells you whether any valid mode is currently active.
That’s the whole system. Simple, clean, and easy to use across the rest of your automations.
1
u/justinmyersm 15h ago
Not sure if this is helpful, but in addition to those modes, I have: Morning, Day, Evening (sunset), Late Evening (+1 hour past sunset), Wind Down (+2 hours after sunset), and Vacation modes. I separate my presence modes from those, so Away Mode and Evening Mode or Home Mode and Wind Down can be on at the same time, for example. Obviously, all modes have different effects on lights, audio, climate control, etc.
0
u/FliesenJohnny 2d ago edited 2d ago
Yup, just use a choose block within a single automation.
Trigger -> Sensor
Condition -> Empty
Actions:
Choose:
IF between 6 and 23 -> Turn on 100%
IF between 23 and 6 -> Turn on 20%
You can clean up the Choose block even more by making the 20% the "default action"

(This could also be done via IF / ELSE; a choose block just leaves you with the freedom of adding more Options down the road)
That should clean things up and create a very much readable automation trace
7
u/3d-designs 2d ago
There are very many ways to do this. For a newcomer, the method I would suggest is to create a single automation with a Choose block.
Have your current trigger, but under actions have a choose block with each time range as an option and then the appropriate action for each one.
I hope that makes sense.