HABApp - Easy automation with openHAB

http://IP:PORT/rest/

is working as expected

http://IP:PORT/rest/systeminfo
	
error	
message	"Authentication required"
http-code	401

also with username / password

http://IP:PORT/rest/items?metadata=.%2A&recursive=false&staticDataOnly=false

is working as expected

http://IP:PORT/rest/things

error	
message	"Authentication required"
http-code	401

also with username / password

When I login to OH and use the API-Explorer it works.

Very strange - I can’t think of something that does cause this behavior at all.
Does installing 23.09.02 fix the issue?

First I tried again to reinstall, but same behavior.

How do I downgrade? I newer had the need before ( :slight_smile: ) and it is not described in the docs.

You can specify the version with the install command

pip install HABApp==23.09.02

Now I downgraded and HABApp works again:

2023-12-03 10:22:00.930 [DEBUG] [HABApp.logging             ] - LogBufferEventFile thread running
2023-12-03 10:22:00.930 [INFO ] [HABApp                     ] - HABApp Version 23.09.2
2023-12-03 10:22:00.931 [DEBUG] [HABApp.Config              ] - Added custom Level "WARN" (30)
2023-12-03 10:22:01.014 [DEBUG] [HABApp.Worker              ] - Starting thread pool with 16 threads!
2023-12-03 10:22:01.023 [DEBUG] [HABApp.Config              ] - Added library folder "/etc/openhab/habapp/lib" to system path
2023-12-03 10:22:01.025 [DEBUG] [HABApp.Config              ] - Local Timezone: Timezone('Europe/Berlin')
2023-12-03 10:22:01.026 [DEBUG] [HABApp.Config              ] - Loaded HABApp config
2023-12-03 10:22:01.026 [DEBUG] [HABApp.files.watcher       ] - Adding watcher for /etc/openhab/habapp with <FileEndingFilter ending: .yml>
2023-12-03 10:22:01.031 [DEBUG] [HABApp                     ] - Added event listener for "HABApp.Files" (filter=EventFilter(type=RequestFileUnloadEvent))
2023-12-03 10:22:01.031 [DEBUG] [HABApp                     ] - Added event listener for "HABApp.Files" (filter=EventFilter(type=RequestFileLoadEvent))
2023-12-03 10:22:01.039 [DEBUG] [HABApp.connection          ] - Added openhab
2023-12-03 10:22:01.042 [DEBUG] [HABApp.connection.openhab  ] - Added plugin ConnectionHandler
2023-12-03 10:22:01.044 [DEBUG] [HABApp.connection.openhab  ] - Added plugin WaitForStartlevel
2023-12-03 10:22:01.045 [DEBUG] [HABApp.connection.openhab  ] - Added plugin OutgoingCommands
2023-12-03 10:22:01.047 [DEBUG] [HABApp.connection.openhab  ] - Added plugin LoadItemsAndThings
2023-12-03 10:22:01.048 [DEBUG] [HABApp.connection.openhab  ] - Added plugin SseEventListener
2023-12-03 10:22:01.050 [DEBUG] [HABApp.connection.openhab  ] - Added plugin SyncItemsAndThings
2023-12-03 10:22:01.051 [DEBUG] [HABApp.connection.openhab  ] - Added plugin LoadTransformations
2023-12-03 10:22:01.053 [DEBUG] [HABApp.connection.openhab  ] - Added plugin Ping
2023-12-03 10:22:01.055 [DEBUG] [HABApp.connection.openhab  ] - Added plugin WaitForPersistenceRestore
2023-12-03 10:22:01.056 [DEBUG] [HABApp.connection.openhab  ] - Added plugin TextualThingConfig
2023-12-03 10:22:01.058 [DEBUG] [HABApp.connection.openhab  ] - Added plugin ThingOverview
2023-12-03 10:22:01.059 [DEBUG] [HABApp.connection.openhab  ] - Added plugin BrokenLinks
2023-12-03 10:22:01.061 [DEBUG] [HABApp.connection.openhab  ] - Added plugin ConnectionStateToEventBus
2023-12-03 10:22:01.063 [DEBUG] [HABApp.connection.openhab  ] - Added plugin AutoReconnect
2023-12-03 10:22:01.065 [DEBUG] [HABApp.connection          ] - Added mqtt
2023-12-03 10:22:01.067 [DEBUG] [HABApp.connection.mqtt     ] - Added plugin ConnectionHandler
2023-12-03 10:22:01.069 [DEBUG] [HABApp.connection.mqtt     ] - Added plugin SubscriptionHandler
2023-12-03 10:22:01.071 [DEBUG] [HABApp.connection.mqtt     ] - Added plugin PublishHandler
2023-12-03 10:22:01.072 [DEBUG] [HABApp.connection.mqtt     ] - Added plugin ConnectionStateToEventBus
2023-12-03 10:22:01.074 [DEBUG] [HABApp.connection.mqtt     ] - Added plugin AutoReconnect
2023-12-03 10:22:01.075 [DEBUG] [HABApp.files.watcher       ] - Adding recursive watcher for /etc/openhab/habapp/params with <FileEndingFilter ending: .yml>
2023-12-03 10:22:01.089 [DEBUG] [HABApp.files.watcher       ] - Adding recursive watcher for /etc/openhab/habapp/rules with <FileEndingFilter ending: .py>
2023-12-03 10:22:01.099 [DEBUG] [HABApp.connection.openhab  ] - Overview
2023-12-03 10:22:01.100 [DEBUG] [HABApp.connection.openhab  ] -  - STARTUP: 
2023-12-03 10:22:01.100 [DEBUG] [HABApp.connection.openhab  ] -  - SETUP: ConnectionHandler, TextualThingConfig
2023-12-03 10:22:01.101 [DEBUG] [HABApp.connection.openhab  ] -  - CONNECTING: ConnectionHandler
2023-12-03 10:22:01.101 [DEBUG] [HABApp.connection.openhab  ] -  - CONNECTED: ConnectionHandler, WaitForStartlevel, OutgoingCommands, LoadItemsAndThings, SseEventListener, SyncItemsAndThings, LoadTransformations, Ping, WaitForPersistenceRestore, TextualThingConfig
2023-12-03 10:22:01.102 [DEBUG] [HABApp.connection.openhab  ] -  - ONLINE: ConnectionStateToEventBus, AutoReconnect, ThingOverview, BrokenLinks
2023-12-03 10:22:01.102 [DEBUG] [HABApp.connection.openhab  ] -  - DISCONNECTED: OutgoingCommands, SseEventListener, Ping, ConnectionStateToEventBus, ConnectionHandler
2023-12-03 10:22:01.103 [DEBUG] [HABApp.connection.openhab  ] -  - OFFLINE: AutoReconnect
2023-12-03 10:22:01.103 [DEBUG] [HABApp.connection.openhab  ] -  - DISABLED: 
2023-12-03 10:22:01.103 [DEBUG] [HABApp.connection.openhab  ] -  - SHUTDOWN: ConnectionHandler
2023-12-03 10:22:01.106 [DEBUG] [HABApp.connection.mqtt     ] - Overview
2023-12-03 10:22:01.107 [DEBUG] [HABApp.connection.mqtt     ] -  - STARTUP: 
2023-12-03 10:22:01.107 [DEBUG] [HABApp.connection.mqtt     ] -  - SETUP: ConnectionHandler
2023-12-03 10:22:01.108 [DEBUG] [HABApp.connection.mqtt     ] -  - CONNECTING: ConnectionHandler
2023-12-03 10:22:01.108 [DEBUG] [HABApp.connection.mqtt     ] -  - CONNECTED: SubscriptionHandler, PublishHandler
2023-12-03 10:22:01.109 [DEBUG] [HABApp.connection.mqtt     ] -  - ONLINE: ConnectionStateToEventBus, AutoReconnect
2023-12-03 10:22:01.109 [DEBUG] [HABApp.connection.mqtt     ] -  - DISCONNECTED: ConnectionHandler, SubscriptionHandler, PublishHandler, ConnectionStateToEventBus
2023-12-03 10:22:01.109 [DEBUG] [HABApp.connection.mqtt     ] -  - OFFLINE: AutoReconnect
2023-12-03 10:22:01.110 [DEBUG] [HABApp.connection.mqtt     ] -  - DISABLED: 
2023-12-03 10:22:01.110 [DEBUG] [HABApp.connection.mqtt     ] -  - SHUTDOWN: 
2023-12-03 10:22:01.113 [DEBUG] [HABApp.file.events         ] - <FileOpenedEvent: event_type=opened, src_path='/etc/openhab/habapp/params/credentials.yml', is_directory=False>
2023-12-03 10:22:01.115 [DEBUG] [HABApp.files               ] - params/credentials.yml added
2023-12-03 10:22:01.120 [DEBUG] [HABApp.file.events         ] - <FileOpenedEvent: event_type=opened, src_path='/etc/openhab/habapp/params/host.yml', is_directory=False>
2023-12-03 10:22:01.122 [DEBUG] [HABApp.files               ] - params/host.yml added
2023-12-03 10:22:01.125 [DEBUG] [HABApp.connection.openhab  ] - SETUP
2023-12-03 10:22:01.126 [DEBUG] [HABApp.connection.mqtt     ] - SETUP
2023-12-03 10:22:01.129 [DEBUG] [HABApp.connection.openhab  ] - Task SETUP start
2023-12-03 10:22:01.134 [DEBUG] [HABApp.files.watcher       ] - Adding recursive watcher for /etc/openhab/habapp/config with <FileEndingFilter ending: .yml>
2023-12-03 10:22:01.137 [DEBUG] [HABApp.connection.openhab  ] - Task SETUP done
2023-12-03 10:22:01.138 [DEBUG] [HABApp.connection.mqtt     ] - Task SETUP start
2023-12-03 10:22:01.139 [INFO ] [HABApp.connection.mqtt     ] - MQTT disabled
2023-12-03 10:22:01.139 [DEBUG] [HABApp.connection.mqtt     ] - Task SETUP done
2023-12-03 10:22:01.140 [DEBUG] [HABApp.connection.openhab  ] - CONNECTING
2023-12-03 10:22:01.142 [DEBUG] [HABApp.connection.mqtt     ] - DISABLED
2023-12-03 10:22:01.144 [DEBUG] [HABApp.connection.openhab  ] - Task CONNECTING start
2023-12-03 10:22:01.145 [DEBUG] [HABApp.connection.openhab  ] - Trying to connect to OpenHAB ...
2023-12-03 10:22:01.153 [DEBUG] [HABApp.connection.mqtt     ] - Task DISABLED start
2023-12-03 10:22:01.154 [DEBUG] [HABApp.connection.mqtt     ] - Task DISABLED done
2023-12-03 10:22:01.317 [INFO ] [HABApp.connection.openhab  ] - Connected to OpenHAB version 4.1.0.M3 (Milestone Build)
2023-12-03 10:22:01.317 [DEBUG] [HABApp.connection.openhab  ] - Task CONNECTING done
2023-12-03 10:22:01.318 [DEBUG] [HABApp.connection.openhab  ] - CONNECTED
2023-12-03 10:22:01.320 [DEBUG] [HABApp.connection.openhab  ] - Task CONNECTED start
2023-12-03 10:22:01.340 [DEBUG] [HABApp.openhab.items       ] - Requesting items
2023-12-03 10:22:01.431 [DEBUG] [HABApp.files               ] - params/credentials.yml changed to DEPENDENCIES_OK
2023-12-03 10:22:01.432 [DEBUG] [HABApp.files               ] - params/host.yml changed to DEPENDENCIES_OK
2023-12-03 10:22:01.433 [DEBUG] [HABApp.file.events         ] - <FileOpenedEvent: event_type=opened, src_path='/etc/openhab/habapp/params/credentials.yml', is_directory=False>
2023-12-03 10:22:01.495 [DEBUG] [HABApp.RuleParameters      ] - Loaded params from params/credentials.yml!
2023-12-03 10:22:01.496 [DEBUG] [HABApp.files               ] - params/credentials.yml changed to LOADED
2023-12-03 10:22:01.498 [DEBUG] [HABApp.file.events         ] - <FileOpenedEvent: event_type=opened, src_path='/etc/openhab/habapp/params/host.yml', is_directory=False>
2023-12-03 10:22:01.506 [DEBUG] [HABApp.RuleParameters      ] - Loaded params from params/host.yml!
2023-12-03 10:22:01.506 [DEBUG] [HABApp.files               ] - params/host.yml changed to LOADED
2023-12-03 10:22:02.442 [DEBUG] [HABApp.openhab.items       ] - Got response with 944 items
2023-12-03 10:22:02.443 [DEBUG] [HABApp.Items               ] - Added num_Mower_Mowing_Duration (NumberItem)
(...)

