Skip to content

refactor: add a shared channel osw_id lookup - #8

Merged
simontaurus merged 1 commit into
mainfrom
refactor/channel-osw-id-lookup
Aug 6, 2026
Merged

refactor: add a shared channel osw_id lookup#8
simontaurus merged 1 commit into
mainfrom
refactor/channel-osw-id-lookup

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

What

Adds short_osw_id() and DataToolMixin.get_channel_by_osw_id() to
_controller_mixin.py, and uses them at the four sites that previously
inlined osw_id.split("#")[-1].

The same lookup existed in opensemantic.lab as an OpcUaServerMixin
method. It is not OPC-UA specific, so it belongs next to
get_channel_by_name in DataToolMixin. A companion PR in
opensemantic.lab drops the duplicate and calls this one.

Why

Channel references stored in the backend carry a page-qualified id
(Item:OSWx#OSWy), while channel.osw_id is the bare subobject id.
Every consumer had to know to strip the prefix. load_channel_data also
built its own throwaway id-to-channel map for the same purpose.

Test

pytest tests/ green locally. Exercised end to end in
vac-station-opcua-client, where subchannel aggregation resolves the
stored references through this lookup across 90 channels.

- add short_osw_id() and DataToolMixin.get_channel_by_osw_id()
- use them at the four call sites that derived the bare id inline
- replaces the copy in opensemantic.lab
@simontaurus
simontaurus merged commit 99baeda into main Aug 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant