Hi is from today that Xiaomi Wireless Switch do not work anymore.
When I press I get this ERROR in the log
2017-10-16 22:58:55.790 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Xiaomi Switch': An error occurred during the script execution: The name '<XFeatureCallImplCustom>.getEvent()' cannot be resolved to an item or type.
I do not changed the rule, that is the same since 1 month:
rule "Xiaomi Switch"
when
Channel "mihome:sensor_switch:158d00015aa33c:button" triggered
then
//logInfo("XiaomiSwitch","Start")
var actionName = receivedEvent.getEvent()
logInfo("XiaomiSwitch","Start -> Action Name:"+actionName)
switch(actionName) {
case "SHORT_PRESSED": {
logInfo("XiaomiSwitch","Switch Luce Ingresso")
if (INGRESSO_LUCE.state == OFF){
INGRESSO_LUCE.sendCommand(ON)
} else if (INGRESSO_LUCE.state == ON){
INGRESSO_LUCE.sendCommand(OFF)
}
}
case "DOUBLE_PRESSED": {
logInfo("XiaomiSwitch","Switch Comodino")
if (CAMERA_PWS_SVEGLIA.state == OFF){
CAMERA_PWS_SVEGLIA.sendCommand(ON)
} else if (CAMERA_PWS_SVEGLIA.state == ON){
CAMERA_PWS_SVEGLIA.sendCommand(OFF)
}
}
case "LONG_PRESSED": {
logInfo("XiaomiSwitch","LongClickPress")
}
case "LONG_RELEASED": {
logInfo("XiaomiSwitch","LongClickRelease")
}
}
end
I think it’s best to restart OpenHab. I use the same code…
rule "Xiaomi Switch"
when
Channel "mihome:sensor_switch:wireless_switch:button" triggered
then
var actionName = receivedEvent.getEvent()
switch(actionName) {
case "SHORT_PRESSED": {
var message = receivedEvent.getEvent()
//pushover(message)
}
case "DOUBLE_PRESSED": {
pushover("double press")
}
case "LONG_PRESSED": {
pushover("long press")
}
case "LONG_RELEASED": {
pushover("long press released")
}
}
end
I actually experience the same thing here on latest snapshot.
I jiust added the rule:
rule "Xiaomi Switch"
when
Channel "mihome:sensor_switch:<ID>:button" triggered
then
var actionName = receivedEvent.getEvent()
switch(actionName) {
case "SHORT_PRESSED": {
TurnOnLightsSwitch.sendCommand(ON)
}
case "DOUBLE_PRESSED": {
TurnOfLightsSwitch.sendCommand(OFF)
}
case "LONG_PRESSED": {
<ACTION>
}
case "LONG_RELEASED": {
<ACTION>
}
}
end
The clicks “Short and double pressed” shows up just fine in the event log, but nothing happens.
Evenmore I just found out that it actually prevents my other rules from running. The ones with the Xiaomi Aqara Human Motion Sensors.
Now this rule doesn’t work anymore.
rule "Hobbyroom Xiaomi Motion LUX Sensor"
when
Item Hobbyroom_MotionSensorLux_MotionStatus changed to ON
then
if (Hobbyroom_MotionSensorLux_Illumination.state < 70 ) {
Hobbyroom_LED1_switch.sendCommand(ON)
Hobbyroom_LED6_switch.sendCommand(ON)
Thread::sleep(600)
Hobbyroom_LED2_switch.sendCommand(ON)
Hobbyroom_LED5_switch.sendCommand(ON)
Thread::sleep(600)
Hobbyroom_LED3_switch.sendCommand(ON)
Hobbyroom_LED4_switch.sendCommand(ON)
Hobbyroom_LED7_switch.sendCommand(ON)
} else {
Hobbyroom_LED1_switch.sendCommand(OFF)
Hobbyroom_LED6_switch.sendCommand(OFF)
Thread::sleep(600)
Hobbyroom_LED2_switch.sendCommand(OFF)
Hobbyroom_LED5_switch.sendCommand(OFF)
Thread::sleep(600)
Hobbyroom_LED3_switch.sendCommand(OFF)
Hobbyroom_LED4_switch.sendCommand(OFF)
Hobbyroom_LED7_switch.sendCommand(OFF)
}
end
rule "Hobbyroom Xiaomi Motion LUX Sensor"
when
Item Hobbyroom_MotionSensorLux_MotionStatus changed to OFF
then
if (Hobbyroom_MotionSensorLux_MotionStatus.state == OFF ) {
Hobbyroom_LED1_switch.sendCommand(OFF)
Hobbyroom_LED6_switch.sendCommand(OFF)
Thread::sleep(600)
Hobbyroom_LED2_switch.sendCommand(OFF)
Hobbyroom_LED5_switch.sendCommand(OFF)
Thread::sleep(600)
Hobbyroom_LED3_switch.sendCommand(OFF)
Hobbyroom_LED4_switch.sendCommand(OFF)
Hobbyroom_LED7_switch.sendCommand(OFF)
} else {
Hobbyroom_LED1_switch.sendCommand(ON)
Hobbyroom_LED6_switch.sendCommand(ON)
Thread::sleep(600)
Hobbyroom_LED2_switch.sendCommand(ON)
Hobbyroom_LED5_switch.sendCommand(ON)
Thread::sleep(600)
Hobbyroom_LED3_switch.sendCommand(ON)
Hobbyroom_LED4_switch.sendCommand(ON)
Hobbyroom_LED7_switch.sendCommand(ON)
}
end
Not even after a restart it changes anything. I have to remove the Rule with the Xiaomi Switch and restart before my other rules will work again…