HABApp 25

I’ve already run your script against my “fixed” OH, and I can’t see anything in OHs log that indicates a problem. I’m not sure how to interpret the output from the script, it seems to just keep sending more and more - it’s now up to “Sending 75 messages”.

That’s a good sign!
In the 5.1 release openHAB closes the websocket connection normally after 3 - 7 messages.

Sadly, this is the actual 5.1 release. I don’t know if that PR made it into any of the release candidates, maybe the last one - but nobody noticed in time anyway.

Sorry - I meant official release from three days ago.

The 5.1 release exposed the source of an event change/command, is this already accessible in habapp and if not, a much appreciated feature request :santa_claus:

Edit: Issue Access event sources when item changes/updates · Issue #505 · spacemanspiff2007/HABApp · GitHub

The source has always been set as HABApp, however currently it’s not possible to manually set or access it.
Could you create an issue so I don’t forget to look into it?

I think the Web Socket issue might still there. My HABApp instance died over night. I then restarted OpenHab and then HABApp at 7:44 this morning. The last beacon that was sent by HABApp was at 8:14 AM. HABApp is still running, but it doesn’t seem to receive any event from OpenHab. In the OpenHab log, I see a WebSocket error, but this one is at 9:45 AM, quite a bit after the last beacon. So I am not sure if it is a Web Socket issue. Any one see any stability issue with the latest version of OpenHab?

2025-12-29 09:45:55.557 [INFO ] [re.io.websocket.event.EventWebSocket] - WebSocket error: java.util.concurrent.TimeoutException: Idle timeout expired: 10000/10000 msyour code goes here

Are you running the new websockets.jar from @Nadahar from the github issue with 5.1.0?
I think @lfs_alp5 is the only other person running it at the moment … .

I think he does, I did give him a hint of how to earlier. It’s a bit strange if it takes this long for the problem to manifest though, and depending on how the bundle has been activated, it might not survive a OH restart. The fix was merged two days ago, and the latest 5.2.0 snapshot might also contain the fix.

Haven’t had any problems since I got the new websockets.jar :+1:

a couple of days ago i also updated to 5.1.0 and realized the same websocket errors. since i installed the new websockets.jar from @Nadahar i did not see any more error and for me it (still) seems to work.

It is exactly the same for me. I am using my development with less things and items compared to production, but before the patch of the web socket openhab stuck also under very light load.

Yeah I sideloaded Nadahar’s. As the symptoms weren’t conclusive, I decided to upgrade the Ubuntu distribution to 24 (since your latest version requires python 3.11 and I’ve been lazy in updating the distro; so good time to do it now), upgrade your HABApp lib (I was 1 version behind), fix an ignored issue in one of the .items files and redeploy. It has been stable for ~ 20 hours so far. Let’s see if the issue resurfaces.

@Spaceman_Spiff I notice a new behaviour in the latest version of HABApp, 25.12.0. It looks like periodically, perhaps upon being disconnected, HABApp retrieves the things / items from OpenHab again. And it seems like in doing so, HABApp wipes whatever items the code manually added via HABApp.core.Items.add_item(item). Could you confirm if this is the case? Thanks.

