Closed florian-h05 closed 2 years ago
@rickoman I am having a look at this right now, I now what the problem is.
When using a Group Item the event triggerType and itemName are missing
I will fix that.
event class is org.openhab.core.items.events.GroupItemStateChangedEvent instead of org.openhab.core.items.events.ItemStateChangedEvent.
I am not sure if you consider this as an issue, but this is no issue or bug.
@rickoman I have a PR opened with a fix, it would be nice if you could test it (see #146).
You can install the PR with npm install git+https://github.com/florian-h05/openhab-js.git#rules-fix-get-triggered-data
.
ItemStateChangeTrigger event data incorrect if the Item is a Group.
It appears that rules.js/getTriggeredData() does not handle the case when the triggered Item is a Group.
https://www.openhab.org/docs/configuration/items.html#groups
When using a Group Item the event triggerType and itemName are missing and the event class is org.openhab.core.items.events.GroupItemStateChangedEvent instead of org.openhab.core.items.events.ItemStateChangedEvent.
I have included test code to reproduce below.
Originally posted by @rickoman in https://github.com/openhab/openhab-js/issues/136#issuecomment-1172928136