Repository navigation
Conversation
added 10 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.
…eometry
Adds `provides.roomSources` (`RoomSourceProvider`) to the plugin manifest API:
integrations return floor/room polygons only (`{ floors: [{ name, canvas, rooms }] }`),
while Floorplan Studio owns room merging (`planRoomSourceMerge` / `applyRoomSourceMerge`)
and runs its single client-side marker placement planner (`planDeviceImport`) over the
merged geometry.
In `DevicePanel`, when the active plugin offers a `roomSource`, an
"Also import rooms from source" checkbox previews device room-match badges
against the incoming rooms and commits both new rooms and markers in a
single undo step.
…mation - `DeviceSourceProvider.coversIntegrations?: string[]` + `getCoveredIntegrations()` in the plugin registry map HA integration domains to registered rich device providers. - `DevicePanel` includes a collapsible `Integrations (N)` coverage map listing every HA integration owning devices with its device count and a `plugin` (green) vs `registry` badge. Clicking a covered row switches to that plugin's source; clicking an uncovered row switches to the HA registry source and selects that integration's devices. - Adds `spin` to `StateRule.animation`: `ruleSpinDuration()` scales the icon rotation period inversely with numeric entity state (e.g. fan speed percentage 0..100 -> 2.4s..0.55s) without rotating the marker's label.
Adds an "Update card in HA…" delivery path in `ExportModal`: - Reuses `scanDashboards()` to list existing `ha-floorplan` and `picture-elements` cards across Lovelace dashboards, recording each card's dashboard `url_path`, 0-based discovery index, and `mode`. - YAML-mode dashboards are shown as disabled (`[YAML mode — read-only]`); storage-mode dashboards can be overwritten in place after confirmation via `replaceCardAtIndex()` and `lovelace/config/save`.
4 tasks
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
Resolves #14 (stacked on #13, #11, #9, and #7).
FoundCardandscanDashboards()withurlPath,cardIndex, anddashboardMode.replaceCardAtIndex()(src/haimport/cards.ts) andupdateDashboardCard()(src/haimport/scan.ts) to replace a discoveredha-floorplanorpicture-elementscard in place and save vialovelace/config/save.Update card in HA…inExportModal: scans Lovelace dashboards, lists matching cards (disabling read-only YAML-mode dashboards), confirms with the user, and overwrites the selected card in place.Test plan
tsc --noEmit,vitest run(36 tests includingreplaceCardAtIndexcoverage)npm run build&npm run build:hacs