Thanks for getting it back to run!

Since I got so many notifications during startup on my phone I decided to finally implement a rate limiter.
Docs of the rate limiter for HABApp Beta.
I’ve currently implement leaky bucket and fixed window elastic expiry algorithm.
Is the difference between these algorithms clear from the docs?

What do you think should be the default for adding a rate limiter?
Or should the default be omitted and the user should explicitly chose?
Currently I’m torn between providing a default and making the user chose … .

If there is other feedback I’d be happy to hear it. :slight_smile:

this is a great feature!
i think about using it for the NotifyOnError class that i copied from your examples. i always get informed via email when a rule crashes so this helps me to find my errors. only annoying when i do an openhabian update, then i receive errors over errors (because of the restart of the services?). so here a limiter would be helpful and i will try to get it implemented.

very good explained and clear for me! if you ask which of them i would use as default - dont know. i think the leaky bucket could be used more often and if nothing else is defined it could be standard but only a very personal sight

1 Like

That’s almost the same use case that I have

I thought about this some more. The fixed window elastic expiry is better to stop the notification spam because it will block until a whole interval with no notifications is seen.
However if the interval is too big and the number too small it will grow longer and longer and thus always block.
E.g. if you get a notification every day at 12 and you set the interval to 36h and 2 hits. One day you get 2 messages at 9, the next one at 12 will be blocked and the interval prolonged. The message the next day at 12 will also be blocked and so on.
So while it is more effective it’s easier to shoot oneself in the foot so I think the leaky bucket as a default makes more sense even though it’s not as effective.

