Problems subscribing to events in Habapp

Running OpenHAB stable and HABapp 0.31.3 Dev:

Could anyone help with understanding how to subscribe to events, in this case AstroSunPositionElevation? Habapp is connecting to the API and getting some events but we don’t see all of them updating.

from HABApp import Rule
from import ValueUpdateEvent, ValueChangeEvent
from import ItemStateChangedEvent,ItemStateChangedEventFilter
from HABApp.openhab.items import NumberItem, OpenhabItem

class MyRule(Rule):
    def __init__(self):
        # Get the item or create it if it does not exist
        self.my_item = OpenhabItem.get_item('AstroSunPositionElevation')
        self.my_item.listen_event(self.item_changed, ItemStateChangedEventFilter())

    def item_changed(self, event: ItemStateChangedEvent):
        print("GOT EVENT")
        print(f'{} changed from "{event.old_value}" to "{event.value}"')
        print(f'Last change of {}: {self.my_item.last_change}')

We’ve tried all the examples in the documentation it seems like it’s not possible to listen to the event (Astro binding set with 10s updates so we should be seeing changes). Any ideas on what we could be doing wrong? We would expect to at least be seeing the print statements.

The first print statement is working… but always printing the same value.

Just to follow up a little, when we tcpdump the connection between HabApp and Openhab we see a stream of thing updates (eg Ipcamera offline) but no events arriving for Astro related items (but do see the Astro binding updating values in Openhab).

Which openhab version?

openHAB 3.3.0

I’m put some logs at HABApp.log · GitHub

#2986 breaks the sse event filter.
A fix on the HABApp side will be available with the next release or merged in the beta as of later.

Ok - so we weren’t being completely dumb? That’s a relief to know.

I can’t answer that, but the reason for the missing events is a bug :wink: :wink: