-
Notifications
You must be signed in to change notification settings - Fork 783
[Automation] ItemStateUpdateTrigger does not trigger for groups when a member's state updates or changes #6319
Comments
Working EXAMPLE, based on openhab2-javascript/jslib/triggersAndConditions.js:
Related log:
|
Thank you, but your rule is using ItemStateChangeTrigger, which does work for me as well. The issue is with ItemStateUpdateTrigger. This works for items but not for groups. |
I went a little deeper. Only three triggers are working yet: Not working tested Triggers are: ChannelEventTrigger I did not test. LOGGER:
A full working example file for testing:
|
I'n not sure if it matters, but I can confirm that it also does not work with PaperUI generated Rules. Given
and "an item received and update" trigger on TestGroup the resultant Action will not execute if I change the state of Test. I didn't try to sendUpdate to TestGroup directly. If I use "an item changed state" trigger on TestGroup and change the state of Test, the Action executes as expected. |
@openhab-5iver , from reading @lewie 's working test code (mind you, I don't know javascript), it seems that the "state" key in the trigger configuration created in ItemStateUpdateTrigger is always present, even if the corresponding value isn't provided to ItemStateUpdateTrigger. I'm assuming the value of a missing argument in the invocation of ItemStateUpdateTrigger is the javascript equivalent of python's None. The corresponding code from openhab/triggers.py does not add a "state" key when the ItemStateUpdate class is instantiated with its state parameter set to None. |
I tested this with the latest version of openhab/triggers.py. My test rule is never triggered. I also tested with the test for state is not None in ItemStateUpdateTrigger commented out. The results were the same, my test rule was [Update] It seems one of my existing production DSL rules was issuing an OFF command to myGroup, so my results were the same as those reported below by @openhab-5iver. |
I did some more testing, and found that the trigger does fire for groups, if an update is sent directly to the group. When originally reported, I was only testing member Item updates, and finding that these were not causing the trigger to fire. This is still the case. I've updated the title of the issue to reflect this. This may be a more general issue, where group states are not being updated with member updates, but I have not yet tested that hypothesis. @ScottKinSF , thank you for pointing this out. In testing I found that including the state, with a value or null (I do my tests in JS with the raw API to make it easier for the devs to reproduce), produced the same result (no trigger). |
I can confirm that this is not working from Jython |
I can confirm, commands and updates sent directly to a Group Item will trigger the Rule with JSON Rules as well. But updates to the Group caused by changes or updates to a Group's members do not trigger the Rule.
Based on my testing, event.state will only be defined for a ItemStateUpdateTrigger. All other triggers give |
Has this been resolved? |
Take a look at #6464 for some more info. This appears to be by design. |
A more accurate title might be "ItemStateUpdateTrigger only fires for a group when the update is sent directly to the group". I see the same behavior in JS, Jython, and PaperUI. The same rule will trigger if the target is changed to a non-group item. I'm currently using OH snapshot 1405.
Event.log
org.eclipse.smarthome.automation
The text was updated successfully, but these errors were encountered: