1) Give a description of the problem
Hi, first of all - newbie alert, I have written what is essentially my 3rd piston, but the only substantial one intended to manage the underfloor heating of the first floor of my home. I have several questions to ask but I will try to keep it to one question per topic I open, hopefully I can get my head around a few things. My problem with this piston is that I had to repeat chunks of code for each toom - essentially the same code for each room, comparing the temperature in the room to a desired temp every time a temperature change is recorded.
2) What is the expected behaviour?
Basically I would like to be able not to have to repeat the same code over and over, and I was wondering whether there is some way to say:
If
temperature of the current device < the desired temperature of its room
Then
Switch on Heating device of that room
Else If
Temperature of the current device >= the desired temperature of its room
Then
Switch off Heating device of that room
I think it would be optimal code-wise if I had to thus reduce the lines of code. I know I can likely use $currentEventDevice, but then I will likely run into a problem of each room having a different desired temperature…
3) What is happening/not happening?
The piston is working as expected, but not optimised.
**4) Post a Green Snapshot of the piston![image|45x37]
The repetitions start at lines 70-92, which I then repeat on lines 93-115 for a different room, and so on…
5) Attach logs after turning logging level to Full
Don’t think they are needed unless someone asks…