Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mqtt.homie] build a per-thing thing type #15893

Merged
merged 2 commits into from Apr 1, 2024

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Nov 14, 2023

Otherwise channel groups don't show up correctly in MainUI (in actual groups with a heading).

Note that this is completely backwards compatible - even though Things change their ThingTypeUID after they're created, their UID does not change, so no channel UIDs change either.

A happy consequence of building ChannelDefinitions for the ThingType is that custom ChannelTypes are no longer necessary - the only variable parts are labels and state/command descriptions, which are overridden by the ThingType's ChannelDefinition and the DynamicStateDescriptionProvider respectively. This can greatly increase responsiveness of MainUI if you have many Homie things with many channels. My /rest/channel-types response went from 2.6MB to 175KB. Since the full list of thing types is never queried, there's no corresponding increase anywhere else.

Fixes #9728, #11704

Otherwise channel groups don't show up correctly in MainUI (in actual
groups with a heading).

Note that this is completely backwards compatible - even though Things
change their ThingTypeUID after they're created, their UID does _not_
change, so no channel UIDs change either.

A happy consequence of building ChannelDefinitions for the ThingType is
that custom ChannelTypes are no longer necessary - the only variable parts
are labels and state/command descriptions, which are overridden by the
ThingType's ChannelDefinition and the DynamicStateDescriptionProvider
respectively. This can greatly increase responsiveness of MainUI if you
have many Homie things with many channels. My /rest/channel-types response
went from 2.6MB to 175KB. Since the full list of thing types is never
queried, there's no corresponding increase anywhere else.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
@ccutrer ccutrer requested a review from a team as a code owner November 14, 2023 02:12
@lolodomo
Copy link
Contributor

Build failed in tests.

@ccutrer ccutrer marked this pull request as draft November 18, 2023 22:42
Signed-off-by: Cody Cutrer <cody@cutrer.us>
@ccutrer ccutrer marked this pull request as ready for review November 19, 2023 17:29
@ccutrer ccutrer added the enhancement An enhancement or new feature for an existing add-on label Nov 19, 2023
@ccutrer
Copy link
Contributor Author

ccutrer commented Nov 27, 2023

Anything pending before this can be merged?

@lsiepel lsiepel linked an issue Jan 4, 2024 that may be closed by this pull request
@ccutrer
Copy link
Contributor Author

ccutrer commented Feb 7, 2024

ping @lolodomo. I know this is a large PR, but I've got additional commits waiting for this to merge, including a similar change for Home Assistant, and then on top of those two using AbstractStorageBasedTypeProvider so that both Homie and Home Assistant things don't have the two minute delay before going online after an openHAB restart.

@ccutrer
Copy link
Contributor Author

ccutrer commented Mar 21, 2024

Ping @jlaur @lolodomo

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. As i'm no Homie expert i can't fully asses the backwards compatibility. Before i merge this, can you confirm it is well tested and does not need a breaking change alert in the openhab-distro ?

@ccutrer
Copy link
Contributor Author

ccutrer commented Apr 1, 2024

Yes, I can confirm that this is fully backwards compatible. I've been running this for over a year in my production environment at this point, and two others for nearly 6 months.

@lsiepel lsiepel merged commit d90a4a1 into openhab:main Apr 1, 2024
3 checks passed
@lsiepel lsiepel added this to the 4.2 milestone Apr 1, 2024
@ccutrer ccutrer deleted the mqtt-homie-per-thing-types branch April 1, 2024 15:34
lo92fr pushed a commit to lo92fr/openhab-addons that referenced this pull request Apr 30, 2024
* [mqtt.homie] build a per-thing thing type

Signed-off-by: Cody Cutrer <cody@cutrer.us>
adr001db pushed a commit to adr001db/openhab-addons that referenced this pull request May 12, 2024
* [mqtt.homie] build a per-thing thing type

Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: Alexander Drent <Alex@Drent-ict.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mqtt.homie] auto-discovery of changes does not always work [mqtt.homie] Missing Channel Groups
3 participants