Imho the best is to use both for one limiter:

  • fixed window elastic expiry with a small interval (e.g. 5 in 5 mins)
  • leaky bucket with a bigger interval (e.g. 20 per 10 hours)

Also the leaky bucket would probably be what you would be using when accessing an external api so I’ll change the default to that.

2 Likes

Good news everyone!

HABApp 24.01.0 is out!

4 Likes

@bastler
I set up the rate limiter like in the docs and instead of countless notifications I’m only receiving 5 on a fresh start. Very nice!

1 Like

I’m very embarrassed but even with your example in the docs i do not understand how to get it work. i would like to limit the mails for “notifyonerror” - always when i update / upgrade openhabian then many errors raise in a very short time. this is my code that i copied from your example:

from e_mail import E_mail           # modul unter /etc/openhab/habapp/lib
from HABApp import Rule
from HABApp.core.events.habapp_events import HABAppException
from HABApp.core.events import EventFilter
from HABApp.util import RateLimiter

e_mail = E_mail()

class NotifyOnError(Rule):
    '''
    Meldet per email wenn ein Fehler auftritt (auch wenn Fehler in anderer Datei)
    ... leider erst nachdem die Klasse geladen ist, es kann beim Systemstart
    passieren dass Fehler nicht gemeldet werden weil die Klasse nicht als erstes geladen wird ...
    '''
    def __init__(self):
        super().__init__()
        self.log = logging.getLogger('My_HABApp')
        self.listen_event('HABApp.Errors', self.on_error, EventFilter(HABAppException))

        self.limiter = RateLimiter('MyErrorLimiter')
        self.limiter.add_limit(5, 60)

    def on_error(self, error_event: HABAppException):
        '''
        Wenn HABApp einen Fehler meldet dann im log und per email benachrichtigen
        '''
        msg = error_event.to_str() if isinstance(error_event, HABAppException) else error_event
        self.log.error(f'Fehler in HabAPP: {msg}')

        e_mail.send_mail('HabAPP meldet Fehler', f'{msg}')

NotifyOnError()

i already tried to add the ratelimiter but how can i manage the e_mail to be checked and limited?

No worries - with .allow() you can check and increase the counter and with .test_allow()you can check and without increasing the counter.

So all you have to do is add it like this:

    def on_error(self, error_event: HABAppException):

        if not self.limiter.allow():
            return None

Tip:
I’ve added it as a global variable like this and parse the limits - that way the limits are more readable and they are on top of the file

from HABApp.util import RateLimiter

LIMITER = RateLimiter('MyNotificationLimiter')
LIMITER.parse_limits('5 in 1 minute', algorithm='fixed_window_elastic_expiry')
LIMITER.parse_limits("20 in 1 hour", algorithm='leaky_bucket')

Tip 2:
Rules are loaded in alphabetical order. If you rename your file __email__.py it will be loaded first and you’ll get all notifications.

1 Like

now i got it, thank you so much!

and glad you found my secret question that I didn’t dare to ask :grinning:

this is how it works now, created a file named __alert_notify.py:

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging

from e_mail import E_mail           # modul unter /etc/openhab/habapp/lib
from HABApp import Rule
from HABApp.core.events.habapp_events import HABAppException
from HABApp.core.events import EventFilter
from HABApp.util import RateLimiter

LIMITER = RateLimiter('MyNotificationLimiter')
LIMITER.parse_limits('5 in 1 minute', algorithm='fixed_window_elastic_expiry')
LIMITER.parse_limits("20 in 1 hour", algorithm='leaky_bucket')

e_mail = E_mail()

class NotifyOnError(Rule):
    '''
    Meldet per email wenn ein Fehler auftritt (auch wenn Fehler in anderer Datei)
    Damit auch beim Systemstart alle Fehler gemeldet werden muß die Klasse als erstes vor
    allen weiteren geladen werden. Laden erfolgt in alphabetischer Reihenfolge, 
    darum Dateiname verwendet __alert_notify.py
    '''
    def __init__(self):
        super().__init__()
        self.log = logging.getLogger('My_HABApp')
        self.listen_event('HABApp.Errors', self.on_error, EventFilter(HABAppException))

    def on_error(self, error_event: HABAppException):
        '''
        Wenn HABApp einen Fehler meldet dann im log und per email benachrichtigen
        Meldungen per email werden durch den RateLimiter begrenzt, Konfiguration erfolgt
        über globale Variablen am Anfang der Datei
        '''
        msg = error_event.to_str() if isinstance(error_event, HABAppException) else error_event
        self.log.error(f'Fehler in HabAPP: {msg}')

        if not LIMITER.allow():    # check AND increase the counter
            return None
        e_mail.send_mail('HabAPP meldet Fehler', f'{msg}')

NotifyOnError()

great, errors always are written in the log-file but if the limit is reached the sending of emails stops.

My live system is already running smoothly with it and the error notification is using the new rate limiter. @Spaceman_Spiff Thanks for the update!

1 Like

Hi,
I’m new with HABApp. Trying to setup it with OpenHab 4.1. Both (OH and HABApp) are instaled in dockers.
Manage to see each other, but there are some errors in logs, which are not clear for me. Kindly ask you to help :wink:

