WHEN Trigger for Things
mhbosch opened this issue · 7 comments
Hello,
it is possible to add a When Trigger for Things?
With the DSL Rule, i can observe a thing, with Jython i dont have a trigger for things.
My example for DSL:
rule "Gerät gestört"
when
Thing 'homematic:HM-LC-Sw4-DR:PEQ0172029:KEQ0055288' changed from ONLINE to OFFLINE
then
logInfo("Heizung", "Die Heizungskontrolle kann nicht erreicht werden")
sendTelegram("bot1", "Die Heizungskontrolle kann nicht erreicht werden")
end
rule "Gerät gestört"
when
Thing 'homematic:HM-LC-Sw4-DR:PEQ0172029:KEQ0055288' changed from OFFLINE to ONLINE
then
logInfo("Heizung", "Die Heizungskontrolle kann wieder erreicht werden")
sendTelegram("bot1", "Die Heizungskontrolle kann wieder erreicht werden")
end
It is possible, there is an example in the docstring for when
:
Hello,
thanks. I have seen, the string for the Thing was changed with OH3.
Now i tried it a sceond time with the other String and it will works!
Hello,
im again.
The Trigger dont have a action.
My Trigger:
@rule("Heizungskontrolle", description="Aenderung bei der Heizungskontrolle", tags=["Script", "Telegram"])
@when("Thing homematic:HM-LC-Sw4-DR:3014F711A061A7D8A98C07FD:KEQ0055288 changed")
def heizungskontrolle(event):
LogAction.logInfo(u"Heiungskontrolle", "" + ir.getItem(str(event.itemName)).label + " wurde von " + str(event.oldItemState) + " auf " + str(event.itemState) + "geändert")
actions.get("telegram", "telegram:telegramBot:Telegram_Bot").sendTelegram( ir.getItem(str(event.itemName)).label + " wurde von " + str(event.oldItemState) + " auf " + str(event.itemState) + "geändert")
The Log shows, the Trigger was accepted:
2021-01-08 11:09:45.109 [DEBUG] [jsr223.jython.core.triggers ] - when: target: 'Thing homematic:HM-LC-Sw4-DR:3014F711A061A7D8A98C07FD:KEQ0055288 changed', target_type: 'Thing', trigger_target: 'homematic:HM-LC-Sw4-DR:3014F711A061A7D8A98C07FD:KEQ0055288', trigger_type: 'changed', old_state: 'None', new_state: 'None'
When i have a change, the trigger dont work:
LOG:
Thing 'homematic:HM-LC-Sw4-DR:3014F711A061A7D8A98C07FD:KEQ0055288' changed from OFFLINE (COMMUNICATION_ERROR) to ONLINE
But no error from script or active trigger.
Hello,
thats sound great. It there a Update Script for the library? I think, i miss updates.
No, there isn't one. Did you use the manual installation instructions and are you running OH3?
Yes, OH3.
I hope, in near future, there is a script, who inform about updates and a update script,
OK,
thanks, i will try it.