// rules
rule "EXPIRE"
when
Channel "mihome:sensor_switch:YYY:ZZZ:button" triggered LONG_PRESSED
then
E27_expire.sendCommand(ON)
end
rule "E27 EXPIRE"
when
Item E27_expire received command // Xiaomi MiniSwitch2 (Round)
then
switch EG_az_l_e27fassung1.state {
case OFF : {
EG_az_l_e27fassung1.sendCommand(ON)
}
case ON : {
EG_az_l_e27fassung1.sendCommand(OFF)
}
}
end
Try using Item E27_expire changed to ON in the rule. Otherwise it will go back off 10 seconds later when the switch changes to OFF after getting the OFF from expire.
rule "E27 EXPIRE"
when
Item E27_expire changed to ON // Xiaomi MiniSwitch2 (Round)
then
switch EG_az_l_e27fassung1.state {
case OFF : {
EG_az_l_e27fassung1.sendCommand(ON)
}
case ON : {
EG_az_l_e27fassung1.sendCommand(OFF)
}
}
end
This will result in always on of the LED, as there is no OFF command for EG_az_l_e27fassung1 .
I was just wondering if it’s possible to do the magic with just one rule or even without any rule …
Yes I forgot to mention the switch case will need to be removed.
rule "E27 EXPIRE"
when
Item E27_expire changed to ON // Xiaomi MiniSwitch2 (Round)
then
if ( EG_az_l_e27fassung1.state == OFF ) {
EG_az_l_e27fassung1.sendCommand(ON)
}
end
The expire binding is normally used so that a rule is not needed e.g. Turn on a light and x time later it automatically turns off. I do not know of an easier way to use this binding as it’s pretty straight forward.
Is it yet possible to use profiles to replace expire? Could you elaborate a bit on this?
And: How to use a link profile on items not linked to any channel (e.g. “proxy items”)?