I have a light dimmer on an esphome, I have the http_request and web server hoping I could send a request to set the brightness without turning it on. But it does not seem to be exposed for doing this.
Reason I want this is at night I was the bathroom lights to only turn on to a very dim setting.
Probably better to have the brightness set at turn on with a time check. I do this with a porch light. Here is the HA automation.You could probably adapt bits of this and run it on the ESP.
I like your solution, i may change mine to something similar just my condition is not time based.
I did come up with a solution using the native api to create a service for the esp that allows me to call from HA or NodeRed to set a brightness level. The service just sets a global var on the esp, then when the switch turns on that var is used for the brightness value. This covers my use-case but has holes in it because i have not coding catching all the ways the brightness can be changed to “reset” the value.
Shocking that HA and esphome do not expose an api to change light settings WITHOUT turning on the light. Since then the light will turn on with the last state set naturally.
I would like to revive this thread because I need the same functionallity.
Little background: I have a shelly dimmer 2 flashed with ESPHome which is automated using the Entity Controller component. There it is possible to turn my lights on when motion is detected but also declare a so called “night mode” where the brigthness can be set to a different level. After the night mode finishes, I disable the automation, so that the light gets not turned on automatically at full brightness in the mourning.
I would need a way to reset the brightness again without turning on the light in case someone turns the light on manually afterwards.
The Rest API allows me to turn_on, turn_off and toggle the light, but only the turn_on command allows specifying a brightness.
I remember the official shelly API allowed me to also set the brightness level on the turn_off command, so I just called http://url_of_shelly/light/0?turn=off&brightness=100 while it was already off.