The second case:
This is more complicated as it could not be constantly reproduced and multiple items are affected. I’ve tracked yesterday down one issue, which is quite easy as there are not so many dependencies.
What happened:
My wife was using OH mobile app (android) to open and then close the front gate. This is one switch button in the app. The opening was fine, but when she closed the gate, suddenly the rollershutters went down. The rollershutters can be triggered from the following places:
- When the sun is down (Channel ‘astro:sun:local:set#event’ triggered END) → the rule sets IsDarkOutside.sendCommand(ON) → logged
- Through alexa command → logged
- Manually from the mobile app/habpanel
Sunset rule:
rule "Sunset Rule"
when
Channel 'astro:sun:local:set#event' triggered END
then
logInfo("scenes.rules", "SUNSET triggered")
if(IsDarkOutside.state != ON){
IsDarkOutside.sendCommand(ON)
}
end
When sunset happens:
rule "Turn on external lights when main door opens"
when
Item IsDarkOutside changed
then
logInfo("scenes.rules", "Is dark outside triggered: " + IsDarkOutside.state.toString)
// close the shaders in the kitchen
if(IsDarkOutside.state == ON){
sendCommand(Rs_AllRoom, DOWN)
}
end
Alexa rule:
rule "Alexa rollershutters"
when
Item Shader_Alexa_Ctrl received command
then
var currentState = Shader_Alexa_Ctrl.state.toString
var cmd = receivedCommand.toString
logInfo("scenes.rules", "Shader_Alexa_Ctrl >> State: " + currentState + "; Command: " + cmd)
if(cmd == 'Up'){
Rs_AllRoom.sendCommand('UP')
}
if(cmd == 'Down'){
Rs_AllRoom.sendCommand('DOWN')
}
end
And the logs:
In OH log, nothing is indicating, that the rollershutters are triggered, only by the incorrect status update. This is caused by the wrong implementation on the nodeMCU, as it is trying to return the state “opened”, “closed”, which is not allowed by the rollershutter item. So you can ignore the error, I’ll correct it.
2022-04-12 18:38:07.244 [INFO ] [enhab.core.model.script.xiaomi.rules] - FrontGate managed state: OFF
2022-04-12 18:38:07.247 [INFO ] [enhab.core.model.script.xiaomi.rules] - FrontGate contact state: OPEN
2022-04-12 18:38:09.251 [INFO ] [enhab.core.model.script.xiaomi.rules] - Sending update to managed state: ON
2022-04-12 18:38:14.469 [INFO ] [enhab.core.model.script.scenes.rules] - Open front gate - managed >> ReqState: ON
2022-04-12 18:38:14.472 [INFO ] [enhab.core.model.script.scenes.rules] - Open front gate - managed >> CurrState: OPEN
2022-04-12 18:38:59.205 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'closed' from channel 'mqtt:topic:myMQTTBroker:nodemcu_SRC_Thing:AllRoom' not supported by type 'RollershutterValue': Cannot call update() with closed
Mosquitto log (the command is going to front gate, but then also to rollershutters)
2022-04-12T16:38:52: Received PINGREQ from otatest
2022-04-12T16:38:52: Sending PINGRESP to otatest
2022-04-12T16:38:53: Received PUBLISH from myMQTTClient (d0, q0, r0, m0, 'cmnd/frontgatectrl/gate', ... (3 bytes))
2022-04-12T16:38:53: Sending PUBLISH to frontgatectrl (d0, q0, r0, m0, 'cmnd/frontgatectrl/gate', ... (3 bytes))
-> The message is sent to controller
2022-04-12T16:38:54: Received PUBLISH from myMQTTClient (d0, q0, r0, m0, 'cmnd/somfyctl/roomAll', ... (1 bytes))
2022-04-12T16:38:54: Sending PUBLISH to somfy-remote (d0, q0, r0, m0, 'cmnd/somfyctl/roomAll', ... (1 bytes))
2022-04-12T16:38:59: Received PUBLISH from somfy-remote (d0, q0, r0, m0, 'stat/somfyctl/ack', ... (15 bytes))
2022-04-12T16:38:59: Received PINGREQ from mqttjs_d1e94687
2022-04-12T16:38:59: Sending PINGRESP to mqttjs_d1e94687
-> The ACK is published by the controller
2022-04-12T16:38:59: Received PUBLISH from somfy-remote (d0, q0, r1, m0, 'stat/somfyctl/roomAll', ... (6 bytes))
2022-04-12T16:38:59: Sending PUBLISH to myMQTTClient (d0, q0, r0, m0, 'stat/somfyctl/roomAll', ... (6 bytes))
2022-04-12T16:39:01: Received PUBLISH from tasmota_POW02 (d0, q0, r0, m0, 'tele/tasmota_POW02/STATE', ... (294 bytes))
2022-04-12T16:39:01: Sending PUBLISH to myMQTTClient (d0, q0, r0, m0, 'tele/tasmota_POW02/STATE', ... (294 bytes))
2022-04-12T16:39:01: Received PUBLISH from tasmota_POW02 (d0, q0, r0, m0, 'tele/tasmota_POW02/SENSOR', ... (231 bytes))
2022-04-12T16:39:01: Sending PUBLISH to myMQTTClient (d0, q0, r0, m0, 'tele/tasmota_POW02/SENSOR', ... (231 bytes))
2022-04-12T16:39:04: Received PINGREQ from frontgatectrl
2022-04-12T16:39:04: Sending PINGRESP to frontgatectrl
This is only one of the mysteries.