Hi,
I’ve been digging through the forum but haven’t found anything on this.
I’m building a home automation using openHAB and a few raspberry pi’s - one runs OpenHAB, the others run an MQTT script which listens for commands for the outputs and sends updates on input changes.
These are the items as I have them listed:
//RP1
Contact est1up "Sala 1 SOBE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor1/topic:state:default]"}
Contact est1down "Sala 1 DESCE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor2/topic:state:default]"}
Contact est2up "Sala 2 SOBE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor3/topic:state:default]"}
Contact est2down "Sala 2 DESCE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor4/topic:state:default]"}
Contact est3up "Sala 3 SOBE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor5/topic:state:default]"}
Contact est3down "Sala 3 DESCE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor6/topic:state:default]"}
Contact est4up "Cozinha SOBE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor7/topic:state:default]"}
Contact est4down "Cozinha DESCE [%s]" (gInterruptores) {mqtt="<[mybroker:rp1/sensor8/topic:state:default]"}
Rollershutter Shutter_SalaCoz "Cozinha Jardim [(%d)]" <rollershutter> (gEstores, GSala, GCozinha) {mqtt=">[mybroker:rp1/actuator1:command:UP:UP],>[mybroker:rp1/actuator1:command:DOWN:DOWN],>[mybroker:rp1/actuator1:command:STOP:STOP] "}
Rollershutter Shutter_SalaMeio "Sala Meio [(%d)]" <rollershutter> (gEstores, GSala) {mqtt=">[mybroker:rp1/actuator2:command:UP:UP],>[mybroker:rp1/actuator2:command:DOWN:DOWN],>[mybroker:rp1/actuator2:command:STOP:STOP] "}
Rollershutter Shutter_SalaTV "Sala TV [(%d)]" <rollershutter> (gEstores, GSala) {mqtt=">[mybroker:rp1/actuator3:command:UP:UP],>[mybroker:rp1/actuator3:command:DOWN:DOWN],>[mybroker:rp1/actuator3:command:STOP:STOP] "}
Rollershutter Shutter_CozRua "Cozinha Rua [(%d)]" <rollershutter> (gEstores, GCozinha, GSala) {mqtt=">[mybroker:rp1/actuator4:command:UP:UP],>[mybroker:rp1/actuator4:command:DOWN:DOWN],>[mybroker:rp1/actuator4:command:STOP:STOP] "}
Now I’m trying to implement rules for two things:
A general rule for all rollershutters, defining a delay after which it should send a stop command, giving enough time for the shutters to completely open or close, and cutting power after that.
I could write a simple delay, but I’m not sure on how to use one rule for all shutters. writing a rule for each single shutter is not very smart coding because there are a lot of them!
Ideally I could even make a percentage calculation based on the fraction of time, like the sample on the wiki but I’m not sure how to make it so that it works for all shutters - can I use the shutter group instead of the single item?
The other question is how to deal with the local wall switches. They will be momentary push button type, so I’ll have to make a rule to trigger the corresponding shutter. It could either be to work while pressing, or to do a single push to go up or down and stop when pressed again.
Any ideas on how to accomplish this?
Cheers!