Skip to content

feat(ui): devices palette in left panel, card import in Projects, preview gestures - #9

Draft
wimpie70 wants to merge 7 commits into
tinkersoder:mainfrom
wimpie70:feat/devices-palette
Draft

wimpie70 wants to merge 7 commits into
tinkersoder:mainfrom
wimpie70:feat/devices-palette

Conversation

@wimpie70

@wimpie70 wimpie70 commented Nov 7, 2026

Copy link
Copy Markdown

Summary

Resolves #8 (stacked on #7 — merge PR 7 first).

  • Devices tab in the left palette (Entities | Devices | Layers):
    • Source picker + ↻ refresh with auto-fetch on open.
    • Checklist rows with inline placement badges (room name / staged / on plan), group filter buttons, collapsed Options, and one undoable Place N markers step.
    • Offline paste / file / project-merge stays in DeviceImportModal via More….
  • "Import card" moved into Projects modal as New from HA card… alongside + New project and Import JSON….
  • Preview mode dispatches marker gestures (src/canvas/actions.ts):
    • tap (260 ms delay, cancelled by double-tap), hold (500 ms press), and double execute toggle, more-info (hass-more-info event), call-service (with YAML-parsed serviceData), navigate (location-changed), and url.

Test plan

  • tsc --noEmit, vitest run (33 tests), npm run build, npm run build:hacs
  • Verified live on HA dashboard: Devices tab auto-fetches sources, badges resolve rooms/staging, preview double-tap triggers call-service

Willem added 7 commits November 4, 2026 13:02
window.floorplanStudio.registerPlugin({id, apiVersion, provides}) lets
third-party integrations contribute device sources, toolbar actions and
style defaults without integration-specific code in this repo:

- deviceSources: live fetch(ws)/offline parse providers shown in the
  generic Devices modal (was the RAMSES modal). The bundled ramses
  source registers through the same public API as the reference impl.
- actions: toolbar items emitting floorplan-studio:action CustomEvents
  ({pluginId, actionId, projectId, floorId, selection}) — documented,
  bubbles+composed so they escape the card shadow root.
- iconMap / markerDefaults / stateRulePresets (role-bound): merged as
  plugin < user opts < device hints; css injected once, re-attached to
  the card's shadow root in HACS mode.
- apiVersion + ignored-unknown-provides-keys for independent versioning.

importProject() merges a project fragment in one undo step and
projects.* (active/list/get/save/remove/open) replace the direct
IndexedDB pokes integrations needed before. callWS() exposes the active
HA link; documented events: action / project-imported / plugins-changed.

Also: registry fallback now reads parent_device_id alongside via_device
(HA 2026.9 child devices), and devices carry suggested=false for
gateways instead of a hardcoded group check in the planner.
The editor ships zero integration-specific code — the plugin API is
the contract, and integrations own their mapping in their own repo.
Ramses Extras ships its provider as a Lovelace resource from
floorplan_helper (wimpie70/ramses_extras), registered under the same
plugin id so it supersedes nothing and is versioned with the
integration it talks to.

src/examples/mqtt.ts is the new bundled reference implementation:
entity-registry platform filter → device grouping → neutral
ImportDevice shape. It is deliberately generic — change PLATFORM and
it is a zwave/zigbee/ble source.

haimport's WsCall/liveWsCaller imports move to ../ha/wsCaller where
the helper actually lives (fetch.ts only re-exported it).
Flat per-action toolbar buttons do not scale once several
integrations register — one "Integrations" dropdown now lists every
toolbar-located plugin action grouped by plugin id. The location
contract stays: 'toolbar' renders here, 'marker-menu'/'room-menu'
remain reserved for contextual menus.
The example source now reads the device + entity registries — every
HA instance has devices, so the reference implementation always has
something to show, even where mqtt/zwave/etc. aren't configured.
Devices are grouped by integration (entity platform), which doubles
as the foundation for a "coverage map" showing which integrations
have registered providers.
The device import moves from a modal wizard into the editor's
"things to place" palette, as a tab next to Entities and Layers:

- Devices tab: source picker + refresh (auto-fetches on open), a
  checklist with inline placement badges (room name / staged / on
  plan), select-by-group buttons, a collapsed Options details, and
  one "Place N markers" commit. Paste / file / project merge stays
  in the modal, reachable via "More…".
- "Import card" leaves the toolbar for the Projects modal as
  "New from HA card…" — it produces a project, so it belongs with
  project lifecycle next to New / Import JSON.
- New store field leftTab tracks the active palette section.

The Devices toolbar button remains as a shortcut that selects the
Devices tab.
Preview now behaves like an exported card: tap, hold (500ms) and
double (cancels the pending tap) fire the marker's actions — toggle,
more-info (hass-more-info event), call-service with YAML-parsed
serviceData, navigate (location-changed), url. Service calls resolve
to the hass object in card mode or HaClient standalone; with no HA
link they log instead of silently dropping.
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.

UX: Move Devices import into left palette, Import card into Projects, and dispatch gestures in Preview

1 participant