I search our community for a solution to brightening and dimming the lamp that illuminates the aquarium. Unfortunately, I do not know much about programming - I guess you have to do it with a script, because automation alone will probably not be enough?
I found a lot of information on this subject, but I cannot integrate the knowledge into one whole.
alias: Big aquarium lights on
description: ""
trigger:
- platform: time
at: "10:30:00"
condition: []
action:
- device_id: 821e8d3d5aeea786256ac4b3ec67c3bf
domain: number
entity_id: number.lighting_controller_1_tuya_brightness
type: set_value
value: 10
- type: turn_on
device_id: 821e8d3d5aeea786256ac4b3ec67c3bf
entity_id: switch.lighting_controller_1_tuya_switch
domain: switch
mode: single
Unfortunately, I have no idea how to brighten an already turned on lamp.
I think it should probably be a loop where:
The values will go from 10 to 1000, I want the step to be 1 and the waiting time is 4 seconds:
(Tuya dimmer - takes numerical values from 10 to 1000)
That is:
- Set the brightness to: 11
- Wait 4 seconds
- Set the brightness to: 12
- Wait 4 seconds
- Set the brightness to 13
...
and so on until the brightness is 1000
Can I ask you for help in this matter?
Thanks in advance for all the information.
Use call services not device actions. Combine it with a repeat until.
This automation does it all. You can play around with step, start, and end. Just make sure to keep start lower than end, and make the step size smaller than start minus end.
That relies on the hardware status. Tuya devices are known to be… sub-par. In his case, he would need to have 100% uptime over 66 minutes for an until repeat version to work. Personally, I wouldn’t trust any Tuya device to maintain that uptime based on all the issues we see on the forums.
EDIT: Marius just had a until loop that caused a memory leak because it fired infinitely when the first action failed to occur which skipped the delay (causing the until to never be reached).
I have an additional question for you, can you recommend any materials on the Internet that will allow me to understand the syntax and use the knowledge in the future, e.g. in other automation?
I analyzed the code you wrote, it is understandable to me except for one line:
stops: "{{ range(start, end - 1, -step) | list }}"