With the help of Domoticz I have automated my curtain at home. For this I used two ESP relays. I then created two switches in Domoticz for these relays called $ESP1 and $ESP2. I then created a selector switch called 'Gordijn_Wietse' with the options 'open', 'dicht' (closed), 'open met interval' (open with intervals, great for the mornings) and 'stop' (to stop if anything would go wrong). I made a script which toggles the ESP switches when performing an action on the selector switch. In this way, when pressing 'open' on the selector switch, the curtain automatically opens and after X seconds the motor stops. I included that in the script. Right now, it is however still possible to press 'open' after I have already opened the curtain, which means the motor tries to open an already open curtain and I'm afraid that at some point in the future these excessive forces will become fatal for my setup. I therefore want to include a restriction. I want to make it impossible to press 'open' or 'open met interval' on the selector switch when the switch is already on 'open'. In other words, the only options to press when the curtain is open should be 'dicht' or 'stop'. I have tried to implement this myself, but till now I'm not managing to do so. Does anyone know if this is even possible and if yes, how?
For switching to open, my straight-forward LUA code right now looks like this:
Code: Select all
if (devicechanged['Gordijn Wietse'] == 'Open') then
commandArray['$ESP1']="On FOR 69 SECONDS"
commandArray['$ESP2']='Off'
end