Skip to content

Fix for arcade issue (I hope)#29

Merged
PhunkMaster merged 39 commits into
mainfrom
bugfix/1.4.1
Jan 16, 2026
Merged

Fix for arcade issue (I hope)#29
PhunkMaster merged 39 commits into
mainfrom
bugfix/1.4.1

Conversation

@PhunkMaster

Copy link
Copy Markdown
Owner

No description provided.

PhunkMaster and others added 30 commits January 13, 2026 17:54
Changes:
- Add auto-commit step to CI workflow for PR builds
- Add permissions (contents: write, pull-requests: write) to CI workflow
- Modify checkout to use correct ref for PRs
- Fix rollup config to use single entry point (src/main.ts)
- Rebuild dist files with corrected configuration

The CI will now automatically commit rebuilt dist files to PR branches
when source changes affect the build output. This ensures reviewers
can see bundled changes in PR diffs and prevents dist drift.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The judge panel was not appearing for arcade chores that were marked
as completed. The issue was that arcade controls were completely hidden
for any chore with status === "completed", even if there was an active
arcade session waiting for judge approval.

Changes:
- Modified renderArcadeControls() to check for active arcade session
- Arcade controls now shown for completed chores if session exists
- Judge panel now appears correctly for chores awaiting judgment
- Maintains existing behavior for chores without arcade sessions

This fix ensures judges can approve/deny arcade sessions even after
the chore has been marked as complete by the integration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When the card JavaScript is loaded multiple times (during development,
page refresh, or with multiple card instances), the custom element
registration would fail with:

  DOMException: Failed to execute 'define' on 'CustomElementRegistry':
  the name "choreboard-card" has already been used with this registry

Changes:
- Check if custom elements are already defined before registering
- Use customElements.get() to detect existing registrations
- Prevents duplicate registration errors
- Allows safe hot reloading during development

This is a standard pattern for web components to handle multiple loads.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When marking a chore complete from a user's chore list, the card now
passes the user ID of whose chore list is being viewed, not the
Home Assistant logged-in user.

Previously:
- Card called mark_complete with only chore_id
- Backend used the authenticated HA user as completer
- Wrong if someone else is viewing another user's chores

Now:
- Card gets user ID from getCurrentUserId() (from sensor username)
- Passes completed_by_user_id to mark_complete service
- Chore credited to correct user

This matches the pool chore logic which already uses user selection.
Pool chore logic unchanged as requested.

Example: If Phil views his chore list and marks a chore complete,
the chore is now completed as Phil, not as the HA logged-in user.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ard-HA-Card into bugfix/1.4.1

# Conflicts:
#	dist/choreboard-ha-card.js
#	dist/choreboard-ha-card.js.map
Created a new card type specifically for judging pending arcade sessions,
separating arcade judging functionality from the My Chores card.

New Card: ChoreBoard Arcade Judge Card
Type: custom:choreboard-arcade-judge-card
Entity: sensor.choreboard_pending_arcade

Features:
- Displays all pending arcade sessions awaiting judgment
- Shows session details: chore name, user, elapsed time, status
- Judge button for each session opens judge dialog
- Clean, focused UI for arcade judging workflow
- Auto-refresh support (configurable interval)
- Empty state when no pending sessions
- Visual editor for configuration

Rationale for Separate Card:
- Pending arcades are global (all users), not personal
- Judging is a separate workflow from completing chores
- Not everyone needs to see/judge arcade sessions
- Can be placed in admin/judge-only dashboard views
- Cleaner separation of concerns

Components Added:
- src/arcade-judge-card.ts - Main card component
- src/arcade-judge-card-editor.ts - Visual configuration editor
- Updated src/main.ts - Register new card type
- Updated src/common.ts - Add ChoreboardArcadeJudgeCardConfig interface
- Updated ArcadeSession interface - Add user_display_name field

The My Chores card remains focused on personal chore management,
while this new card provides a dedicated judging interface.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ions

The integration creates the sensor as sensor.pending_arcade_sessions,
not sensor.choreboard_pending_arcade as originally assumed.

Changes:
- Updated editor to detect sensor.pending_arcade_sessions
- Updated stub config to use correct sensor name
- Updated error messages with correct sensor name
- Updated common.ts interface comment
- Added broader sensor detection pattern (includes "pending_arcade")

The editor will now properly detect and list the pending arcade sensor
in the dropdown menu.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The editor wasn't detecting sensor.pending_arcade_sessions properly,
possibly due to timing issues with hass object availability.

Changes:
- Added debug logging to track sensor detection
- Added manual text input as fallback when no sensors detected
- Shows helpful info message with expected sensor name
- Editor now works even if dropdown doesn't populate
- Better error messages to help troubleshoot

If automatic detection fails, users can now manually enter:
sensor.pending_arcade_sessions

This ensures the card can always be configured, even if the
sensor list hasn't loaded yet in the editor.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added configuration option to choose how the judge is selected when
approving/denying arcade sessions.

Modes:
1. Ask (default) - Shows user selector dialog, user chooses judge
2. Auto - Automatically uses logged-in Home Assistant user as judge

Configuration Option:
- judge_mode: "ask" | "auto" (default: "ask")

Auto Mode Behavior:
- Gets current HA user from this.hass.user
- Maps HA username to ChoreBoard user ID
- Shows simple confirm dialog (Approve/Deny)
- Automatically passes judge_id to backend service

Ask Mode Behavior:
- Shows full judge dialog with user selector
- User manually selects who is judging
- Allows optional notes
- Original behavior preserved

Implementation Details:
- Added getCurrentJudgeId() method to map HA user to ChoreBoard user
- Added showQuickJudgeDialog() for auto mode
- Updated showJudgeDialog() to branch based on judge_mode
- Added judge_mode dropdown in editor with help text
- Logs judge mapping for debugging
- Falls back to ask mode if HA user can't be mapped

Use Cases:
- Auto mode: Single judge environments where HA user = judge
- Ask mode: Multiple judge environments or delegation scenarios

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Changed judge selector from optional to required
- Added red asterisk to indicate required field
- Disabled Approve/Deny buttons until judge is selected
- Judge selection now always visible (not conditional)

This ensures that in "ask" mode, a judge must be selected
before approving or denying arcade sessions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added console logging to showJudgeDialog to show retrieved users
- Added console logging to arcade-judge-dialog render
- Added check for empty users array with error toast
- Expanded getUsers() to also check pending_arcade sensors
- Added warning log when no users found

This will help diagnose why the user selector isn't appearing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The ChoreBoard integration creates a dedicated sensor.users
entity that contains all users. Both the main card and arcade
judge card were looking for users in sensor.choreboard_* entities,
which don't always have the users attribute.

Changes:
- Updated getUsers() in both cards to check sensor.users first
- Falls back to searching sensor.choreboard_* entities if needed
- This fixes the "No users found" issue in the arcade judge dialog

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
pmagalios and others added 9 commits January 15, 2026 08:51
…e card

- Added detailed console logs to `getUsers()` for diagnosing user detection issues
- Improved visibility into sensor states and attributes for better troubleshooting
- Removed all debug console.log statements from arcade judge card
- Removed debug logging from arcade-judge-dialog
- Added mdi:hand-extended icon to Claim button
- Added mdi:check-circle icon to Complete buttons (pool and regular)

This completes the arcade judge dialog feature with clean code.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Bumped version from 1.4.0 to 1.4.1 in package.json and package-lock.json.
- Regenerated distribution file (dist/choreboard-ha-card.js).
@PhunkMaster PhunkMaster merged commit 9f8a9c7 into main Jan 16, 2026
@PhunkMaster PhunkMaster deleted the bugfix/1.4.1 branch January 16, 2026 14:23
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.

2 participants