> [2024-01-24 15:22:03,302] [                   HABApp]     INFO | HABApp Version 0.31.2
> [2024-01-24 15:22:03,304] [     HABApp.openhab.thing]     INFO | Config folder does not exist - textual thing config disabled!
> [2024-01-24 15:22:03,304] [    HABApp.RuleParameters]     INFO | Parameter files disabled: Folder /habapp/config/params does not exist!
> [2024-01-24 15:22:03,305] [   HABApp.mqtt.connection]     INFO | Connecting to 192.168.1.6:8883
> [2024-01-24 15:22:03,329] [HABApp.openhab.connection]     INFO | Connected to OpenHAB instance 969a31bf-4a49-45be-a3eb-XXXXXXXXX
> [2024-01-24 15:22:03,329] [HABApp.openhab.connection]     INFO | OpenHAB version 4.1.1 (Release Build)
> [2024-01-24 15:22:03,442] [     HABApp.openhab.items]     INFO | Updated 337 Items
> [2024-01-24 15:22:03,466] [     HABApp.openhab.items]     INFO | Updated 24 Things
> [2024-01-24 15:22:08,942] [             HABApp.Rules]     INFO | Added rule "MyFirstRule" from rules/q_test_rule.py
> [2024-01-24 15:22:08,942] [             HABApp.Rules]     INFO | Added rule "MyFirstRule.2" from rules/q_test_rule.py
> [2024-01-24 15:22:08,942] [             HABApp.Rules]     INFO | Added rule "MyFirstRule.3" from rules/q_test_rule.py
> [2024-01-24 15:22:08,942] [             HABApp.Rules]     INFO | Added rule "MyFirstRule.4" from rules/q_test_rule.py
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR | Error 'topic' in on_sse_event:
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR | File "/usr/local/lib/python3.8/site-packages/HABApp/openhab/connection_handler/sse_handler.py", line 25, in on_sse_event
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |     22   def on_sse_event(event_dict: dict):
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |     23       try:
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |     24           # Lookup corresponding OpenHAB event
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR | --> 25           event = get_event(event_dict)
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |     26   
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |     ..................................................
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |      event_dict = {'type': 'ALIVE',
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |                    'interval': 10}
> [2024-01-24 15:22:11,719] [                   HABApp]    ERROR |     ..................................................
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR | 
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR | File "/usr/local/lib/python3.8/site-packages/HABApp/openhab/map_events.py", line 29, in get_event
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |     27   def get_event(_in_dict: dict) -> OpenhabEvent:
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |     28       event_type: str = _in_dict['type']
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR | --> 29       topic: str = _in_dict['topic']
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |     30   
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |     ..................................................
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |      _in_dict = {'type': 'ALIVE',
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |                  'interval': 10}
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |      OpenhabEvent = <class 'HABApp.openhab.events.base_event.OpenhabEvent'>
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |      event_type = 'ALIVE'
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR |     ..................................................
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR | 
> [2024-01-24 15:22:11,720] [                   HABApp]    ERROR | KeyError: 'topic'

This version is from end of 2021. You need to use latest which will not show these errors (24.01.0)

1 Like

Thanks for the prompt response.
I think something went wrong during the first pull the docker file even if I used the

latest

tag.
No it looks OK.
Thx

Hi Seb! Long time since I logged on here.

HABApp 1.0.8 and OpenHAB 3.4.4 has been chugging along in the background in docker containers on my PI4 this whole time, working great.

One thing that has plagued it continuously and filling up my logs is these randomly occuring performance related messages:
[2024-04-04 12:13:55,558] [ HABApp.Worker] WARNING | Execution of BatteryStatus.do_run took too long: 0.86s
[2024-04-04 12:37:43,952] [ HABApp.Worker] WARNING | Starting of EnergyMgmt.fnOnGridWatts took too long: 0.38s. Maybe there are not enough threads?

Fair enough. The PI4 is not a powerhouse.

Finally today I migrated OpenHAB, HABApp and Mosquitto to a proper server – a Ryzen 5950X. Four cores are dedicated to an LXC that hosts the docker containers. I’m still running the same versions, and it flies! Wonderful.

But, guess what – I’m still getting these messages.

[2024-04-04 17:31:50,003] [ HABApp.Worker] WARNING | Starting of PoolFlow.fnJsonMessage1 took too long: 0.07s. Maybe there are not enough threads?

0.07 seconds? That’s not too long, that seems perfectly reasonable.

What is the alarm threshold? Is it dynamic somehow? Can I change the threshold and/or add more threads?

One more question. Mosquitto was set to use the latest version, which was now 2.0.18.
I had really weird problems. Non-retained messages published from my devices did not reach HABApp! But, they reached MQTT Explorer. And when I published non-retained from MQTT Explorer, they did reach HABApp. But the next update from the device, even though it showed up fine in MQTT Explorer, again did NOT reach HABApp!
It was completely consistent. The device updates never reached HABApp but if sent from MQTT Explorer it always reached HABApp.
I finally downgraded Mosquitto to 2.0.14 and then everything worked again.

Any idea what’s going on there?

I will update openHAB and HABApp to the latest versions when I have a chance. My entire house runs on HABApp now, including the energy management (solar + batteries, and controlling air conditioning and pool pumps) so I have to pick the right time to upgrade system-level components such as those.

