Maybe an important update. When putting both executeCommandLine in the same rule, then the problem disappears.
It seems that the problem only pops up when
- using multiple executeCommandLine calls from different rules, meaning that we can have multiple executeCommandLine() running at the same time
- using a timeout
- (maybe, too) calling scripts that take several seconds to complete
rule which is running fine
rule "scipts"
when
Time cron "0/12 * * * * ?"
then
executeCommandLine("/usr/bin/python /etc/openhab2/scripts/spotify.py",5000)
executeCommandLine("/usr/bin/python /etc/openhab2/scripts/tuinhuis-zwembad.py",5000)
end
before, I had them launched from different rules files:
rule "Spotify scheduled refresh"
when
Time cron "0/12 * * * * ?"
then
executeCommandLine("/usr/bin/python /etc/openhab2/scripts/spotify.py")
end
and
rule "Scheduled sync with redis"
when
Time cron "0/15 * * * * ?" // every 15 seconds
then
//logDebug("hvd","sync redis start")
executeCommandLine("/usr/bin/python /etc/openhab2/scripts/tuinhuis-zwembad.py") //5000 ms timeout verwijderd
//logDebug("hvd","sync redis end")
end
scripts:
from myopenhab import openhab
import redis
oh=openhab()
#open connectie met de redis database in tuinhuis
r = redis.Redis(host='blabla', port=6379)
#lees waarden uit redis en geef ze door aan openHAB
oh.sendCommand('TemperatuurTuinhuis',r.get('TemperatuurTuinhuis'))
oh.sendCommand('WarmtepompLuchtIn',r.get('WarmtepompLuchtIn'))
oh.sendCommand('WarmtepompLuchtUit',r.get('WarmtepompLuchtUit'))
oh.sendCommand('TuinhuisVerwarming',r.get('TuinhuisVerwarming'))
oh.sendCommand('PentairCurrentRpm',r.get('PentairCurrentRpm'))
oh.sendCommand('PentairCurrentPowerConsumption',r.get('PentairCurrentPowerConsumption'))
oh.sendCommand('PentairCurrentClock',r.get('PentairCurrentClock'))
oh.sendCommand('PentairStatus',r.get('PentairStatus'))
oh.sendCommand('WarmtepompStatus',r.get('WarmtepompStatus'))
if r.get('PentairStatus')=='10':
oh.sendCommand('PentairWattPerRpm',float(r.get('PentairCurrentPowerConsumption'))/float(r.get('PentairCurrentRpm')))
else:
oh.sendCommand('PentairWattPerRpm','0.00')
#watertemperaturen alleen loggen als de Pentair pomp draait, rekening houdend met opstart-timeout.
if oh.getState('WaterTemperaturesValid') == 'ON':
oh.sendCommand('FilterWaterUit',r.get('FilterWaterUit'))
oh.sendCommand('WarmtepompWaterIn',r.get('WarmtepompWaterIn'))
oh.sendCommand('WarmtepompWaterUit',r.get('WarmtepompWaterUit'))
else:
oh.sendCommand('FilterWaterUit','NULL')
oh.sendCommand('WarmtepompWaterIn','NULL')
oh.sendCommand('WarmtepompWaterUit','NULL')
#Setpoints vanuit openHAB doorgeven aan redis
r.set('PentairRpmSetpoint', oh.getState('PentairRpmSetpoint'))
r.set('WarmtepompCommando', oh.getState('WarmtepompCommando'))
I had the same thought and tested this hypothesis. Runtime of both scripts is in the 3s-4s range. Timeout setting is 5000ms. Initially repetition rate was 5s. When increasing to 10s or 16s, the problem persisted. And like I said, problem disappeared by leaving out the timeout and not changing the repetition rate of the executeCommandLine() calls.
That was my fallback, but I wanted to contribute as much diagnostics and analysis to the community as possible.
See above. Frankly, I think this is not adding much value. I am afraid that the focus will move to design of my scripts and the way I connect to remote resources, effectively diverting attention from the issue at hand. Keep in mind that my original scripts and rules have been running non stop for 4 months. This problem popped up when upgrading from OH2.2 to OH2.3.