I want to make a remaining time sensor. I can do it with one Input number, but I have 5 Input numbers (input_number.1, input_number.2 etc.) and 5 switches (with the different input number values). I’d like to cumulate them (input_number.1 + input_number.2 +…+input_number.5, and switch.switch1…switch.switch5) and then calculate the remaining time for all of them. With 1 input_number and 1 switch I have this working code below, but I don’t know how to add the 5 numbers together to calculate.
Not exactly. Some details. I’m working on my irrigation system. I have zones (these are the switches) and I have different programs (script). Each program can run the same switches for different time duration. It works perfecly. The predefined running time of the zones (switches) are set by input buuleans (for each swich in each program). Thet wotks great.
I’d like to make a “remaining time” sensor which shows the remaining time of the program (not the actual running switch) based on the input_number and the elapsed time. The example above shows only one zone’s (switch) remaining time, but I’d like to see the remaining time of the whole program.
Thanks a lot! I’ll give a try. One remaining issue that my code counts witch switch1.last_changed, but I think I can change it to script last changed (the script runs the switch sequences).
I was too fast. Unfortunately counting from script run doesn’t work correctly. Can you please help, how can I change the following with your solution (looking for the first activated switch)? I know I have to change somehow the “as_timestamp(states.sensor.program_1_total_time.last_changed”