Hello,
I have a rule that’s propperly executed only once. As I assume that’s related to the SmartThings binding I post my question here:
My environment:
- openHAB 2.5 running in a Docker container on a QNAP TS-131P
- SartThingsBinding 2.5.5
- SmartThings Hub (firmware 000.032.00010)
- Osram Plug X3 (it’s a ZigBee outlet, firmware 0x01020509 - according to the hub it’s the latest version)
The rule:
var Timer BHTimer = null
rule “SSD_1 ausschalten”
when
Item SchaltSteckDose_1_AnAus received update
then
logInfo(“SSD_1.rules”, “SSD_1 status update triggered”)
if (SchaltSteckDose_1_AnAus.state == ON) {
logInfo(“SSD_1.rules”, “SSD_1 status ON”)
BHTimer = createTimer(now.plusMinutes(1), [|
SchaltSteckDose_1_AnAus.sendCommand(OFF)
logInfo(“SSD_1.rules”, “SSD_1 switched off”)
BHTimer = null
])
}
end
Purpose: when the plug is switched on manually it should be switched off by openHAB 1 hour later (currently it’s set to 1 minute in the rule).
The first time after a container restart it works very well:
openhab.log:
2020-10-19 11:38:54.957 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status update triggered
2020-10-19 11:38:54.962 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status ON
2020-10-19 11:39:54.984 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 switched off
2020-10-19 11:39:55.030 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status update triggered
2020-10-19 11:39:55.223 [INFO ] [s.internal.SmartthingsHandlerFactory] - Sent message “{“capabilityKey”: “switch”, “deviceDisplayName”: “SSD 1”, “capabilityAttribute”: “switch”, “value”: “off”}” with path “/update” to the Smartthings hub, recieved HTTP status 202 (This is the normal code from Smartthings)
2020-10-19 11:39:55.619 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status update triggered
events.log:
2020-10-19 11:38:54.754 [vent.ItemStateChangedEvent] - SchaltSteckDose_1_AnAus changed from OFF to ON
2020-10-19 11:39:54.994 [ome.event.ItemCommandEvent] - Item ‘SchaltSteckDose_1_AnAus’ received command OFF
2020-10-19 11:39:55.003 [vent.ItemStateChangedEvent] - SchaltSteckDose_1_AnAus changed from ON to OFF
SmartThings hub events:
But on the 2nd attempt it’s not switched off.
openhab.log:
2020-10-19 11:54:36.042 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status update triggered
2020-10-19 11:54:36.056 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status ON
2020-10-19 11:55:36.063 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 switched off
2020-10-19 11:55:36.136 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status update triggered
2020-10-19 11:55:36.341 [INFO ] [s.internal.SmartthingsHandlerFactory] - Sent message “{“capabilityKey”: “switch”, “deviceDisplayName”: “SSD 1”, “capabilityAttribute”: “switch”, “value”: “off”}” with path “/update” to the Smartthings hub, recieved HTTP status 202 (This is the normal code from Smartthings)
Plug switched off manually
2020-10-19 12:15:36.544 [INFO ] [e.smarthome.model.script.SSD_1.rules] - SSD_1 status update triggered
events.log:
2020-10-19 11:54:36.016 [vent.ItemStateChangedEvent] - SchaltSteckDose_1_AnAus changed from OFF to ON
2020-10-19 11:55:36.103 [ome.event.ItemCommandEvent] - Item ‘SchaltSteckDose_1_AnAus’ received command OFF
2020-10-19 11:55:36.141 [vent.ItemStateChangedEvent] - SchaltSteckDose_1_AnAus changed from ON to OFF
SmartThings hub events:
On PaperUI and the app I can switch on and off the plug without any problem.
Any input appreciated.
Reinhold