Repository navigation
feat: group the battery variables into one folder per device in the variable list - #34
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Groups this plugin's variables into one folder per device in Macro Deck's variable list, the way Home Assistant shows one folder per entity. Until now every variable of every device sat flat under "Unbound variables".
SupportsSearch => true. Without it, the host walks every container and lists only the leaves. The provider now reports it.devices/<slot id>,IsContainer = true,IsBindable = false, named after the device./, so a folder id can never be a variable id.TryResolverejects a folder id, so reading or subscribing to one is unavailable.ResolveAsyncreturns the folder.ParentId. Ids and names are unchanged (<slot>-<suffix>,battery_<slot>_<suffix>). The host stores a link by the variable's id, so existing bindings keep working.DiscoverAsync:_and.) must appear in the variable name or the device's display name, ignoring case, sophone percentfinds the phone's percent variable.ContinuationTokenis unchanged.IVariableSink.InvalidateCatalogAsync.OnAttachedAsync, and whenever the device ids or display names change, compared against the set last announced, so readings never trigger one.IPluginCatalogNotifier.CatalogChanged: invalidating only makes the host's browser discover again, which never changes the device set, so it cannot loop the wayCatalogChangeddoes (AGENTS.md).CatalogEntryCount: still the number of variables. The SDK defines it as the number of bindable entries.ParentId;Unchanged: Macro Deck's own
battery_<name>_<hash>_*variables, which the host creates for every device published to its battery catalog, still sit beside this plugin's variables. The SDK has no way to publish a device without them.Checklist
dotnet buildanddotnet testpass locally (0 warnings, 378 tests).Device/hardware tested against (if applicable)
Not applicable: no device backend changes.