Hi,
Having reverted to older versions until recently I decided to upgrade OpenHab and HabApp to latest versions:
OpenHab: 3.4.0 Build 3178 (I was running latest-ish stable release 3.3.something)
HabApp: 1.0.6 (I was running 1.0.something)
Since then I’ve been getting loads of these in the habapp.log file and some of my HabApp scripts no longer function correctly:
[2022-11-17 16:40:33,125] [ HABApp] ERROR | --------------------------------------------------------------------------------
[2022-11-17 16:40:33,126] [ HABApp] ERROR | Traceback (most recent call last):
[2022-11-17 16:40:33,126] [ HABApp] ERROR | File "/opt/habapp/lib/python3.9/site-packages/HABApp/openhab/connection_handler/sse_handler.py", line 31, in on_sse_event
[2022-11-17 16:40:33,126] [ HABApp] ERROR | event = get_event(event_dict)
[2022-11-17 16:40:33,126] [ HABApp] ERROR | File "/opt/habapp/lib/python3.9/site-packages/HABApp/openhab/map_events.py", line 31, in get_event
[2022-11-17 16:40:33,127] [ HABApp] ERROR | topic: str = _in_dict['topic']
[2022-11-17 16:40:33,127] [ HABApp] ERROR | KeyError: 'topic'
[2022-11-17 16:40:43,091] [ HABApp] ERROR | Error 'topic' in on_sse_event:
[2022-11-17 16:40:43,092] [ HABApp] ERROR | File "/opt/habapp/lib/python3.9/site-packages/HABApp/openhab/connection_handler/sse_handler.py", line 31 in on_sse_event
[2022-11-17 16:40:43,093] [ HABApp] ERROR | --------------------------------------------------------------------------------
[2022-11-17 16:40:43,095] [ HABApp] ERROR | 28 | def on_sse_event(event_dict: dict):
[2022-11-17 16:40:43,096] [ HABApp] ERROR | 29 | try:
[2022-11-17 16:40:43,096] [ HABApp] ERROR | 30 | # Lookup corresponding OpenHAB event
[2022-11-17 16:40:43,097] [ HABApp] ERROR | --> 31 | event = get_event(event_dict)
[2022-11-17 16:40:43,098] [ HABApp] ERROR | 33 | # Update item in registry BEFORE posting to the event bus
[2022-11-17 16:40:43,099] [ HABApp] ERROR | 34 | # so the items have the correct state when we process the event in a rule
[2022-11-17 16:40:43,099] [ HABApp] ERROR | ------------------------------------------------------------
[2022-11-17 16:40:43,100] [ HABApp] ERROR | (ItemAddedEvent, ItemUpdatedEvent) = (<class 'HABApp.openhab.events.item_events.ItemAddedEvent'>, <class 'HABApp.openhab.events.item_events.ItemUpdatedEvent'>)
[2022-11-17 16:40:43,100] [ HABApp] ERROR | (ThingStatusInfoEvent, ThingUpdatedEvent) = (<class 'HABApp.openhab.events.thing_events.ThingStatusInfoEvent'>, <class 'HABApp.openhab.events.thing_events.ThingUpdate>[2022-11-17 16:40:43,100] [ HABApp] ERROR | e = KeyError('topic')
[2022-11-17 16:40:43,101] [ HABApp] ERROR | event_dict = {'type': 'ALIVE', 'interval': 10}
[2022-11-17 16:40:43,101] [ HABApp] ERROR | log = <Logger HABApp.openhab.connection (INFO)>
[2022-11-17 16:40:43,102] [ HABApp] ERROR | TOPIC_ITEMS = 'openHAB.Items'
[2022-11-17 16:40:43,102] [ HABApp] ERROR | TOPIC_THINGS = 'openHAB.Things'
[2022-11-17 16:40:43,102] [ HABApp] ERROR | ------------------------------------------------------------
[2022-11-17 16:40:43,103] [ HABApp] ERROR |
[2022-11-17 16:40:43,103] [ HABApp] ERROR | File "/opt/habapp/lib/python3.9/site-packages/HABApp/openhab/map_events.py", line 31 in get_event
[2022-11-17 16:40:43,104] [ HABApp] ERROR | --------------------------------------------------------------------------------
[2022-11-17 16:40:43,104] [ HABApp] ERROR | 29 | def get_event(_in_dict: dict) -> OpenhabEvent:
[2022-11-17 16:40:43,104] [ HABApp] ERROR | 30 | event_type: str = _in_dict['type']
[2022-11-17 16:40:43,105] [ HABApp] ERROR | --> 31 | topic: str = _in_dict['topic']
[2022-11-17 16:40:43,105] [ HABApp] ERROR | 33 | # Workaround for None values in the payload str
[2022-11-17 16:40:43,106] [ HABApp] ERROR | ------------------------------------------------------------
[2022-11-17 16:40:43,106] [ HABApp] ERROR | _events = {'ItemStateEvent': <class 'HABApp.openhab.events.item_events.ItemStateEvent'>, 'ItemStateChangedEvent': <class 'HABApp.openhab.events.item_events.ItemStateC>[2022-11-17 16:40:43,106] [ HABApp] ERROR | _in_dict = {'type': 'ALIVE', 'interval': 10}
[2022-11-17 16:40:43,107] [ HABApp] ERROR | _in_dict['type'] = 'ALIVE'
[2022-11-17 16:40:43,107] [ HABApp] ERROR | event_type = 'ALIVE'
[2022-11-17 16:40:43,107] [ HABApp] ERROR | ------------------------------------------------------------
[2022-11-17 16:40:43,108] [ HABApp] ERROR |
[2022-11-17 16:40:43,108] [ HABApp] ERROR | --------------------------------------------------------------------------------
[2022-11-17 16:40:43,108] [ HABApp] ERROR | Traceback (most recent call last):
[2022-11-17 16:40:43,109] [ HABApp] ERROR | File "/opt/habapp/lib/python3.9/site-packages/HABApp/openhab/connection_handler/sse_handler.py", line 31, in on_sse_event
[2022-11-17 16:40:43,109] [ HABApp] ERROR | event = get_event(event_dict)
[2022-11-17 16:40:43,109] [ HABApp] ERROR | File "/opt/habapp/lib/python3.9/site-packages/HABApp/openhab/map_events.py", line 31, in get_event
[2022-11-17 16:40:43,109] [ HABApp] ERROR | topic: str = _in_dict['topic']
[2022-11-17 16:40:43,110] [ HABApp] ERROR | KeyError: 'topic'
Has anyone else had this issue and what is the solution?
I’m presuming something has changed in one of the latest snapshots that HabApp doesn’t like or there’s some other dependency that needs upgrading.
Thanks,
Richie