Closed grzegorz914 closed 4 years ago
My workaround for this issue is configuration in OpenHAB. I have 2 Items connected to light dimmer and one virtual proxy item My hardware remembers last value and has 2 channels. One for state, reacting on "ON" and "OFF" and 2nd for brightness.
Dimmer GF_SmallBathroom_Dimmer "Small Bathroom Ceiling Dimmer" {...}
Switch GF_SmallBathroom_DimmerStatus "Small Bathroom Ceiling Dimmer Status" {..}
Dimmer V_GF_SmallBathroom_DimmerHelper "Small Bathroom Ceiling Dimmer Helper"
Then i configured 2 rules
rule "V_GF_SmallBathroom_DimmerHelper received command"
when
Item V_GF_SmallBathroom_DimmerHelper received command
then
if (receivedCommand == 99 && GF_SmallBathroom_DimmerStatus.state == OFF ) {
GF_SmallBathroom_DimmerStatus.sendCommand(ON)
}
else if (receivedCommand == OFF ) {
GF_SmallBathroom_DimmerStatus.sendCommand(OFF)
}
else {
GF_SmallBathroom_Dimmer.sendCommand(receivedCommand)
}
end
rule "GF_SmallBathroom_Dimmer state changed"
when
Item GF_SmallBathroom_Dimmer received update
then
V_GF_SmallBathroom_DimmerHelper.postUpdate(GF_SmallBathroom_Dimmer.state)
end
Homebridge config
{
"name": "Small Bathroom Ceiling Dimmer",
"type": "light",
"item": "V_GF_SmallBathroom_DimmerHelper"
}
Thanks,
I have create other rules which’s solved my problem. This worked with connection Homebridge>>OH>>PLC S7, updated state and brightness level from all sites. Uses as items:
Dimmer KuchniaBlatDimmer
Dimmer PLC_KuchniaBlatDimmer
Switch PLC_KuchniaBlatSwiatlo
Switch PLC_KuchniaBlatTaster
rule "Oświetlenie kuchnia meble dimmer on/off i zmiana poziomu"
when
Item KuchniaMebleDimmer received command
then
if (receivedCommand == 99 && PLC_KuchniaMebleSwiatlo.state == OFF) {
PLC_KuchniaMebleTaster.sendCommand(ON)
PLC_KuchniaMebleTaster.sendCommand(OFF)
} else if (receivedCommand == OFF && PLC_KuchniaMebleSwiatlo.state == ON) {
PLC_KuchniaMebleTaster.sendCommand(ON)
PLC_KuchniaMebleTaster.sendCommand(OFF)
} else if (PLC_KuchniaMebleSwiatlo.state == ON && (receivedCommand != 0 && receivedCommand != 99)) {
PLC_KuchniaMebleDimmer.sendCommand(receivedCommand)
}
end
rule "Oświetlenie kuchnia meble"
when
Item PLC_KuchniaMebleSwiatlo received command
then
PLC_KuchniaMebleTaster.sendCommand(ON)
PLC_KuchniaMebleTaster.sendCommand(OFF)
end
rule "Oświetlenie kuchnia meble ustawienie poziomu po załączeniu"
when
Item PLC_KuchniaMebleSwiatlo changed
then
if (PLC_KuchniaMebleSwiatlo.state == ON) {
KuchniaMebleDimmer.postUpdate(PLC_KuchniaMebleDimmer.state)
} else if (PLC_KuchniaMebleSwiatlo.state == OFF) {
KuchniaMebleDimmer.postUpdate(OFF)
}
end
rule "Oświetlenie kuchnia meble dimmer aktualizacja poziomu"
when
Item PLC_KuchniaMebleDimmer changed
then
var Number poziom1 = PLC_KuchniaMebleDimmer.state
if (PLC_KuchniaMebleSwiatlo.state == ON && (KuchniaMebleDimmer.state != PLC_KuchniaMebleDimmer.state)) {
KuchniaMebleDimmer.postUpdate(poziom1)
}
end
Unfortunately homebridge does not keep the states cached. But your workaround looks very good!
Hi, Every time if we turn OFF dimmer the value is set to 0% and after turn ON to 99%. Can U add option to save last value before switch OFF and use it as start value after switch ON?