Skip to content

Releases: kdinya/smart-water-valve

v5.0.6

Choose a tag to compare

@kdinya kdinya released this 22 Aug 10:15

Fixed

  • The valve/pipe graphic is now position: absolute, centered on the card's own box plus the configured vertical-offset slider, completely independent of every other element on the card. Previously it was a flexible flow item, so its on-screen position was the sum of everything around it (header height, whether the "closed at" line was showing, how many leak sensors were configured) — any of which could visibly move the valve. Now nothing but the offset slider can move it.

Changed

  • Adding a 3rd/4th leak sensor no longer shrinks or pushes up the pipe to make room for the second sensor row. The sensor rows and the action button are grouped and pinned to the card's bottom edge on their own; on a short card they're free to overlap onto the pipe graphic instead of squeezing it.
  • The "closed at HH:MM" text (only shown when the valve is closed) has moved from under the header to directly above the toggle button, centered.
  • Switching-time measurement (added in v5.0.5) now keeps only the running maximum ever measured per direction — a slow run can no longer be undercut by a later faster one.

Added

  • An "auto-apply the measured maximum" checkbox next to the measured-time note in the editor — keeps the manual animation-time field in sync with the measured maximum automatically.
  • A "Test toggle (measure now)" button in the editor — toggles the real entity and measures the transition time right from the config screen.

See README changelog for full details.

v5.0.5

Choose a tag to compare

@kdinya kdinya released this 22 Aug 04:57

Fixed

  • Battery/signal indicators in the header are now pinned to the card's right edge via CSS grid instead of flex space-between, which could drift depending on the length of the state text (ВІДКРИТО / ЗАКРИТО / ВІДКРИВАЄТЬСЯ / ЗАКРИВАЄТЬСЯ). The state-label and name are now always single-line (ellipsis on overflow).
  • The valve/pipe graphic and buttons no longer shift position when the state text changes during a toggle. The status text now always reserves 2 lines of height, and the "closed at" timestamp is hidden via visibility instead of display:none, so it keeps its layout slot even when blank.
  • Leak-sensor blocks with 3 or 4 sensors configured (2 stacked rows) no longer render as oversized squares with tiny icons/text on wide tablet/desktop cards. Scoped strictly to 3-/4-sensor configs — the verified 2-sensor layout is untouched: blocks cap their size on phones and switch to horizontal rectangles on tablet/desktop, and the icon/text inside scale up to match the block size instead of staying capped at a small fixed max.

Added

  • Real switching-time measurement. The card now times how long the actual switch_entity/valve_state_entity takes to confirm each open/close after a toggle (separately per direction) and remembers it. The editor shows this measured value directly under the manual "Toggle animation time" field, with a recommendation to set that field to at least the measured value — setting it lower is what caused the valve animation to visually reach its end position and then snap back briefly before the real state caught up.

See README changelog for full details.

v5.0.4

Choose a tag to compare

@kdinya kdinya released this 21 Aug 22:32

This release was originally published with a changelog describing fixes that had not actually been committed yet — the tag pointed at v5.0.3's code under a v5.0.4 label. That has been corrected: the tag now points at the commit that actually contains all of this.

Fixed

  • Pipe seam: enlarging the pipes or using different valve_scale_* vs. pipes_scale_* values could leave a visible unfilled stretch of pipe between the water and the valve body. The two pipe halves are now defined to always meet exactly at the canvas's horizontal center (_pipeSplitX()) instead of a measured (and occasionally mismatched) valve position — no seam possible at any scale.
  • Water/lever timing sync: the water fill/drain animation used a fixed speed independent of toggle_lock_ms, so it could finish several seconds before the valve-lever (which does honor toggle_lock_ms) finished rotating. Water speed is now derived from the same toggle_lock_ms, so both finish together.
  • Valve/header overlap + rotation flash: the valve graphic scaled via a paint-only CSS transform, which didn't reserve the right layout space, causing overlap with the header and a one-frame oversized flash after rotation depending on phone orientation. Now scales via actual rendered width instead.
  • Leak sensor clipping on small screens/short card_min_height — icon/text now size with clamp() off each block's own rendered size instead of fixed pixel values.
  • "Closed at" timestamp accuracy: previously fell back to "just now" on a fresh browser with no cached value, even if the valve had actually been closed long before. Now reads the entity's own last_changed from Home Assistant as the source of truth.

Added

  • btn_opening / btn_closing — optional button text shown only while the valve is actively opening/closing, separate from the resting btn_open/btn_close.
  • A small dependency-free unit test suite (tests/, npm test) covering config migration, valve-state resolution, and the toggle-timing/pipe-split math.

See the README changelog for full history.

v5.0.3

Choose a tag to compare

@kdinya kdinya released this 21 Aug 09:44

v5.0.3

  • Fixed: the valve/pipes could render "stuck" at the wrong (larger) scale after rotating the phone, especially in HA masonry/grid dashboards. Root cause: the phone/tablet breakpoint used a viewport-width @media query, but the browser viewport and the card's actual column width can diverge on rotation. Replaced with a CSS @container query based on the card's own rendered width, plus a ResizeObserver that forces an immediate redraw on any real size change.
  • Fixed: empty gaps between the water and the valve body when valve/pipes scales differ. Water boundaries are now measured from the valve graphic's actual on-screen position instead of a fixed formula that assumed both were always scaled together.
  • Fixed: leak-sensor blocks weren't reliably square in some WebViews. Replaced flex + aspect-ratio with CSS Grid (grid-template-columns: 1fr 2fr 1fr) for a reliable 1:1 square in every engine.
  • Changed: renamed animations_enabled to disable_animations — the old field's editor label described the opposite of its actual behavior. disable_animations: true now unambiguously means animations are off. Old configs are auto-migrated on load.
  • Note: if a tool reports only seeing up to v4.x, that's caching on that tool's side — every release through v5.0.3 is published normally on main.

