Closed weltraumbagger closed 5 years ago
I have tried this rule and it works both from OH and from physical switch.
rule "Da Simula Light "
when
Item Luce_sala changed
then
logInfo("Rules" , "Da Simula Light")
switch(Luce_sala.state ) {
case ON: {
logInfo("Rules" , "Da Simula Light ON")
}
case OFF: {
logInfo("Rules" , "Da Simula Light OFF")
}
}
end
hi michele,
yes, your rule works, because your "when-condition" is:
Item Luce_sala changed
it will not work from a phys, switch when you use:
Item Luce_sala received command
but to be able to trigger rule to reschedule a timer (to keep light on longer) you need my "when-condition" because a light that is already switched ON does not send a message "changed" again. only with a ON-command you can make the rule trigger again when light is already ON
commands can only be generated from within OH2 (REST, paperui, etc.), and cannot be sent from physical devices.
In your case instead of changed
you should probably use received update
. See here.
These issues related to rules syntax should be discussed in the community, not on GitHub.
In general a question should be first formulated on the community to ask suggestions and support from other users. Only if it's clear that it's a bug/feature request related to the binding should be inserted as issue here.
This issue is not valid and will be closed.
when activating a light from openhab i see in the log something like:
2019-03-28 15:34:45.025 [ome.event.ItemCommandEvent] - Item 'iEG_Li_Technik' received command ON
but when activating a light from a physical switch there is no "received command.." but "changed from..." like:
2019-03-28 15:31:50.829 [vent.ItemStateChangedEvent] - iEG_Li_Technik changed from OFF to ON
first problem is that because of this behaviour it will not be possible to trigger a rule with "when item received command..."
the second problem is when i need to trigger a rule that should be able to reschedule a timer. means when i switch ON the timer starts, when the light is ON already an i switch ON again, the timer reschedules. because if the light is ON already there will be no message "changed from".
this is an example rule that can reschedule a light-timer when i activate the light from openhab-app, but it does not work when i activate the light from a physical switch (or a touchscreen)
may it be possible to have the same messages "received command.." no matter if the command was sent from oh-app or from a physical switch?