After lots of work (probably 200-300 hours or more) I am proud to announce
HABApp 1.0.0.
This is a huge release which major internal refactoring.
This introduces the following breaking changes:
openHAB >= 3.3 and Python >= 3.8.
self.listen_event now requires an instance of EventFilter.
Changelog
Startup issues are gone with a new and improved connection mechanism. Big thanks to @j-n-k who did all the work on the openhab side. HABApp now only works with OH3.3!
New configuration library: More settings can be configured in the configuration file. Config values are also described in the docs. Also better error messages (hopefully)
Improved event log performance (BufferEventFile no longer needed and should be removed)
Improved openhab performance (added some buffers)
Improved mqtt performance
Better tracebacks in case of error (imho )
EventFilters can be logically combined (“and”, “or”) so rules trigger only once
Label, Groups and Metadata is part of the OpenhabItem and can easily be accessed
Added possibility to run arbitrary user code before the HABApp configuration is loaded
Fixed setup issues
Fixed some known bugs and introduced new ones
Docker file changed to a multi stage build. Mount points changed to /habapp.
Migration to new version
self.listen_event now requires an instance of EventFilter.
Old:
from HABApp.core.events import ValueUpdateEvent
...
self.my_sensor = Item.get_item('my_sensor')
self.my_sensor.listen_event(self.movement, ValueUpdateEvent)
New:
from HABApp.core.events import ValueUpdateEvent, ValueUpdateEventFilter
...
self.my_sensor = Item.get_item('my_sensor')
self.my_sensor.listen_event(self.movement, ValueUpdateEventFilter()) # <-- Instance of EventFilter
change the mount point of the config from /config to /habapp/config
The new image doesn’t run as root. You can set USER_ID and GROUP_ID to the user you want habapp to run with. It’s necessary to modify the permissions of the mounted fold
If you have issues with the new version you can ask for help here.
(This is now solved - I had a time.sleep command which, thanks to a bug, was sleeping for several hours. That seems to have locked everything up!)
Having said that, have a weird problem - if I change a habapp rules file it always used to reload the rules file and restart the rules. It now doesn’t - it ignores the change. If I stop and restart habapp then the rules files are reloaded and the change picked up.
No - this most likely looks like a bug. Rules should get reloaded as usual.
Could you open an issue on github or a new thread here so we can search for errors?
presumably because one of my rules files is calling a library which leaves a port open. But I have lots and lots of rules files, so hard to work out where the problem is. Would it be possible for the warning to identify the rules file causing the problem?
Unfortunately not. The warning gets emitted when the object gets garbage collected or the connection was closed. It’s a whole different place. What you can try is to try and open the IP and see if you can pin the rule that way (seems to be apple).
Maybe you can use this to close the connection?
I am absolutely not an expert but it is not clear what’s the aim of the rule. Do you want to send to a mqtt broker all openhab events received by habapp? but then why do you trigger that rule every minute? you probably want to trigger the rule when the event is received, but then a varaible containing the event should be declared somewhere.
in any case I guess you have to tell to habapp what is the ip address of the broker, what topic and what payload to publish.
You probably need to create a new thread seeking for help.
You are accessing the variable event which is not defined and thus does not exist.
If you look at the HABApp log it’ll show the appropriate error message.