Hollako/Home-Assistant-3D-Floorplan
About
A Home Assistant Lovelace card for placing entities on an interactive 3D Floorplan
Design & MediaMeasured star growth
- in 24h
- -1
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalHome Assistant 3D Floorplan

A Lovelace custom card for placing Home Assistant entities on a 3D model and rendering physically-based lighting directly in the browser. Load a .glb, switch to Edit Mode, select an entity from the sidebar, click the model to place it, then configure lighting zones and light types for a realistic room render.
The card element is custom:home-assistant-3d-floorplan.
Install
Add this JavaScript resource in Home Assistant:
url: /local/Home-Assistant-3D-Floorplan.js
type: module
If installed through HACS:
url: /hacsfiles/Home-Assistant-3D-Floorplan/Home-Assistant-3D-Floorplan.js
type: module
Basic Card
type: custom:home-assistant-3d-floorplan
title: 3D Floorplan
model: /local/floorplans/home.glb
view_mode: "3d"
markers: []
Coordinate System
The card uses the standard Three.js / GLTF coordinate convention:
- X - east/west floor axis
- Y - vertical (height)
- Z - north/south floor axis
This matches .glb files exported from Blender with the default Y-up orientation. No coordinate_map override is needed for standard exports.
Markers
Marker colors reflect live entity state:
- Red: unavailable or unknown
- Yellow: active / on / open / detected
- Dark: inactive / off / closed / clear
- Green: available neutral state
Default press actions:
marker_tap_action: auto
marker_hold_action: auto
edit_marker_tap_action: select
edit_marker_hold_action: move
marker_hold_ms: 650
auto uses domain defaults - lights and switches toggle on tap; sensors, binary sensors, and climate entities open more-info. Edit Mode is shown only when hass.user.is_admin === true.
Markers export as:
markers:
- entity: light.kitchen
name: Kitchen Light
icon: mdi:lightbulb
tap_action: toggle
hold_action: more-info
light_intensity: 100
light_type: spot
light_radius: 120
x: 850.0000
y: 230.0000
z: 610.0000
Temperature and humidity sensors show their live value on the marker. Use Marker display in Edit Mode to force icon or value display:
marker_display: value # auto | icon | value
Color Thresholds
Use color_thresholds to color a marker dynamically based on its numeric state value. This is particularly useful for temperature, humidity, CO₂, or any sensor with a continuous numeric reading.
markers:
- entity: sensor.living_room_temperature
name: Living Room
marker_display: value
color_thresholds:
- value: 18
color: "#42a5f5" # blue — cold
- value: 22
color: "#66bb6a" # green — comfortable
- value: 26
color: "#ef5350" # red — hot
Threshold logic (step, not interpolated):
- State below the first threshold → first threshold color
- State between two thresholds → color of the lower threshold
- State at or above the last threshold → last threshold color
So for the example above: values below 18 are blue, 18–21.9 are blue, 22–25.9 are green, and 26+ are red.
color_thresholds works in both 2D (floorplan image) and 3D model view, and accepts any valid CSS color (#hex, rgb(), named colors). When the entity is offline or unavailable, the standard red offline styling takes precedence.
In Edit Mode, select a numeric sensor marker and use Color thresholds in the marker settings panel to add, edit, or remove threshold rows.
Edit Mode
Switch to Edit Mode to place and configure markers.
Sidebar - lists all HA entities. Placed markers show a Remove button. Unplaced markers show Add; clicking it then clicking the 3D model places the marker at that surface point.
Floating panel - selecting a placed marker opens a panel on the right with:
- Icon picker
- Marker display setting
- Tap / Hold actions
- Light intensity, type, radius, and render parameters (for
light.*entities in Positional zones) - XYZ coordinates
- Move / Delete buttons

Axes gizmo - a small XYZ orientation indicator appears in the top-left corner in Edit Mode, showing how the model axes relate to the camera.
Export YAML - the sidebar exports the full card YAML with current marker positions, zone definitions, and presets. Press Copy YAML to copy it to the clipboard.
Camera Views
The compass in the corner provides:
- Top - straight top-down view
- N / E / S / W - 45-degree angled side views
In Edit Mode, Save Home stores the current camera position as the startup view. The saved view is stored per-floor and is written to the YAML export:
default_view:
position: [6.2500, 4.5000, 8.7500]
target: [0.0000, 0.8000, 0.0000]
zoom: 1.0000
Brightness Areas (Lighting Zones)
Edit Mode can define room polygons that drive the 3D lighting render. Press Add Area, then Draw, and click the floor to trace the room boundary.
Lighting Modes
Each zone has two modes, selectable in the zone settings:
Area (zone-wide glow) - a single flat ambient fill covers the whole floor polygon. Suitable for zones with diffuse overhead lighting or when no individual light positions are needed.

Positional (per-light pools) - each light.* marker placed inside the zone creates its own floor pool, wall glow, ceiling glow, and GI bounce based on its position and light type.

Zone Settings
brightness_zones:
- id: living-room
name: Living Room
color: "#f8d66d"
elevation: 0
height: 280
day_opacity: 0.50
night_opacity: 1.00
lighting_mode: positional
illuminance_enabled: true
illuminance_entity: sensor.living_room_lux
show_lux: true
points:
- x: 100.0000
y: -300.0000
- x: 900.0000
y: -300.0000
- x: 900.0000
y: -1100.0000
Floor elevation sets the zone's floor level on the configured vertical axis. New zones automatically use the elevation of the first clicked surface; it can also be adjusted manually. This keeps floor pools and room geometry on the correct storey in a multi-floor model. Height remains the distance from that floor level to the zone ceiling.
Illuminance sensor - when enabled, the shade is driven dynamically by a lux sensor. Low lux approaches night shade; 300 lux reaches day shade; brighter reduces shade further. The sensor is selected from a searchable dropdown of all sensor.* and input_number.* entities. Falls back to sun.sun day/night when disabled or sensor is unavailable.
Light Types (Positional Mode)
Each light.* marker in a Positional zone has a Light type that controls how the glow is rendered on floors, walls, and ceilings.
| Type | Description |
|---|---|
| Spot | Ceiling downlight. Renders a cone on the wall with inner/outer angle, a bright floor hotspot, and GI bounce. Supports tilt X/Y to aim off-center. |
| Cove | Indirect ceiling bounce. Produces a top-heavy wall wash that fades downward and a soft uniform floor fill centered on the zone. |
| Linear | LED strip. Elongated floor pool; wall wash runs the length of the strip path. |
| Lamp | Floor or table lamp. Tight floor pool, soft wall glow radiating outward. |
Set Light radius to override the auto-computed pool size (in model units). Leave blank for automatic sizing based on mount height and zone dimensions.
Light Paths (Linear / Cove)
Linear and Cove lights support a drawn path that distributes sample points along the strip:
- Draw line - click the 3D model to add path points one by one
- Rectangle - define width, depth, and rotation; the card generates a closed 4-corner loop automatically. The marker position becomes the rectangle center.
Sub-spots (Spot)
A spot marker can contain multiple render-only sub-spots - extra light positions that share the parent entity state but each have their own XYZ position and render parameters. Useful for a single HA entity that controls a row of ceiling spots.
Render Parameters
Every light marker has a full set of render parameters accessible in the Advanced section of the floating panel. Parameters are grouped into four sections:
Core
| Param | Description |
|---|---|
intensity |
Overall brightness multiplier |
distance |
How far the light reaches - affects wall reach and floor pool size |
decay |
Falloff speed. Low = soft wide wash. High = sharp tight edge |
Light Shape
| Param | Applies to | Description |
|---|---|---|
angle |
Spot | Cone half-angle in radians. Smaller = narrower beam |
penumbra |
Spot | Softness of cone edge. 0 = hard cut, 1 = fully feathered |
tilt_x |
Spot, Linear, Cove | Tilts the light in the X floor direction |
tilt_y |
Spot, Linear, Cove | Tilts the light up/down |
width |
Linear, Cove | Width of the rectangular light source |
height |
Linear, Cove | Height of the rectangular light source |
Floor Pool
| Param | Description |
|---|---|
floor_glow_offset |
Spot/Lamp only. Raises the flat glow surface above the zone floor for tables, counters, and platforms |
floor_hotspot_size |
Size of the bright core relative to the main pool. Most effective on Spot, Lamp |
floor_saturation |
Color saturation of the floor glow. 0 = grey, 1.5 = vivid |
floor_outer_size |
Radius multiplier of the wide ambient scatter layer |
floor_outer_brightness |
Brightness of the outer scatter layer |
gi_brightness |
GI bounce intensity - secondary soft floor fill. 0 = disabled |
gi_radius |
Radius multiplier of the GI bounce mesh |
gi_warmth |
Warms the GI bounce color to simulate warm floor reflection |
Wall Glow
| Param | Description |
|---|---|
wall_intensity_scale |
Multiplier for overall wall glow brightness |
wall_height_limit |
Fraction of zone height the wall mesh covers. 1.0 = full wall |
wall_lower_bias |
Shifts glow center down the wall. 0 = near fixture, 1 = near floor |
Hovering over any parameter value shows a tooltip with a description and which light types it is most effective on.
Presets
Parameter sets can be saved as named presets and reused across lights:
- Save as preset - prompts for a name and stores the current resolved values
- Reset - clears all per-light overrides and returns to type defaults
- Export - downloads the resolved parameters as a
.jsonfile - Import - loads a previously exported
.jsonand applies it to the current light
Presets are saved to localStorage and survive JavaScript file updates. The YAML export also includes the light_presets: block so they can be committed to the card config:
light_presets:
narrow_spot:
angle: 0.25
penumbra: 0.3
wall_intensity_scale: 1.2
Per-light overrides and preset assignments export with the marker:
markers:
- entity: light.hallway_spot
light_type: spot
light_preset: narrow_spot
render_params:
tilt_x: 15
wall_lower_bias: 0.2
x: 500.0000
y: 230.0000
z: 400.0000
Floor and Ceiling Glow Clipping
All floor pools, ceiling glows, and GI bounce meshes are clipped to the zone polygon boundary. Light cannot bleed through walls into adjacent rooms regardless of pool radius.
Multiple Floors
type: custom:home-assistant-3d-floorplan
title: Home Floorplan
view_mode: "3d"
floors:
- id: ground
name: Ground Floor
model: /local/floorplans/ground-floor.glb
markers: []
brightness_zones: []
- id: first
name: First Floor
model: /local/floorplans/first-floor.glb
markers: []
brightness_zones: []
Offline / Three.js Setup
What is and isn't local by default
When you install via HACS or manually, the card file (Home-Assistant-3D-Floorplan.js) is stored locally on your Home Assistant instance. Your .glb model is also served from your local /www/ folder.
When installed through HACS, the card first loads the bundled Three.js build from the HACS-served files:
three_bundle_urls:
- /hacsfiles/Home-Assistant-3D-Floorplan/three.bundle.min.js
- /local/three.bundle.min.js
HACS installs both Home-Assistant-3D-Floorplan.js and three.bundle.min.js automatically. The v2.12.3 release provides them as release assets; future releases can also install both files from the repository's dist directory. No manual bundle copy is needed for HACS installations.
If those bundle paths are unavailable, the card falls back to the external CDN esm.sh:
three_url: "https://esm.sh/[email protected]" # default - requires internet
The bundled HACS path avoids remote-access and Companion App issues caused by blocked external module imports.
Making it fully offline (recommended)
The repository includes a pre-built bundle at dist/three.bundle.min.js. Copy it to your Home Assistant www folder:
/config/www/three.bundle.min.js
Then point the card at it if you are not using HACS:
type: custom:home-assistant-3d-floorplan
title: 3D Floorplan
model: /local/floorplans/home.glb
three_bundle_urls:
- /local/three.bundle.min.js
With this in place, everything runs 100% offline - no external requests, no CDN dependency. This also fixes loading issues in the Home Assistant Companion App on iOS/Android, which can block remote module imports.
Alternative - host individual Three.js files
If you prefer to host the individual modules rather than the bundle:
three_url: /local/vendor/three/three.module.js
gltf_loader_url: /local/vendor/three/GLTFLoader.js
obj_loader_url: /local/vendor/three/OBJLoader.js
orbit_controls_url: /local/vendor/three/OrbitControls.js
Use matching files from Three.js release 0.165.0.
Animated 3D Objects
Animate mesh objects in your GLB model based on Home Assistant entity state. Name your objects in Blender (or your 3D editor), then reference them by name in the card config.
These settings can be managed from the Home Assistant visual card editor under Animated 3D Objects. Use Configuration scope to edit a single-floor card or a specific floor in a multi-floor card.
Configuration
Add an animations array at the top level (single-floor) or inside each floor entry (multi-floor):
type: custom:home-assistant-3d-floorplan
title: 3D Floorplan
model: /local/floorplans/home.glb
animations:
- object_name: "CeilingFan"
entity: fan.kitchen_ventilador_cocina
type: rotate
axis: y
speed: 2.0
- object_name: "Pump_PB"
entity: binary_sensor.hcc_planta_baja_pump
type: rotate
axis: z
speed: 1.0
Multi-floor example:
floors:
- id: ground
name: Ground Floor
model: /local/floorplans/ground.glb
animations:
- object_name: "WaterValve"
entity: switch.water_valve
type: oscillate
axis: z
speed: 0.5
amplitude: 0.8
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
object_name |
Yes | — | Name of the mesh/object in the GLB file (as named in Blender) |
entity |
Yes | — | Home Assistant entity ID that controls the animation |
type |
No | rotate |
Animation type: rotate, oscillate, or bob |
axis |
No | y |
Rotation/movement axis: x, y, or z |
speed |
No | 1.0 |
Speed multiplier (rotations/cycles per second) |
state_on |
No | "on" |
Entity state value that triggers the animation |
amplitude |
No | 0.5 |
For oscillate: max rotation in radians. For bob: max displacement in model units |
Animation Types
rotate— Continuous rotation around the specified axis. Good for fans, turbines, pumps.oscillate— Rocks back and forth around the axis. Good for valves, pendulums, indicators.bob— Moves up and down (or along the specified axis). Good for floating indicators or pistons.
Tips
- The object name in the config must match the object name in your 3D file exactly (case-sensitive).
- Set the object's origin point in Blender to the desired center of rotation before exporting.
- For fans, place the origin at the center of the fan blades and use
type: rotatewithaxis: y. - Animations only run when the entity state matches
state_on. When the state changes to anything else, the object stops in its current position. - Multiple animations can target different objects in the same model.
- Geometry centering: The card automatically centers each animated mesh's geometry around its local origin before animating. This ensures rotation happens in-place even for models exported from Sweet Home 3D or other tools that bake world-space vertex positions.
Note on Three.js Loading
The card loads Three.js from esm.sh by default, which rewrites bare import specifiers internally. This avoids the problem where jsdelivr.net CDN links for Three.js addons (GLTFLoader, OrbitControls) use bare import "three" specifiers that fail without a browser import map.
If your HA instance has no internet access, use the bundled offline approach (three_bundle_url) described in the installation section above.
Interactive 3D Objects
Bind named meshes in your GLB model directly to Home Assistant entities. Clicking/tapping the 3D object fires an action (toggle, more-info, call-service), and the object's appearance can change based on entity state.
The visual card editor provides repeatable interactive-object and state-style controls, including tap/hold service actions. Use Configuration scope to edit a single-floor card or a specific floor in a multi-floor card.
Configuration
Add an interactive_objects array at the top level or inside each floor:
interactive_objects:
- object_name: "CeilingFan"
entity: fan.kitchen_ventilador_cocina
tap_action: toggle
hold_action: more-info
state_styles:
"on":
color: "#81c784"
"off":
color: "#5f6570"
opacity: 0.6
- object_name: "GarageDoor"
entity: cover.garage_door
tap_action: more-info
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
object_name |
Yes | — | Name of the mesh/object in the GLB file |
entity |
Yes | — | Home Assistant entity ID |
tap_action |
No | toggle |
Action on tap: toggle, more-info, none, or a call-service object |
hold_action |
No | more-info |
Action on long press (650ms): toggle, more-info, none, or a call-service object |
state_styles |
No | — | Object mapping entity state values to visual styles |
State Styles
Each key under state_styles is an entity state value. Supported style properties:
| Property | Description |
|---|---|
color |
Hex color string to tint the object material (e.g. "#ff0000") |
opacity |
Number 0–1, makes the object semi-transparent |
When the entity state changes to a value not listed in state_styles, the object reverts to its original material.
Call-Service Action
For custom actions beyond toggle/more-info:
interactive_objects:
- object_name: "Thermostat"
entity: climate.living_room
tap_action:
action: call-service
service: climate.set_temperature
data:
temperature: 22
Combining with Animations
An object can be both interactive AND animated. Use the same object_name in both arrays:
animations:
- object_name: "CeilingFan"
entity: fan.kitchen
type: rotate
axis: y
speed: 3.0
interactive_objects:
- object_name: "CeilingFan"
entity: fan.kitchen
tap_action: toggle
state_styles:
"on":
color: "#81c784"
"off":
color: "#5f6570"
This makes the fan spin when on AND lets you tap it to toggle, with a color tint indicating state.
Tips
- The cursor changes to a pointer when hovering over interactive objects.
- Hold gesture uses the same duration as markers (
marker_hold_ms, default 650ms). - If the named object is a group/empty in Blender, all child meshes become clickable.
- State styles clone materials internally so shared materials on other objects are not affected.
Performance Notes
- Use
.glbformat - single file, browser-optimised, carries geometry, materials, and textures together - Zone polygon complexity affects floor pool rendering - simpler polygons with fewer vertices render faster
- Increase
light_radiusand reduce sample count for Linear/Cove lights covering large areas - The GI bounce (
gi_brightness) is disabled by default; enable only where the extra ambient fill is visible
Explore related projects
Loading…