I’ve a shelly that is controlling the built-in bathroom lighting. The lighting is turned on/off using a impulse-function thus the output needs to be “turned on → 0.1s pause → turned” off to toggle on/off.
As you understand this does not report correct status as the icon will always be off.
I’m creating a template lightning with help of input_boolean and input_number.
The input boolean is triggered by events in the shelly, ensuring to always toggle no matter if I control it using hass or press the switch physically. This works well.
The dim level is set using a helper. I “dim the light” by adding a longer pause (e.g 2s) but it’s similar to toggle on/off described above. This mimics a long press
I can’t set the level on the lights, as I understand it set_level is used to actually set the level with a command. level_template according to the documentation “Defines a template to get the brightness of the light.”.
My scripts is “setting the level by pausing”. This used for motion-detection and sets the level during the day. It writes a number to an input_number, which I want the template light to read.
I have 3 different scripts, which pauses different about of time and sets a different amount of value.
They are identical and should be merged in the future.
Interesting, but I think it’s obvious at this point that it doesn’t help the Template Light to work correctly.
EDIT
The values of value_template and level_template should be reported only in response to what the Template Light specifies.
For example, if light.example is a Template Light and you use light.turn_on to set its brightness to 50%, then value_template should report on and level_template should report 127 (apprx. 50% of 255).
In other words, you don’t control a Template Light via those two options, they’re meant to provide a confirmation to the Template Light being turned on/off or setting its brightness.