You can update to the latest Version of HABApp. There the warning logic is more intelligent and will not throw this warning when there are plenty of threads available.
Be aware that there was a breaking change which means you should use the ItemStateUpdatedEvent instead of the ItemStateEvent which should not used any more.

Hm - no idea. I am running mosquitto 2.0.18 without issues.
Is this a reproducible issue which persists across restarts?

That sounds awesome! I am glad you are happy with HABApp :+1:

Hello @Spaceman_Spiff, several post above, you wrote that it is possible to load / unload rules via posting particular events on the bus. I am really interested in this, but I cannot get it working. I would expect, that posting RequestFileUnloadEvent will unload the rule and RequestFileLoadEvent will load the rule. But both of them are ending in the rule reloading. My code is very simple:

event = RequestFileUnloadEvent("rules/operator_vents.py")
self.post_event("HABApp.Files", event)

and the output in the HABApp log (DEBUG severity):

[2024-05-10 11:54:24,811] [       HABApp.file.events]    DEBUG | FileOpenedEvent(src_path='/habapp/config/rules/operator_vents.py', dest_path='', event_type='opened', is_directory=False, is_synthetic=False)
[2024-05-10 11:54:24,812] [             HABApp.files]    DEBUG | rules/operator_vents.py added
[2024-05-10 11:54:25,102] [             HABApp.files]    DEBUG | rules/operator_vents.py changed to DEPENDENCIES_OK
[2024-05-10 11:54:25,103] [             HABApp.Rules]    DEBUG | Removing file: rules/operator_vents.py
[2024-05-10 11:54:25,108] [                   HABApp]    DEBUG | Removed event listener for "control/fans/set" (filter=ValueChangeEventFilter())
[2024-05-10 11:54:25,109] [                   HABApp]    DEBUG | Removed event listener for "control/fanexhaust/set" (filter=ValueChangeEventFilter())
[2024-05-10 11:54:25,109] [                   HABApp]    DEBUG | Removed event listener for "control/fanintake/set" (filter=ValueChangeEventFilter())
[2024-05-10 11:54:25,109] [             HABApp.Rules]    DEBUG | File rules/operator_vents.py successfully unloaded!
[2024-05-10 11:54:25,112] [             HABApp.Rules]    DEBUG | Loading file: rules/operator_vents.py
[2024-05-10 11:54:25,114] [       HABApp.file.events]    DEBUG | FileOpenedEvent(src_path='/habapp/config/rules/operator_vents.py', dest_path='', event_type='opened', is_directory=False, is_synthetic=False)
[2024-05-10 11:54:25,117] [       HABApp.file.events]    DEBUG | FileOpenedEvent(src_path='/habapp/config/rules/operator_vents.py', dest_path='', event_type='opened', is_directory=False, is_synthetic=False)
[2024-05-10 11:54:25,118] [       HABApp.file.events]    DEBUG | FileOpenedEvent(src_path='/habapp/config/rules/operator_vents.py', dest_path='', event_type='opened', is_directory=False, is_synthetic=False)
[2024-05-10 11:54:25,127] [                   HABApp]    DEBUG | Added event listener for "control/fanintake/set" (filter=ValueChangeEventFilter())
[2024-05-10 11:54:25,128] [                   HABApp]    DEBUG | Added event listener for "control/fanexhaust/set" (filter=ValueChangeEventFilter())
[2024-05-10 11:54:25,129] [                   HABApp]    DEBUG | Added event listener for "control/fans/set" (filter=ValueChangeEventFilter())
[2024-05-10 11:54:25,129] [             HABApp.Rules]     INFO | Added rule "OperatorVentsRule" from rules/operator_vents.py
[2024-05-10 11:54:25,131] [             HABApp.Rules]    DEBUG | File rules/operator_vents.py successfully loaded!
[2024-05-10 11:54:25,132] [             HABApp.files]    DEBUG | rules/operator_vents.py changed to LOADED
[2024-05-10 11:54:40,574] [             HABApp.files]    DEBUG | Worker done!

Any advice how to dynamicly disable / enable rules?