v5.0.2

Choose a tag to compare

@kdinya kdinya released this 21 Aug 09:01
  • Fixed: valve + pipes graphic now layers above the sensor/button row instead of being hidden behind it when closed.
  • Fixed: valve no longer shrinks oddly on short/mobile card heights — size is fully config-driven now via scale sliders.
  • Fixed: position slider in the editor no longer jerks/stutters while dragging.
  • Added: valve_scale_mobile / valve_scale_tablet and pipes_scale_mobile / pipes_scale_tablet — independent scale controls (with sliders + minus/plus buttons) for the valve graphic vs. the pipes/water canvas, per phone vs tablet/desktop.
  • Changed: leak-sensor blocks are now square, and up to 4 are supported (1: left of button, 2: right of button, 3: above 1, 4: above 2). Removing one still auto-shifts the rest into place.
  • See README changelog for full details.

v5.0.1

Choose a tag to compare

@kdinya kdinya released this 21 Aug 03:41

v5.0.1

  • Fixed: leak sensor rows in the editor were cramped into a narrow flex row where the name field was barely visible. They're now full-width stacked blocks with explicit left-aligned "Name" / "Entity" field labels.
  • Fixed: the sensor/button row could get clipped by the card's overflow: hidden when a short card_min_height/card_height was configured. The card and its content are now a flex column, the valve/pipes graphic is the part that shrinks first, and the sensor/button row always stays visible, pinned to the bottom edge.
  • Changed: card_min_height/card_height are now viewport-aware — phones (narrower than 600px) always use card_min_height; tablets/desktop (600px+) use card_height, falling back to card_min_height.
  • Added: valve_vertical_offset config option and a matching slider (with −/+ buttons) in the visual editor, to nudge the valve + pipes graphic up or down within its section, as a percentage from centered.
  • Changed: long-press-for-details moved from the open/close button to the valve + pipes graphic itself. The button no longer has a hold behavior — only a plain tap, so there's no risk of it firing accidentally while operating the valve.

v5.0.0

Choose a tag to compare

@kdinya kdinya released this 20 Aug 21:42
  • Added: signal-level indicator (kran_signal_entity) next to the battery indicator.
  • Added: disable_animations — turns off every animation except the crane-toggle motion.
  • Added: card_height / card_min_height.
  • Changed: leak sensors are now an unlimited leak_sensors: [{ label, entity }, ...] list (editor currently shows up to 2 rows via a "+ Add leak sensor" button).
  • Added: automatic migration from the old bathroom_*/kitchen_* fields into leak_sensors on load — no config lost on upgrade.
  • See README changelog for full details.

v4.5.0

Choose a tag to compare

@kdinya kdinya released this 20 Aug 08:05

Added

  • Long-press (~500ms hold) on the action button, either leak-sensor block, or the battery indicator opens that entity's Home Assistant more-info dialog. A regular tap/click still just does its normal thing.
  • When the valve becomes closed — from this card, another dashboard, or an automation — the card now shows the date/time it closed. Cleared the moment it's seen open again. Persisted per-entity, so it survives a page reload.

Fixed

  • The glass-pipe outline and its reflections don't depend on time at all, yet were fully recomputed every animation frame. Now cached on an offscreen canvas and only redrawn on resize.

Changed

  • The card now needs to be at least 30% visible in the viewport before its animation resumes (previously any sliver counted).
  • The visual editor's field labels now follow the selected language (UK/RU/EN) instead of always being in English, and update immediately when the language dropdown changes.

See the README changelog for full details.

v4.4.0

Choose a tag to compare

@kdinya kdinya released this 20 Aug 06:39

Removed

  • The broken "Auto-measure animation time" feature (auto_toggle_duration) has been removed completely — including the localStorage-based measuring logic. It could silently override your manually configured toggle_lock_ms with an unreliable measured value. toggle_lock_ms is now the single, predictable source of truth.

Changed

  • Visual editor field order: each leak sensor's name field now comes before its entity field; the battery sensor field moved to right after the valve state sensor field.

Fixed

  • Stale editor label text ("empty = hide") that no longer matched the v4.3.0 behavior — now correctly reflects that visibility is controlled by the entity field, not the label.

See the README changelog for the full history.

v4.3.0

Choose a tag to compare

@kdinya kdinya released this 19 Aug 23:07

Fixed

  • Failed switch/valve service call left the card permanently stuck showing "opening…/closing…" for the full toggle_lock_ms even though nothing happened. Now caught and the state resets immediately.
  • An unavailable switch_entity (or one that never existed) rendered as a plain CLOSED state, which is misleading for a shut-off valve. Now shown as a distinct Unavailable state with the action button disabled.

Changed

  • The valve now toggles only via the action button — tapping elsewhere on the card body no longer does anything.
  • A leak-sensor block is shown whenever its *_leak_entity is set, regardless of the label. *_label now only controls whether the name text is shown.
  • With auto_toggle_duration: true, the measured actuator time now fully replaces the manually configured toggle_lock_ms once a measurement exists.

Improved

  • The water animation now pauses when the browser tab is hidden or the card scrolls off-screen (visibilitychange + IntersectionObserver), reducing CPU/battery use on always-on dashboard panels.

See the README changelog for full details.