Release = Raspbian GNU/Linux 10 (buster)
Kernel = Linux 5.4.51-v7+
Platform = Raspberry Pi 3 Model B Rev 1.2
openHAB 2.5.8-1 (Release Build)
The concept here is to send a “switch off” command to the 433 receiver (poweroutlet) multiple times in the evening because in between it could have been switched on by the remote control unit that lays around in the living room (and is completely independed on purpous from openHab).
Problem seems, that the script is executed just sometimes.
Now, how can I “force” openHab to send the switch off command independent of what it thinks that the state is before?
[A different switch with time rule I use works quite reliably, the difference is that it is executed only once a day, so a different frequency]
Log when it works:
==> /var/log/openhab2/openhab.log <==
2020-10-04 21:10:00.384 [INFO ] [e.smarthome.model.script.LAN abends ] - ausgeschaltet : 12345
==> /var/log/openhab2/events.log <==
2020-10-04 21:10:00.402 [ome.event.ItemCommandEvent] - Item 'Funksteckdose3Switch' received command 12345
2020-10-04 21:10:00.414 [nt.ItemStatePredictedEvent] - Funksteckdose3Switch predicted to become 12345
2020-10-04 21:10:00.447 [vent.ItemStateChangedEvent] - Funksteckdose3Switch changed from 12340 to 12345
… and I put a control log into the script that switches the poweroutlet. In the case above it writes to the log so it means the script is executed correctly.
04/10/2020 21:10:00 Script /opt/433Utils/RPi_utils/Funksteckdose_1.sh mit dem Parameter 12345 gestartet. Kommando: /opt/433Utils/RPi_utils/codesend 12345
sending code[12345]
Log in case the switch has not been executed (and no entry in the script-log):
==> /var/log/openhab2/openhab.log <==
2020-10-04 22:10:00.051 [INFO ] [e.smarthome.model.script.LAN abends ] - ausgeschaltet : 12345
==> /var/log/openhab2/events.log <==
2020-10-04 22:10:00.070 [ome.event.ItemCommandEvent] - Item 'Funksteckdose3Switch' received command 12345
2020-10-04 22:10:00.081 [nt.ItemStatePredictedEvent] - Funksteckdose3Switch predicted to become 12345
–> the line with the “changed from … to …” is now missing.
Rule:
rule "LAN abends aus"
when
Time cron "0 10 21 ? * MON-SUN *" or
Time cron "0 10 22 ? * MON-SUN *"
then
Funksteckdose3Switch.sendCommand(12345)
logInfo("LAN abends ","ausgeschaltet : 12345")
end
Thing:
Thing exec:command:Funksteckdose-control [ command="/opt/433Utils/RPi_utils/Funksteckdose_1.sh %2$s", interval=0, autorun=true ]
of course the
/opt/433Utils/RPi_utils/Funksteckdose_1.sh %2$s
is in the whitelist…
Item:
String Funksteckdose3Switch "Funksteckdose 3" <poweroutlet> [ "Switchable" ] { channel="exec:command:Funksteckdose-control:input" }
Thanks for any idea …
Andreas