-
Notifications
You must be signed in to change notification settings - Fork 23
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
added ability to listen to all events #379
base: master
Are you sure you want to change the base?
added ability to listen to all events #379
Conversation
* Added a warning when dynamically creating rules * Add log entry for threaded loggers (closes spacemanspiff2007#358)
* Thing status is a StrEnum * Small doc fixes
* Added py.typed * Updated dependencies * small refactor * asyncio refactor * doc fix * Inspect HABApp
…cemanspiff2007#376) Added warning and description in docs
This was actually possible in older versions of HABApp. Can you outline the use case and why you want to achieve that? |
I currently have two usecases for the catch_all listener:
Whenever I add an item I need to restart this rule. Having a catch_all listener a HABApp persistence solution would be a bit simpler
For the MQTT sub hirarchy handling an alternative option would be to directly work with the MQTT client and bypass the habapp event bus. In sumary non of my scenarious would be impossible without the catchall but they would be easier. Where do you see a concern in having catch all functionality? |
You can listen to
I agree this is a tricky one and I have not yet come up with a simple and elegant solution.
I'm hesitant to add this again because it feels like there has to be a more elegant and better solution than to additionally process every event. However this is not a very strong opinion so you might be as well successful to convince me otherwise. |
That's a good hint. I will give that a try.
Yes, the tasmota topics are retained. I.e. if I could iterate over all MqttItems that would also be an option.
Could give me one more hint how to use custom startup code to override the internal EventBus implementation? My approach would have been to just work on my branch |
I completely understand this concern. If we want to keep the event processing in EventBus one option would be to introduce a new kind of MqttItem that represents a complete subtree. |
It works exactly like you iterate over the openHAB items.
Just create a import HABApp
class MyEventBus(HABApp.core.internals.EventBus)
pass
HABApp.core.internals.EventBus = MyEventBus |
For scenarios where not all possible items are know upfront it might be beneficial to be able to listen to all events on the bus.
This change adds the ability to add a catch all event listener by specifying the topic HABApp.Any