Skip to content

Bug: SpinBox rapid clicks do not stack when controlling a thermostat #74

@VD475621

Description

@VD475621

Description

When clicking the + or - buttons on the SpinBox component multiple times in quick succession, only a single increment/decrement is applied to the thermostat target temperature. Rapid clicks do not stack — clicking + three times should raise the temperature by , but only raises it by .

Steps to Reproduce

  1. Add a SpinBox component in UltraCard linked to a thermostat entity (e.g. climate.living_room)
  2. Note the current target temperature (e.g. 20°C)
  3. Rapidly click the + button 3 times
  4. Observe the displayed value and the state reported by the thermostat entity

Expected Behavior

Each click should queue an independent increment. Clicking + 3 times should result in the target temperature increasing by (e.g. 20°C → 23°C).

Actual Behavior

The temperature only changes by regardless of how many times the button is clicked. The component waits for the thermostat entity state to update (round-trip to Home Assistant and the physical device) before registering the next click, so all intermediate clicks are dropped.

Root Cause Hypothesis

The component likely reads the target temperature directly from the entity state on each click. Since a thermostat state update involves a round-trip to Home Assistant (and possibly the physical device), the state does not refresh fast enough between clicks. Each click then reads the same stale value and sends the same set_temperature call, collapsing all clicks into one.

Suggested Fix

Maintain a local optimistic value in the component that is updated immediately on each click, independent of the entity state. The local value should be used as the source of truth for the display and for computing the next increment, and only synced back from the entity state when no interaction is in progress (e.g. after a debounce delay).

Environment

  • Card: UltraCard
  • Component: SpinBox
  • Entity type: climate (thermostat)
  • Installation method: Home Assistant OS
  • Core: 2026.4.2
  • Supervisor: 2026.04.0
  • Operating System: 17.2
  • Frontend: 20260325.7
  • UltraCard Version: v3.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions