-
-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Event-Bus
- ItemUpdatedEvent
to also trigger on metadata changes - or add new event like ItemMetadataUpdatedEvent
#4409
Comments
If it's configuration data for the rule, why do you need to trigger the rule to run when the configuration changes? You need to load the metadata when the rule runs anyway so the next time the rule runs it will get the new version of the metadata. I use this in a couple of my published rule templates on the marketplace. I don't quite understand your need for an event to trigger a rule in this case. |
If you check my rule - you can see it has a special coding path when the Configuration changes, in this case it prepares the groups and cleans up the groups it no longer watches. This is just one scenario where triggering a rule based on Metadata changes of an item can be useful. The request is not specific to configuration containing items, but just items in general and responding to Metadata changes - perhaps even go a little further and also allow subfiltering to the namespace you want - in my opinion this is a valid request in general, my example was just about a configuration item for a rule - but it can also be used for metadata on items which are used to set stuff like temperature etc. |
Adding a whole new set of events has performance and load impacts on the whole OH system. One needs to be careful about the impacts. Given that the vast majorioty of users would not use this event, is the overall impact low enought that it doesn't matter that the load is increased on their system? I can't answer that but I do want to make sure that it does get answered. If this is going to slow down people's MainUI or something like that the use case needs to be pretty compelling. Given there are other ways to accomplish what you've done without an event I personally don't find the use case to be that compelling, especially since there are several other approches to accomplish the same thing. But if the impact is overall really small then the use case doesn't have to be all that compelling. I'm not a developer so it's up to whom ever volunteers to implement it to decide if the use case is compelling enough to justify the amount of work it will take to implement. Some of the alternative approaches include:
I'm not saying this isn't a valid request. I'm just cautious that we don't go down some path that causes a huge impact to all users to solve a pretty niche problem with alternative solutions. |
Your Environment
It would be great if one can use the
triggers.GenericEventTrigger
in the Javascript library to also trigger when an items metadata gets updated - or by usingItemUpdatedEvent
or a new event likeItemMetadataUpdatedEvent
on a topic ofopenhab/items/*/metadata/updated
oropenhab/items/*/updated/metadata
As to why, I am storing information inside metadata to configure my rules - this way it's cached but also accessible from the UI instead of relying on the caching functionality. (See below rule, compiled from Typescript to Javascript for an example, it uses an item to store configuration for the Rule as I couldn't think of another way to do this and have it available from the UI for editing)
Example Rule: Typescript
Example Rule: Compiled Javascript (EsBuild with custom plugin)
The text was updated successfully, but these errors were encountered: