Fix: Use user-configured pinned_id instead of array index#78
Merged
eyalgal merged 3 commits intoeyalgal:mainfrom Jan 26, 2026
Merged
Fix: Use user-configured pinned_id instead of array index#78eyalgal merged 3 commits intoeyalgal:mainfrom
eyalgal merged 3 commits intoeyalgal:mainfrom
Conversation
The _getPinnedTimers() function was setting pinned_id to array
index (pinned-${idx}) instead of using the user-configured id field
from the pinned timer configuration.
This fix ensures that when users configure pinned timers with an id field
(e.g., id: study_1h), that id is preserved in the pinned_id field
and included in MQTT events, allowing automations to reliably identify
which timer triggered the event.
Before: pinned_id: pinned-0
After: pinned_id: study_1h
eyalgal
approved these changes
Jan 26, 2026
Owner
|
Thanks for the contribution! This is now live in v2.1.1. |
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.
Summary
The
_getPinnedTimers()function was settingpinned_idto the array index (pinned-${idx}) instead of using the user-configuredidfield from the pinned timer configuration.Problem
When users configure pinned timers with an
idfield (e.g.,id: study_1h), that ID was not preserved in thepinned_idfield. Instead, the code was using the array index (e.g.,pinned-0), making it impossible to reliably identify which timer triggered an event via MQTT.Solution
Modified the
_getPinnedTimers()function to use the user-configuredidfield when available, falling back to the array index only if noidis provided.Before
After
Impact
This fix ensures that:
pinned_idfield in MQTT payloads now contains the expected user-configured valueExample
Dashboard Configuration
MQTT Event (After Fix)
{ "id": "custom-1737636400000", "pinned_id": "study_1h", // Now correctly uses user-configured ID "label": "Study 1 Hour", "event": "expired" }Automation
Related Issues
This fix enables use of
pinned_idprefix-based identification for HVAC timer automations, as described in related documentation.