HABApp 1.0

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 :see_no_evil: )
  • 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 :wink:
  • 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
HABApp:
  ValueUpdateEvent -> ValueUpdateEventFilter()
  ValueChangeEvent -> ValueChangeEventFilter()

Openhab:
  ItemStateEvent        -> ItemStateEventFilter()
  ItemStateChangedEvent -> ItemStateChangedEventFilter()
  ItemCommandEvent      -> ItemCommandEventFilter()

MQTT:
  MqttValueUpdateEvent -> MqttValueUpdateEventFilter()
  MqttValueChangeEvent -> MqttValueChangeEventFilter()

Migration to new docker image

  • 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.

7 Likes

HABApp 1.0.3

Changelog:

  • OpenHAB Thing can now be enabled/disabled with thing.set_enabled()
  • ClientID for MQTT should now be unique for every HABApp installation
  • Reworked MultiModeItem, now a default value is possible when no mode is active
  • Added some type hints and updated documentation
1 Like

I realise I wasn’t much help with the beta testing - bit caught up - but the new version is great. Thank you!

(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.

Is there a new setting I’ve missed?

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?

sure - I’ll open a github issue. Um, embarrassingly I won’t, because I now can’t reproduce the bug…

Dan