[2026-01-01 07:33:12,808] [HABApp.connection.openhab]     INFO | Connected to OpenHAB version 5.1.0 (Release Build)
[2026-01-01 07:33:13,066] [     HABApp.openhab.items]     INFO | Updated 363 Items
[2026-01-01 07:33:13,195] [     HABApp.openhab.items]     INFO | Updated 63 Things
[2026-01-01 07:33:13,637] [ HABApp.openhab.transform]     INFO | Transformations:
[2026-01-01 07:33:13,637] [ HABApp.openhab.transform]     INFO |   Map: de.map, en.map, scalar-15618683d7d2.map
[2026-01-01 07:44:13,584] [                 ZoneApis]     INFO | SetTimeOfDay: Set day period to DAY
[2026-01-01 07:58:14,477] [HABApp.connection.openhab]     INFO | Connected to OpenHAB version 5.1.0 (Release Build)
[2026-01-01 07:58:14,720] [     HABApp.openhab.items]     INFO | Updated 363 Items
[2026-01-01 07:58:14,832] [     HABApp.openhab.items]     INFO | Updated 63 Things
[2026-01-01 07:58:15,260] [ HABApp.openhab.transform]     INFO | Transformations:
[2026-01-01 07:58:15,260] [ HABApp.openhab.transform]     INFO |   Map: de.map, en.map, scalar-15618683d7d2.map
[2026-01-01 08:08:15,082] [HABApp.connection.openhab]     INFO | Connected to OpenHAB version 5.1.0 (Release Build)
[2026-01-01 08:08:15,324] [     HABApp.openhab.items]     INFO | Updated 363 Items
[2026-01-01 08:08:15,433] [     HABApp.openhab.items]     INFO | Updated 63 Things
[2026-01-01 08:08:16,082] [ HABApp.openhab.transform]     INFO | Transformations:
[2026-01-01 08:08:16,082] [ HABApp.openhab.transform]     INFO |   Map: de.map, en.map, scalar-15618683d7d2.map
[2026-01-01 08:14:28,271] [                 ZoneApis]  WARNING | AnnounceMorningWeatherAndPlayMusic: KitchenSink: Missing audio device; can't play music.
[2026-01-01 08:18:15,739] [HABApp.connection.openhab]     INFO | Connected to OpenHAB version 5.1.0 (Release Build)
[2026-01-01 08:18:15,985] [     HABApp.openhab.items]     INFO | Updated 363 Items
[2026-01-01 08:18:16,078] [     HABApp.openhab.items]     INFO | Updated 63 Things
[2026-01-01 08:18:16,523] [ HABApp.openhab.transform]     INFO | Transformations:
[2026-01-01 08:18:16,523] [ HABApp.openhab.transform]     INFO |   Map: de.map, en.map, scalar-15618683d7d2.map
[2026-01-01 09:13:19,376] [HABApp.connection.openhab]     INFO | Connected to OpenHAB version 5.1.0 (Release Build)
[2026-01-01 09:13:19,615] [     HABApp.openhab.items]     INFO | Updated 363 Items
[2026-01-01 09:13:19,740] [     HABApp.openhab.items]     INFO | Updated 63 Things
[2026-01-01 09:13:20,196] [ HABApp.openhab.transform]     INFO | Transformations:
[2026-01-01 09:13:20,196] [ HABApp.openhab.transform]     INFO |   Map: de.map, en.map, scalar-15618683d7d2.map

I found the code that remove any items that do not exist in OpenHab in load_items.py. The code is not new; just the whole flow is invoked multiple times now, perhaps due to WebSocket behaviour. Do you have any suggestions to make sure that custom items placed in the registry survive this kind of refreshes?

        # remove items which are no longer available
        ist = set(Items.get_item_names())
        soll = {item.name for item in items}
        for k in ist - soll:
            if isinstance(Items.get_item(k), OpenhabItem):
                remove_from_registry(k)

Can you show how you add the item?
I suspect you add the wrong type since user added items should not be purged.

I added like this:

item = OpenhabItem(ZONE_MANAGER_ITEM_NAME, zm)
HABApp.core.Items.add_item(item)

That’s not correct. This creates an openHAB item that only existis on the HABApp side and is the reason this gets removed.
Do you want to add an item in openHAB or a HABApp local cache item?
The HABApp local item would be:

from HABApp.core.items import Item

Item.get_create_item(ZONE_MANAGER_ITEM_NAME, zm)

Thank you. Yes, my intention is to create just local items. Essentially I also level HABApp as a context for global values.

Thats exactly the use case for the Item.
You can also trigger on changes and use it exactly as a normal item.
Note that you use .post_value and .command_value