First some easy stuff.
Why trigger the rule when system_comfort changes to OFF if you’re just going to ignore that case and only do something when it’s ON?
Secondly, I don’t think the Exec binding work the way you think it does. Looking at the docs, each Exec Thing has five channels: input, output, exit, run, and lastrun. You’ve linked your Item to the run
Channel, but the run
Channel needs to be linked to a Switch Item, not a String Item. When you want to pass a String to the script, as a command line argument, you would use a String Item linked to the input
Channel and in your command that String would replaced %2$s
with the String. You are not passing a String to the command as an argument so you shouldn’t have a String Item at all, just a Switch Item.
So with those changes we get
Switch system_comfort "Restart comfort" {channel="exec:command:system_comfort:run", autoupdate="false"}
rule "Restart Comfort"
when
Item system_comfort changed to ON
then
system_comfort.sendCommand(ON)
end
But what is this whole contraption doing? system_comfort
will only ever change to ON when it’s been updated or commanded to be ON. It will only be commanded to be ON if you’ve somewhere sent it a command, such as from the UI or from another rule.
But you’ve got autoupdate=false
so the Item won’t change to ON when it receives the command. However, per the binding docs, the Item will be updated to ON when the Exec binding is running the script and as configured, that will happen every 15 seconds. When the script stops running, the Exec binding will update the Switch to OFF.
So the flow will be:
- Exec kicks off the script
- Exec updates the Switch Item to ON
- Rule is triggered
- Rule sends ON command to the Switch Item
- Exec binding tries to run the script again while it’s still already running the script from step 1
- Eventually the script exits or times out and the Exec binding updates the Item to OFF
So you end up running the same script twice at the same time. The second one almost certainly fails because systemctl
creates a lock to prevent two commands on the same service from executing at the same time I think.
In other words, your Rule i not accomplishing anything at all and just might be causing problems. Get rid of it. If it worked before (which I doubt it worked without some sort of complaints in the log) it was a fluke related to the fact that sudo systemctl...
is meaningless as a command sent to a Channel expecting a Switch command.