Compare commits

..
8 Commits
853 changed files with 9870 additions and 252994 deletions

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
* text=auto eol=lf
*.png binary
-27
View File
@@ -1,27 +0,0 @@
node_modules/
__pycache__/
*.pyc
.pytest_cache/
.ruff_cache/
.mypy_cache/
.venv/
deploy.local.json
preview/screenshots/
private/
*.pem
*.key
# owned 3D models never go into the repository
*.glb
nextfloor_meshes/
preview/.tutorial-state.json
# local tutorial recordings
frontend/tutorial/out/
# tool installers do not belong here
*.whl
# knowledge-graph tooling output
graphify-out/
*.bak-graphify
tools/docs/dist/
-652
View File
@@ -1,652 +0,0 @@
# Changelog
All notable changes to NextFloor, newest first. Every release lists what is **Added**, **Changed** and **Fixed**. Releases: [GitHub releases](https://github.com/therealMRBK/NextFloor/releases).
## [Unreleased]
## [0.26.6]
### Added
- **Notes with a height and a photo** (#113): a note in the plan gets its own height above the floor (a pin under the ceiling, at the shutoff valve) and a photo, uploaded or as a URL, that shows when the note is tapped in the 3D view.
- **Temperature of technical devices** (thanks @tfischer84, #112): an inverter, a battery, a PC or any other electric device takes a temperature sensor under *Device temperature*. Its value shows on the device's pin in the 3D view; from 60 °C the pin is highlighted.
### Changed
- **Outside has its own section in the editor** (thanks @eskahone, #83): the view for Outside and the devices its panel hides moved from the favourites into *🌳 Outside*, right below *Start view*.
### Fixed
- **Lamps light up in the editor plan as in 3D** (thanks @tfischer84, #111): a lamp whose light was found in its room by itself (not picked by hand), or that glows with one of its further lights, now lights up in the editor's floor plan too.
## [0.26.5]
### Added
- **Chimneys on the roof:** the roof tool places chimneys in four shapes (brick, round, wide with two flues, steel flue pipe with a rain cap), with their own width, depth and height above the roof. Drag them in the plan or in the 3D view.
- **Furniture colours per material** (thanks @eskahone, #82): in the editor under *Settings*, each material furniture is built from (body, wood, fabric, white, metal, dark) gets a colour for the whole house, pieces from the furniture builder and the packs included. A card can set its own with `furniture_colors`, or in the card editor under *Furniture colours of this card*.
- **Fold the energy card:** a small button in the corner of the glass energy card folds it down to its ring and the solar power, on phones and desktops; the browser remembers it.
- **Fine-tune a robot map by hand** (#109): after calibrating, arrows move the map by 10 cm, ⟲ ⟳ turn it by 1° and − + change its size by 1 %.
- **Weather forecast card** (thanks @eskahone, #84): in the house settings under *Weather forecast*, choose 3, 5 or 7 days and a top corner. A small card shows the weather of each day with its high and low and the rain.
- **More days on the "Today" card** (#84): *Days on the "Today" card* lists the appointments of up to seven days, each later day under its own heading.
- **Outside wall colour per floor** (thanks @LDSign, #110): in the solid wall view a floor can have an outside colour of its own (*Wall colour outside (this floor)* in the floor's settings), for a plinth or a garage that is not the colour of the storeys above.
- **Calibrate a robot map from its rooms** (#109): when the robot's map names its rooms, as the Dreame integration does, the dock has a button *Calibrate from the rooms*. It matches them to the rooms with the same names on the plan, so the robot no longer has to be parked 1.5 m from its dock and tapped. With three or more matching rooms a mirrored map is recognised by itself.
- **A view of its own for Outside** (thanks @eskahone, #83): under *Settings → Outside: hide devices* the button *Use this view for Outside* stores the camera of the editor's 3D preview. Opening Outside then flies to the garden instead of staying on the house view; closing it goes back.
### Changed
- **A tidier 3D view on phones:** the switches under the 3D view (walls, floors, roof, heat map, room names, weather) now sit behind one *☰ Switches* button that opens them as a menu above the bar. The house stays in view instead of a row of buttons across the bottom; a tap beside the menu closes it again.
### Fixed
- **Live cards cut off on phones:** a card near the edge of the view now slides back in, its thread still pointing to where it belongs.
- **Room colours on other floors** (thanks @LDSign, #110): a room with its own wall colour no longer paints the walls of the floors above or below that lie in the same spot of the plan.
- **Dreame robot maps** (thanks @lina-alexrt, #109): the map camera of the Dreame integration names the dock `charger_position` instead of `charger`. NextFloor now reads both, so the robot's real position can be calibrated and shown on the plan. Without a `path` on the camera no trail is drawn.
## [0.26.4]
### Added
- **Invert the rain sensor** (thanks @tfischer84, #107): a checkbox under the rain sensor in the settings for sensors that read off (or 0) when it rains.
- **Plan check: look first, ignore what you do not want** (#103): the line "devices not in the plan yet" opens a list of the devices behind it, with *Ignore* for each one (internal KNX devices, say) or for all. Ignored devices are no longer listed; one button brings them back.
- **Smart speakers link to a media player** (#104): a smart speaker, multiroom or hi-fi speaker picks the only free media player of its room by itself, so the quick menu offers volume, play and pause. Linking it by hand in the furniture form works as before.
### Fixed
- **Pieces lying on others can be selected** (thanks @tfischer84, #105): in the plan, what stands higher (a speaker on a desk, a lamp on a shelf) is drawn on top and is the one a click hits.
## [0.26.3]
### Fixed
- **The editor is fast again with many entities** (thanks @alex1255, #101): the list *Outside: hide devices* in the editor's settings worked out the devices of the Outside panel once for every entity of Home Assistant, on every update. With a few thousand entities that kept the browser busy and made clicks and turning the view sluggish. It is now worked out once.
## [0.26.2]
### Added
- **Bluetooth locating (new, experimental):** find out which room a Bluetooth tag, watch or phone is in, learned by walking. Under *Settings → Bluetooth locating* in the editor you pick a tag, walk through each room with it for 30 seconds and record the room. NextFloor compares how strongly the Bluetooth scanners Home Assistant already has (ESPHome Bluetooth proxies, Shelly devices with Bluetooth scanning on, the server's adapter) hear the tag with those recordings. Every tag gets a sensor whose state is the room name, usable in automations and as a person's room sensor under *Presence*. Phones and watches work through Home Assistant's *Private BLE Device*. It needs at least two scanners, more is better. The recordings stay in the plan and are left out of shared plans.
- **See-through outdoor areas** (thanks @thelichtler-cloud, #95): every outdoor area has *Opacity (%)* in its form, from 100 (solid) down to 10, saved with the plan. A driveway or lawn above the cellar no longer hides it in the stacked view; the outline stays.
### Changed
- **A new README:** a shorter, picture-led front page with the three ideas in one minute, a gallery that links into the documentation, the features grouped by what you do, a two-minute install and a table of where to read what.
## [0.26.1]
### Added
- **A documentation site**, in English and German, at [therealmrbk.github.io/NextFloor/docs](https://therealmrbk.github.io/NextFloor/docs/en/): 26 pages from the quick start to the full list of card options, with search (Ctrl+K), a dark and a light look, a table of contents, copyable code and a full-size view of every picture. The sources are Markdown in `docs/content`, built by `tools/docs`, and CI checks every link and anchor.
- The README points into the documentation and lists where to read what.
## [0.26.0]
### Added
- **Eight more languages for the core screens:** Danish, Finnish, Hungarian, Norwegian (Bokmål), Romanian, Slovak, Slovenian and Turkish for the 3D view, the room panel and the card's texts (about 150 each). Everything else still shows in English in those languages until someone adds it; the files are plain JSON in `frontend/lang/`, and a pull request that completes one is very welcome.
- **Card templates:** *Card templates* in the editor's settings set a dashboard card up once, with the card's own settings dialog and a name (say `kitchen_tablet`). On a dashboard card you then choose the template in its settings (or `template: kitchen_tablet`); the card's own options win. A change in the editor reaches every card that uses the template. *Reload screens with this template* and *Reload all screens* (also the action `nextfloor.reload_screens`, with an optional `template`) make the open tablets load their page again a few seconds apart, for example after an update.
- **3D print export:** a *3D print (STL)* button in the 3D view's settings saves the house as an STL file (walls, floors, furniture and outdoor areas of every floor) at 1:100, one metre becoming 10 mm. Windows, lights and the roof are not in it.
- **Right click goes one step back** (the view's settings, or the card option `right_back: true`, off by default): a short right click in the 3D view closes the room or goes from the floor back to the house, like a double tap on empty space; dragging with the right button still pans.
- **Two decoration packs, free:** *Winter & Christmas* (Christmas tree, Advent wreath, window star, candle arch, light-up reindeer, snowman, fairy lights) and *Halloween* (pumpkin, ghost, gravestone, witch's cauldron). The glowing parts follow a light or switch you link; to show a decoration only in its season, set *Only show while …* on the piece. That makes 43 furniture packs.
- **Tilt furniture:** a piece of furniture has *Tilt front/back* and *Tilt sideways* (degrees) in its form, for a leaning ladder, a tilted picture or a roof-sloped shelf. (Owned 3D models are not tilted.)
- **A card for chosen rooms:** the dashboard card's settings list the rooms (*Only these rooms*, YAML `rooms: [id, …]`); the card then shows just those rooms with their furniture, devices, doors and windows, and cannot leave them, for example for a tablet in the kitchen. Nothing ticked: the whole plan as before.
- **Gates in fences:** a fence's form has *+ Gate in the fence*: a gap in one side with gate posts and a garden gate, a double gate or a sliding gate. With a motor or switch (cover, switch, input_boolean, lock) and/or a contact the gate opens in 3D: garden and double gates swing inwards, a sliding gate runs along the fence. (Tapping the gate in 3D to switch it is not there yet.)
- **Sun arc and compass:** the editor's settings have *Sun arc and compass*: today's path of the sun as an arc over the plot, with a ring on the ground, the compass points (north in red) and a bead where the sun stands now. It uses your home's location in Home Assistant and follows the time-of-day slider.
- **Sloping free-standing walls:** a wall drawn with the wall tool can fall from one end to the other (*◢ Sloping* in its form, with a height at each end).
- **Overhang per roof side:** a roof section's form has *Overhang per side*: the eaves and both ends of the ridge each get their own overhang; unset sides stay automatic (none where the roof meets the house).
- **Floor plan only:** a *Floor plan only* button in the view's settings (and a card option `plain: true`) leaves the furniture out of the 3D view and draws walls, doors, windows and stairs; devices and their pins stay.
- **Import of an Apple room scan** (an iPhone or iPad with LiDAR, scanned with an app that exports the RoomPlan JSON): walls become the room, doors and windows sit on their walls with width and sill, and sofa, bed, table, chair and a few more objects become furniture. Choose the file under *Backup → Import*; the plan format page now also describes furniture, free walls, outdoor areas and devices for AI drawn plans.
- **A default room for people** (thanks @ToniB1984, #71): in the *Presence* section every person has a *Default room*. While they are home and no room sensor names a room, they stand there; it also works without any room sensor. Besides persons, any other entity that is on or home (an input_boolean helper, a device tracker, a binary sensor) can be added there for the same.
- **Hide devices in Outside** (thanks @eskahone, #83): the house settings have an *Outside: hide devices* list; the devices on it stay in the plan but no longer show in the Outside panel.
- **Reverse the direction of an awning or curtain** (thanks @Spawnkiller1, #100): a curtain, roller screen, awning or gate linked to a cover has a *Reverse the direction* checkbox, for the ones that move the opposite way in the plan than in reality.
## [0.25.4]
### Added
- **People in their rooms** (tested thoroughly by @thelichtler-cloud, #71): the house settings have a *Presence* section again. Per `person`, pick a room sensor (ESPresense, Bermuda, a template sensor …) whose state names the room or its area; while the person is home and the sensor names a room, their picture (or initials) stands in that room, two people side by side, and moves along when they change rooms. The house view counts the people per floor. The feature existed but was switched off until it had been tested.
- **Size of the sound rings per speaker** (thanks @thelichtler-cloud, #94): a speaker or TV linked to a media player, and a media player marker, have a *Sound rings (%)* field. A small speaker such as an Echo Dot can get small rings, and 0 switches them off while the cover picture and the glow stay.
### Fixed
- **Pets stood still for good while anything else moved** (thanks @thelichtler-cloud for the exact diagnosis, #97): a resting pet only counted its rest down while the view was otherwise idle, so with energy flows, sound rings or weather running it walked once and then stayed put. Pets now keep their own clock and walk on every few seconds.
- **Store plugins on Home Assistant opened over plain http** (thanks @MarioFey1979, #78): a browser on `http://` has no built-in checksum function, so NextFloor imported the plugin straight from GitHub, which serves it as plain text, and the browser refused it (the Cameras plugin loaded nowhere and no camera appeared in the lists). The file is now checked with NextFloor's own SHA-256 and loaded from memory, as over https.
- **A plugin added as `/local/www/…` never loaded** (thanks @MarioFey1979, #78): Home Assistant serves its `www` folder as `/local/`, so a path with `www` in it pointed nowhere and the plugin's devices (cameras, say) were missing from every list. Such a path now loads from `/local/…`, and a new one is stored that way.
- **Zigzag in a straight interior wall** (thanks @Dragi2k, #65): one straight wall that runs past several rooms (bathroom, store room and hall along the bedroom, say) was drawn in pieces, and a piece next to an outer wall sat flush on one side while its neighbours sat centred, so the top of the wall jumped back and forth. The whole straight wall is now aligned as one.
### Changed
- **The editor and the card's settings load faster**: they now use the texts the main bundle already has instead of bringing their own copy, so the editor download is about 200 KB smaller and the card's settings shrink from 236 KB to 31 KB.
## [0.25.3]
### Fixed
- **Close gaps flattened a wall that changes its thickness** (thanks @Dragi2k for the plan, #65): when one room faced two walls of another room at different distances (a wall that is thicker over part of its length), all of them were pulled onto one line, so the step disappeared and the room changed its shape. Each room now keeps its step: the nearer wall closes its gap, the thicker part stays as drawn.
## [0.25.2]
### Fixed
- **Outside on a small tablet** (thanks @eskahone, #83): with Outside open, the Today card (calendar) lay over its panel and caught the taps, so Outside could not be closed again. The Today card now steps aside while a room or Outside is open, as it already did for rooms.
## [0.25.1]
### Added
- **Czech** (thanks @MiraK-2000, #76): the whole interface, the setup and the announcement action in Czech. That makes eleven languages.
- A room's temperature, humidity or CO₂ can be read from several sensors that are averaged: pick one in the room's climate settings, then add another one below it (#80).
- A favourite in the star menu can be limited to one floor (dropdown beside it in the house settings); it then shows only while that floor is open (#73).
- A lamp can be set to "switch only in the room panel" (no brightness, colour temperature or colour sliders), and the name given to a placed device now also shows in the room panel (#73).
- The house settings choose which facts the room panel shows in its header: sun hours, comfort, airing hint, fuse-box circuits (#73).
### Fixed
- **A blind in front of the garage door** (thanks @eskahone, #85): a garage door linked to a cover drew a roller blind with its box in front of it, and the blind moved with the door. The cover now moves only the garage door itself.
- A wide window or sliding door with two blinds: a tap on its right half now opens the second blind; before, every tap went to the first one (#79).
- The plan check no longer offers devices as missing that a window, door or piece of furniture already picks up automatically through its area (a KNX blind, say) (#81).
- A plan with floors but no room no longer says "no floor plan yet": the 3D page now says that walls alone are not enough and that a room is drawn with *Rectangle* or *Free form*.
## [0.25.0]
### Fixed
- **Close gaps no longer puts corners into straight walls** (thanks @Dragi2k, #65): a wall that consists of several edges in a row (for example with a point in the middle of it) is now moved as one wall. Before, each part moved to its own neighbour, so a corner appeared in the wall that was not there before.
- **Clean view on a tablet** (thanks @Melles96, #75): the eye button that brings the controls back now sits at the top edge, so a tablet's taskbar or gesture bar can no longer cover it. *Esc* brings the controls back as well.
- **Phones held upright** (thanks @Duell10111, #70): the floor pictures step aside (the floor tabs above do their job), and the row of view switches along the bottom is one row that scrolls sideways, with a fade at its edge, instead of a column that spilled over the floor cards and the star.
- **Editor side bar covered** (thanks @marcelgschwendtner, #67): a row of tools wider than the plan no longer pushes the plan over the side bar; the row scrolls inside its pill.
- **Second blind on a door** (thanks @tfischer84, #79): a sliding door can now have a second blind for its right half, as a window can.
- **Clock on the card** (thanks @HA-Luz, #68): the clock now keeps ticking; it only moved when the view was reloaded.
### Added
- **A glass wall that follows a curved wall as one pane** (thanks @Sugsss, #66): a curved wall is stored as a chain of short straight edges, and a glass wall could only be as wide as one of them, so glazing an arc meant one pane per edge with a mullion at every bend. A glass wall placed on a curved wall now runs on from edge to edge as a single pane, with jambs only at its two ends, and stays one pane when it is moved, lengthened or deleted. It is stored as an ordinary opening per edge, sharing a `front` id, so the plan, the printed plan, the sun hours and the walls themselves need no special case.
- **Glass walls without mullions**: a glass wall divided into panes of about 0.9 m by itself, with no way to say otherwise. Its form now has a *Panes* field: `0` gives one single pane across the whole wall, for the large glazing modern houses have, and any other number sets how many panes the mullions make. Left empty, a plan keeps exactly the spacing it had.
- **Sanitary pack VIGOUR derby** (thanks @huepfer13, #63): a wall-hung WC, a urinal, a 60 cm washbasin, a paper towel dispenser and a soap dispenser in the sizes of the VIGOUR derby series. That makes 41 furniture packs.
- **A robot vacuum's own trail on the plan** (thanks @Sugsss, #77): a `robot_vacuum` on the plan drove lanes the view invented inside the room it reports. When the robot's integration puts its map on a camera — `vacuum_position`, `charger` and `path` as attributes, which NarwalIntegration's map card does — the view shows the truth instead: the robot stands where it says it is, facing where it faces, and the floor keeps the pad it has really driven, while the dock is drawn where the robot reports it. The robot's grid is tied to the plan by two places known in both (`settings.vacuum_map`); `mirror` covers a map whose y axis runs along plan −z, which two places alone cannot tell apart from a turn. The camera is found by its attributes, so nothing has to be chosen; the calibration is one tap — select the robot's dock, let it drive away, tap it on the plan — and a plan without one keeps the lanes it had. Ten minutes after the robot docks the pad fades out — the timeline keeps a finished clean, the floor does not. The attribute names are the vacuum map card's, so the Xiaomi map extractors, the Roborock integration, NarwalIntegration and any other integration that publishes them fit — including units in millimetres, since the two places set the scale. The manual and the Anleitung describe the calibration.
## [0.24.0]
### Added
- **NextFloor is in the official HACS store.** Install it by searching for *NextFloor* in HACS, no custom repository needed any more. If you installed it as a custom repository, nothing changes: your installation, plan and settings stay as they are and updates keep coming through HACS. A one-time notification in Home Assistant tells you so, in your language. The README, the manual and the Anleitung now describe the store install. Thank you to the HACS team for the review.
- **Choose what a double tap on a room switches** (thanks @mymoll, #62): settings → *Double tap on a room*: the lamps in the plan and every light of the room's area (as before), only the lamps in the plan, or nothing. Smart plugs that Home Assistant reports as lights (Hue plugs) are no longer switched by accident when they are not placed as a lamp. The card can override it with `room_double_tap: auto | area | plan | off`.
### Fixed
- **Shared plans and share views kept data of your home** (thanks to the HACS review): the copy for sharing removed the entity links but kept the settings as they were, so the map position of your home, favourites, own buttons and warnings, calendars, status sensors, the fuse box, announcement phrases and plugin paths travelled with the file, and so did picture rules of screens, light moods, own tap actions, room panel entity lists and Home Assistant areas. A shared copy now keeps only the look of the house (walls, roof, north, units, start view) plus its rooms, furniture and doors, and every field that names an entity, area or device of your Home Assistant is cleared on top of that, so a field added later cannot slip through. Your own plan and the normal backup are not changed. Files you shared earlier still hold the old data; share them again if that matters.
## [0.23.1]
### Fixed
- **Doors in a lowered room** (thanks @ayque): the door leaf, frame, threshold and handle now start on the room's own lower floor instead of the floor level, so there is no gap under the door any more; the edge lines of the opening follow too.
## [0.23.0]
### Added
- **Chinese setup and docs** (thanks @Sugsss): the config flow, the announcement action and the floor sensors in Simplified Chinese, plus a Chinese README and guide.
- **IFC import**: *Backup → Import* also takes an `.ifc` model from a BIM program (Revit, ArchiCAD, Allplan, Vectorworks …) – its storeys become floors at their elevation, its spaces rooms with their names and footprints, in the model's unit turned into metres. NextFloor draws the walls from the rooms.
- **Someone there?** The room panel says whether its motion, occupancy or presence sensors see someone now (*🚶 someone here*), or when they last did (*🚶 last seen 12 min ago*).
- **Power of sockets and switch plates**: a socket or switch whose button is a smart plug or a measuring switch now counts its power – in the room's power and the heat map *Power*, in the room panel, and in the power flow – from the power sensor on that button's device.
## [0.22.0]
### Added
- **A room on its own level**: *Floor level* in the room form puts a room's floor lower or higher than its floor (a sunken entrance at −0.39 m, a split level). Its floor, the bottom of its walls, its doors and windows, the furniture and device pins in it move with it, the step to the rooms around it shows, and its living area counts from its own floor; the ceiling stays where it is. Thanks to @ayque ([#57](https://github.com/therealMRBK/NextFloor/issues/57)).
- **Simplified Chinese**: the whole interface in Simplified Chinese (中文), fetched when Home Assistant runs in Chinese. Thanks to @Sugsss ([#59](https://github.com/therealMRBK/NextFloor/pull/59)).
- **Rooms open to the floor above**: a room's *Ceiling height* may now be higher than its floor – a living room open up to the floor above or under the roof, a gallery. Its walls and windows rise with it, ceiling lights hang from the high ceiling, and the floor above stays open over it; that floor's editor shows the area hatched. Thanks to @Xtiger123X ([#55](https://github.com/therealMRBK/NextFloor/issues/55)).
- **Furniture studio in the editor**: *🛠️ Build your own piece* at the top of the furniture library builds a cabinet (any width, doors, drawers, handles, plinth or legs), a shelf, a lamp (floor, table, pendant, wall) or a device with a display, in centimetres and with a front view that follows every change. It goes straight into the plan and into the pack *Own furniture*; *Change in the studio* on a placed piece changes it again, everywhere it stands.
- **A meter per floor**: *Floor meter (power)* in the floor form takes a power sensor for that floor alone (a sub-meter, a flat). Its value shows on the floor label in the house view, and in the floor's own view the house card adds a row with it and its share of the house's use.
- **Plan check**: *✓ Check the plan* at the top of the editor's side panel lists, floor by floor, what is missing or off – rooms without a Home Assistant area (with the area of the same name to link in one tap), areas without a room, devices of a room not in the plan yet, rooms lying on top of each other, doors and windows off their wall, pins or furniture pointing to entities Home Assistant no longer knows, and **standby eaters** – devices that are off but still draw more than 3 W, with what that costs over a year. Each line has a button that shows the place or makes the fix; undo works as always.
- **Sensors from the plan**: NextFloor now adds sensors to Home Assistant – *Open windows and doors* and *Lights on*, for the whole house and for every floor (e.g. `sensor.nextfloor_ground_floor_open_windows_and_doors`). They count what the plan links (contacts, garage doors, device pins and lamps), list the entities that are open or on in their `entities` attribute, and follow the plan when floors are added or renamed – ready for automations ("nothing open when the alarm goes on") and voice.
- **Everything off, with undo**: the room panel has *⏻ Everything off* while two or more things are on – lights, switches, fans and media (playing speakers pause, TVs switch off). In a floor's view the bar on top has the same for the whole floor (*⏻* with the number of devices). For ten seconds *↶ Undo* brings everything back as it was, lights with their brightness and colour.
- **Living area**: every room shows its living area in the editor, counted like the German Wohnflächenverordnung – the floor inside the walls, in full from 2 m clear height, half between 1 and 2 m under a slope, nothing below. The floor form adds it up for the floor and the house. Garages, cellars and utility rooms are left out by their name; *Counts as living area* in the room form decides it by hand.
- **The plan on paper**: *🖨️ Print plan / PDF* in the floor form opens every floor as a clean black-on-white drawing at 1:100 – walls, doors with their swing, windows, garage doors, room names with their areas, the outer measurements and a metre bar – and a table of all areas at the end. The browser's print dialog prints it or saves it as PDF.
- **Quality by itself**: with the quality on *Auto*, the 3D view now watches how fast the tablet draws while something moves. When it keeps drawing too slowly it uses fewer pixels, a quarter step at a time, and the simple look when even that is not enough; with plenty of room left the pixels come back slowly. *Low* and *High* stay as chosen.
- **Plan versions**: *📌 Save this state …* under *Backup → Restore points* keeps the plan under a name ("before the renovation"); named states stay when the automatic restore points go, and can be deleted again. *Compare* on any point lists, floor by floor, what differs from the plan as it is now – rooms added, removed, renamed or reshaped (with the change in m²), doors and windows, furniture moved, devices placed or removed.
- **Easy to read**: *Aa Easy to read* in the view options (and `readable: true` for the card) gives stronger contrast and larger text – the bars and the room panel a size larger, the pins and floor labels in 3D in bigger letters, Home Assistant's quiet greys in the full text colour. Made for wall tablets across the room and for anyone who reads better that way.
- **First steps**: a new plan starts with a short tour of four cards – drawing rooms, doors and windows, furniture and devices, looking and checking – naming the buttons as the editor shows them; it can be skipped and does not come back. The round *?* in the corner of the plan (or the *?* key) opens the sheet of the editor's keys.
- **Power per room**: the heat map has a new mode *Power* that colours every room by what its devices draw now – the power sensors of its device pins and furniture added up, each counted once, the house's own meters left out (from blue at nothing over green and yellow to red at 3 kW). The room panel shows the same next to temperature and humidity (*⚡ 340 W*), and below it what the room used today and this month, from the statistics of those sensors, with the month's cost at the house's tariff (*⚡ today 0.46 kWh · month 3.34 kWh · 0.97 €*).
- **Notes in the plan**: a right-click (or long press) in the editor has *✎ Note here* – a note pinned to that spot ("bleed the radiator", "fuse 12: cooker"), with an optional day it is due. In 3D it stands as a yellow pin on its floor, orange from the day it is due, and a tap shows its whole text; the search finds notes by their text.
- **Sun in the rooms**: the heat map has a mode *Sun* that colours every room by the hours of sun it gets today through its outside windows – from the plan, its compass and the sun's path at the home's place (neighbours, trees and the roof's overhang are not counted). The room panel shows the same, with the directions its windows look to (*☀ 5.5 h of sun today (S, W)*); a tap on *☀ Sun over the year* adds a bar for every month.
- **Share a view**: *🔗 Share a view* under *Backup* saves the house as a small HTML file that opens in any browser without Home Assistant – it shows the plan in 3D through NextFloor's online demo, with the furniture packs it uses and without any devices or entities, like a template. To show the house to family or a planner.
- **Shade hint**: when the sun stands on a room's outside windows, the room is 24 °C or warmer and those windows' blinds are open, the room panel says so (*☀ Sun on 2 windows at 25.3 °C – lower the blinds?*) and *Lower* closes them in one tap.
- **Clean this room**: a room's form has *Cleaning* – the script or button that sends the robot vacuum there (the room cleaning of your robot's integration). The room panel then shows *🧹 Clean*.
- **Fuse box**: the house settings have a *Fuse box* – circuits by name ("F12 kitchen") with the rooms they feed. The room panel names a room's circuits (*🔌 F12*), and the search finds a circuit and opens its room.
- **Heating with the window open**: when one of a room's windows or doors stands open (its contact or tilt sensor) while the room's thermostat heats, the room panel says so (*🪟 1 window open while the heating runs*) and *Heating off* switches it off – or to its lowest temperature where it has no off.
- **Low batteries**: the batteries of the plan's devices – device pins, the contacts, locks and blinds of doors and windows, linked furniture – from the battery sensor on their device or their own battery attribute. Below 20 % they are in the plan check (*🪫 Battery low: kitchen window (12 %)*) and in their room's panel.
- **Lights on, nobody there**: when a room's motion, occupancy and presence sensors have seen nobody for ten minutes while lights are on, the room panel says so and *Lights off* switches them off.
- **Comfort score**: every room with climate sensors gets a score from 0 to 100 – the temperature in its band (20–23 °C, 22–26 °C in summer), humidity between 40 and 60 %, CO₂ up to 800 ppm, where one bad value always shows. As the heat map mode *Comfort* and in the room panel (*😊 Comfort 85*).
- **Open for …**: the room panel shows how long the room's windows and doors stand open (*🪟 open for 12 min*), the one open longest – handy for airing.
- **Measurements in the plan**: *📏 Measurements* in the editor's bar labels every room edge with its length; the switch is remembered on the browser.
- **Temperatures on the floor label**: a floor's label in the house view shows its coolest and warmest room (*19–22 °C*).
- **Door not locked at night**: *Warn at night when a door is not locked* in the settings names the plan's door locks that stand unlocked between 10 pm and 6 am, as a quiet note in the warning bar.
- **A power sensor for lamps**: lamps now have the *Power sensor* field too, like every other electric piece – for a light behind a measuring switch or a smart plug. Its watts show on the lamp's pin and count in the power flow and the room's power. Thanks to @Robsonator ([#56](https://github.com/therealMRBK/NextFloor/discussions/56)).
- **Stairs: the landing where you want it, and a mount height**: L and U stairs have *Risers up to the landing* – the flights can differ (8 up to the landing, 11 after it), the form says how high the landing lies. Stairs now have the *Mount height* like other furniture, so the upper flight can start on a landing. Thanks to @ayque ([#58](https://github.com/therealMRBK/NextFloor/issues/58)).
### Fixed
- **Floor pictures on a low card**: on a stage lower than 520 px (a dashboard card of 420 px) the floor pictures are smaller and stop above the star, the search and the buttons at the bottom left instead of sliding under them.
## [0.21.0]
### Added
- **Turned roof sections**: a roof section has a *Turn (°)* in its form and turns about its middle – a wing at an angle, a roof over a house that does not stand square to the plan. Its slopes, ridge, gables, solar fields and the ceilings under it follow. Thanks to @XingLii ([#53](https://github.com/therealMRBK/NextFloor/issues/53)).
- **DXF import**: *Backup → Import* also takes a `.dxf` drawing from a CAD program – closed polylines become rooms, lines and open polylines free walls, in the drawing's unit turned into metres.
- **A tap on an own warning**: opens the entity's details by default, or – as chosen per warning – switches the entity or jumps to its room. Thanks to @HA-Luz ([#52](https://github.com/therealMRBK/NextFloor/discussions/52)).
## [0.20.0]
### Added
- **Half-hips of any height**: a half-hip end of a roof section has a slider for how high up the gable its hip starts – from a large hip down low to only the tip.
- **Areas within a room**: a room can take more Home Assistant areas as its parts (*+ Area within the room*) – a reading corner, a shelf, the kitchenette of a living room – whose devices and sensors then belong to the room: in its panel, the climate, the lights and the warnings.
- **Pets where they really are**: a pet from the packs can follow a room sensor (Bermuda, ESPresense or any sensor naming a room, with a tag on its collar) – it appears in the room the sensor names and roams it there.
- **Light designer**: set a room's lamps as you like and press *+ Save mood* in its panel – the mood is kept with the plan, a tap on ✨ sets it again, and *→* carries it over to another room's lamps (the first lamp takes the first setting …).
- **Layers**: a floor can be marked as a *Layer* – all the trees, the decoration, the garden furniture – and the 3D view shows an eye for it at the top that shows or hides it with its pins, remembered on each device.
- **Lamps under the roof slope**: a ceiling lamp, fan or hanging item in an attic room gets *📐 Up to the roof slope* in its form, which hangs it from the underside of the roof right above it; its height stays adjustable.
- **Walls**: a split wall can have its own thickness on each part (a thick outer wall next to a thin glass front), and the room form shows a rectangular room's inside size from wall face to wall face.
- **Solar racks**: a field on a flat roof can stand on **east-west racks** – every second row turned, the pairs back to back, low and close – and a field on a pitched roof can stand on a rack that tilts it further than the roof (the upper edge on brackets).
- **L- and U-shaped sofas without a pack**: the built-in sofa has a *Shape* – straight, L (mirror it for the other side) or U – with a chaise at one or both ends; choosing one makes a small sofa large enough for it.
- **Own warnings**: *House → Own warnings* turns any entity into a line in the warning bar while it is in a state – "Water tank empty" from the robot vacuum, "Dishwasher done", "Salt low" below 20 (several states with commas, `<20` or `>80` for numbers), for the whole house or one room, with a colour of your choice for the stripe on the left. They look like the warning for a contact that stops answering. Thanks to @HA-Luz ([#52](https://github.com/therealMRBK/NextFloor/discussions/52)).
- **Which sensor set the alarm off**: when an alarm panel is triggered, the banner names the door, window or motion sensor that set it off (Alarmo tells it, otherwise the one that changed just before), and only its room pulses red instead of the whole house.
- **Outdoor areas like rooms**: a garden, terrace or pool can be linked to a Home Assistant area – its devices and sensors join the Outside panel, and a pin on the area opens it. A pool, pond or bed can show its water temperature and pump on that pin ("24.5 °C · pump on").
- **Robot mowers mow their lawn**: a robot mower or its dock from the *Garden 2* pack linked to a `lawn_mower` drives lanes over its lawn in 3D while it mows (around the beds, ponds and terraces on it), and drives home when it returns.
- **Wi-Fi map**: the map selector has a new **Wi-Fi** mode – every access point, router or mesh node from the packs linked to its device spreads its reach as a disc over the floor (through the walls), blue while it has room, amber when it is busy, red when it is down; its pin tells how many devices it carries, and the legend sums up the access points, their devices and which network devices of the plan are offline.
- **Room climate**: the heat map has a new **Mould** mode – the risk at each room's coldest wall from its temperature and humidity – and the temperature map uses a summer scale from May to September (rooms count as hot later). Rooms without a sensor of their own take the temperature and humidity of their thermostat. The room panel shows the room's temperature over the last 24 hours as a small curve, and both the panel and the *Values* map tell when to air a room (too much CO₂, too damp, risk of mould).
- **Underfloor heating**: a room can name its floor heating's thermostat, valve or switch, and its floor glows warm in 3D while it heats.
- **Heat pump**: a heat pump from the packs linked to any entity of its device shows a card with what it does (heating, hot water, cooling, defrosting), flow and return, the outside temperature, the power it draws, the heat it delivers and its COP as a ring – and with the energy flow on, its heat runs into the house in orange.
- **Your 3D printer, live**: link a 3D printer from the packs to any entity of your printer's device (Bambu Lab, OctoPrint, Moonraker/Klipper or PrusaLink), and while it prints a card floats above it with the model's picture, the progress, the time left and "done at", the layer, nozzle and bed temperatures and the filament colours of the AMS – and the print grows on the bed in 3D in the colour of its filament.
- **"Today" on the wall tablet**: choose calendars in *House → Calendars for "Today"*, and a card top right in the 3D view lists the day's appointments (all-day ones first, past ones dimmed) together with the waste bins collected today or tomorrow. A tap on its title folds it; the card option `today: false` hides it on a dashboard card.
- **Move a pin by hand**: when devices stand close together and their pins cover each other, *Move the pin* in the device's or furniture's form pushes the pin aside or up (in metres) while the device stays where it is.
- **Small tablets and phones**: a 🔍 zoom in the view options (card option `zoom`) brings the fitted views closer so the house looks larger on a small tablet; *🎥 Keep camera* (card option `keep_camera`) keeps the camera's side, height and distance when you switch floors; the room panel takes a little more of the width on small landscape tablets; and on a phone the editor's tools are one dropdown instead of a row of eleven buttons.
- **Favourites first**: the star menu can stand open from the start and a size larger (*★ Menu open* in the view options, card option `central_open`) for a wall tablet that mostly runs scenes; own buttons light up while their entity is on (the one they open or switch, or one you name); and the room panel lists the room's scenes at the top.
- **Speakers and TVs get their own quick menu**: a tap on one opens play/pause, back and next, the volume, its sources (inputs, apps, Spotify Connect …) and the stations and playlists of *House → Presets*. A preset can now be kept to some speakers – the kitchen radio station on the kitchen speaker only.
- **The car tells more**: a car plugged in at a wallbox nearby hangs on its charging cable in 3D (with the energy flow on), and the power runs along it while it charges. Its card says how far it is from home while it is away, when it leaves (a departure time it reports, or one set on the spot), and warns which doors, hatches, windows or the charge port stand open.
- **More of the energy picture**: the house card now shows the last seven days as bars (sun and use per day, from Home Assistant's long-term statistics), gas and water meters (*Energy → Balance*) appear in the energy bar and on the card, the card stays above the open floor in the floor views, and a home battery shows its charge on its own front – a bar that fills, green when full, yellow, red when nearly empty.
- **Venetian blinds, inside blinds, two blinds per window and Somfy "My"**: a window's blind can be a roller shutter outside (as before), a venetian blind whose slats turn in 3D with the cover's tilt, or a roller blind inside behind the glass. A wide window takes a second blind for its right half. A favourite position shows as **My** in the blind's quick menu – a blind with positions moves there, a Somfy RTS motor without feedback goes to its own My.
- **Every electric piece works alike**: any electric piece of furniture with a switch or power sensor shows its draw beside its state on its pin ("On · 1.2 kW"), and its status lights and display light up while it runs – a coffee machine, a compressor, a 3D printer – like the washer and dishwasher always did.
- **Lamps with several bulbs**: a lamp's form takes up to four more lights of the same fixture – a night light, an ambient ring, an uplight. While the main light is off, the lamp glows in 3D with the next light that is on, a little dimmer, and its pin says which one.
- **Picture frames with your own photos**: the new *Pictures & frames* pack (frames in four formats and six colours, canvas, poster, table frame, digital photo frame, picture ledge) shows a photo you upload in the frame's form, a picture address (/local/…) or the current picture of an image or camera entity – a photo of the day changes on the wall by itself. A white mat of any width, and the photo fills the frame or shows whole.
- **Show a piece only while …**: every piece of furniture can wait for a helper, a calendar, the sun or any sensor before it appears in 3D – the Christmas tree only while *input_boolean.christmas* is on, the paddling pool only in summer, a tent while a calendar says "camping". Several states separated by commas, or the other way round; the editor always shows the piece.
- **13 new furniture packs with 124 pieces**: *Season & decoration* (a Christmas tree whose fairy lights follow its light, Advent wreath, window star, candle arch, light-up reindeer, outdoor string lights, pumpkins, Easter tree, snowman, presents), *Smart home 2* (siren, Wi-Fi access points, smoke, CO, presence and water leak sensors, air quality monitor, dehumidifier, cube lamp, video doorbell), *Building services 2* (water tank, oil tank and oil boiler, water softener, buffer tank, cistern, ventilation unit, indoor heat pump), *Wellness* (sauna, barrel sauna, infrared cabin, hot tub, plunge pool, ice bath, steam shower, lounger – the heated ones link to a climate entity and show its temperature), *Garden 2* (water feature with light, pond with pump, robot mower and its dock, sandbox, beach chair, wood pile, bird house, raised bed, garden shower), *Kitchen 2* (bean-to-cup and espresso machines, kettle, toaster, stand mixer, cooking food processor, air fryer, microwave, wine fridge, sparkling water maker, slim dishwasher), *Vehicles 2* (motorbike, scooter, camper van, trailer, e-bike, cargo bike, quad, boat on a trailer, each in six colours), *Outdoor kitchen & terrace*, *Workshop 2*, *Japandi & Scandi*, *Loft & industrial*, *Indoor greenery* (plants that show their soil moisture) and *Music & studio*. The library has two new shelves for them: *Music & studio* and *Season & decoration*.
### Changed
- **A tap on a speaker or TV opens its quick menu** (play, skip, volume, sources, presets) instead of Home Assistant's details; *Details …* in the menu still opens them.
- **Scenes come first in the room panel**, above the lights.
- **Every electric piece shows its power beside its state** on its pin.
## [0.17.0]
### Added
- **Duplicate a floor**: the floor form copies the open floor on top of the house, with its rooms, walls, doors and windows, and on request its furniture, device pins and outdoor areas. The copy is unlinked from Home Assistant (areas, floor, furniture entities), so it can be set up for the new storey; energy devices stay on the original floor.
- **Move furniture to another floor**: the furniture form moves an item to the same spot on another floor.
- **Curved walls**: the ◠ Arc button on a wall of a room (in the room's wall list) or on a free wall bends it into an arc: type how far its middle bulges, outwards or into the room, and press *Bend*. A room sharing the wall bends along, doors and windows move with it and stay whole, and everything else (3D, solid walls, cut view, wall heights) treats the arc like any wall. Undo takes the arc back.
- **The house throws its shadow**: with north set, the house casts its shadow on the plot from the sun's real position, long in the morning and evening and paler behind clouds. It follows the "Sunlight and shadows" setting (formerly "Sunlight through the windows") and is off on the Tablet level.
- **Time of day**: switch on *☀ Time of day* in the view options (⚙), and a ☀ switch under the 3D view opens a slider over the hours of today, in Home Assistant's time zone. Sun patches, the shadow, the sky, the sun or moon and the *Auto* look follow the chosen hour once the slider is let go; tapping the switch again goes back to now.
- **Night sky and weather on the ground**: with the weather on, stars come out on a clear night; snow lies white around the house while it snows, and the ground turns dark and wet in the rain.
- **Stairs with a shape**: the new **Stairs** tool in the editor's toolbar draws a stair where you drag (it runs along the long side), and the stair from the library has a shape as well: straight, quarter turn with winders, L with a landing, half turn with winders, U with a landing or spiral, turning to the left or right, built solid, on stringers, on one spine or as floating steps, with or without risers and with a railing on either or both sides. The number of risers comes from the floor height and can be set by hand; the form shows rise, going and step measure and warns when the stair would be uncomfortable. The plan draws every tread with the walking line. Older stairs keep their look until you press **Set the shape**.
- **Stairs going down**: a stair can lead down from its floor, for example into a cellar that is not drawn. It opens its own floor and is drawn dashed in the plan.
- **Openings that fit the stair**: a shaped stair opens the floor above only where its steps lack 2.2 m of headroom, following its shape, instead of the whole rectangle. The stair's **Floor opening** choice opens the whole stair instead (an open stairwell) or nothing (a hatch or closed stairwell). Older stairs and the stairs of the *Stairs & railings* pack open their footprint as before.
- **LED strips that rise along a slope**: an LED strip's form has *Rise along its length (°)*, so a strip can climb up a sloped ceiling or a gable wall from the eaves towards the ridge, or follow a stair. Its low end stays at the mount height (or its high end under the ceiling), and its light and glow follow the strip. Thanks to @jan74berlin ([#36](https://github.com/therealMRBK/NextFloor/issues/36)).
- **Cable routes for the energy flow**: the energy tool's new *Cable routes* section draws where a cable really runs, from a solar field on the carport to the inverter and battery in the cellar, along walls and through ceilings across floors. The flow follows the route instead of an arc through the house, a battery's route is walked either way as it charges or discharges, and *Show as cable* draws it as a visible cable. Connections without a route keep their arc. Thanks to @galionsfigur ([#49](https://github.com/therealMRBK/NextFloor/issues/49)).
- **Outside, next to the floors**: a **🌳 Outside** chip beside the floors opens the house view with its own panel, like a room's, for every device outside the rooms: the irrigation valves, garden lights and sensors at a glance. A device on the roof or above a room that belongs outside (a weather station) gets *Belongs to Outside* in its form, so it no longer counts for the room below. The dashboard card shows the chip with its room buttons. Thanks to @jan74berlin ([#39](https://github.com/therealMRBK/NextFloor/issues/39)).
### Changed
- **New stairs are shaped stairs**: a stair placed from now on opens the floor above only where its steps lack headroom, so the opening is smaller than the whole rectangle as before. Choose *Floor opening → Over the whole stair* in its form for the old opening; stairs already in the plan keep theirs.
### Fixed
- **Cameras of an NVR are easy to find in the device list**: with the *Cameras* plugin, a camera that shares its device with the NVR's motion, person and vehicle sensors (ONVIF) now leads that device's row instead of hiding behind "more" after the sensors. Thanks to @toshi24 ([#50](https://github.com/therealMRBK/NextFloor/discussions/50)).
- **The clock top left no longer covers the sensors at the top**: with *Top left* chosen, the clock stands above the own sensors and the energy bar, which move down below it. Thanks to @toshi24 ([#35](https://github.com/therealMRBK/NextFloor/issues/35)).
- **Sensors a plugin handles can be placed**: the editor's device lists show every entity a plugin takes on, whatever its device class (a 3D printer's enum print-state sensor from Moonraker), and it leads its device's row. Entities no plugin handles are filtered as before. Thanks to @Luca-Bachini-Barr ([#51](https://github.com/therealMRBK/NextFloor/issues/51)).
## [0.16.1]
### Added
- **Wall buttons in the plan**: `event.*` entities (Homematic, Hue or Zigbee wall buttons and remotes) can be placed like any device. Their marker shows when the button was last pressed, and a tap opens its details. Thanks to @jan74berlin ([#35](https://github.com/therealMRBK/NextFloor/issues/35)).
### Changed
- **The room form warns when a room's ceiling lies above its floor height** (it can come from an import or a floor height lowered later): walls, windows and doors stop at the floor height, so a window above it was squeezed. Thanks to @jan74berlin ([#37](https://github.com/therealMRBK/NextFloor/issues/37)).
- **The switches at the bottom of the 3D view take less room**: on a smaller window, a zoomed browser or a dashboard column they are drawn smaller, and in the panel the new ▾ button folds them into one "Switches" button (remembered per device). Thanks to @jan74berlin ([#38](https://github.com/therealMRBK/NextFloor/issues/38)).
- **Garden devices set to "Always show" are visible from every view**: a device placed outside every room (irrigation valves, outdoor lights, a pool pump) whose marker is set to "Always show" now also shows in the house view ("All floors") and while another floor is opened, wherever its floor is drawn. Other markers keep to their floor as before. Thanks to @jan74berlin ([#33](https://github.com/therealMRBK/NextFloor/issues/33)).
### Fixed
- **Sweet Home 3D import no longer doubles walls**: a wall that runs along a room for only part of its length was taken over whole as a free wall, so it stood twice along that room (windows in it could face the wrong way). Now only the stretches beyond the rooms become free walls. Re-import the plan to get the clean walls. Thanks to @alexhass ([#40](https://github.com/therealMRBK/NextFloor/issues/40)).
- **The roof sits on its walls**: at rest in the house view it hovered 13 cm above them, and while zooming in the walls under it showed through. It now rests exactly on its height and keeps hiding what is below until it has mostly faded. Thanks to @LDSign ([#41](https://github.com/therealMRBK/NextFloor/issues/41)).
- **A roof section stays on the floor under it**: on a slope, a flat garage roof could ride with a higher floor beside it ("Pulled apart" lifted it off the garage). A section now belongs to the floor whose rooms lie under it. Thanks to @LDSign ([#42](https://github.com/therealMRBK/NextFloor/issues/42)).
- **Device names under markers are readable again**: the caption of a device with its own name ("Show the name under the marker in 3D") was dark text on a dark plate in some themes; it is now light text on the dark plate in every theme. Thanks to @jan74berlin ([#34](https://github.com/therealMRBK/NextFloor/issues/34)).
- **TVs that only report "on"** (Samsung, LG on live TV, and others) show their channel, input and logo on the screen in the plan, and appear in the live media card, instead of staying blank. Thanks to @Luca-Bachini-Barr ([#31](https://github.com/therealMRBK/NextFloor/issues/31)).
- **Heaters from furniture packs glow while they heat**, as the built-in radiator does: link a towel radiator (or any pack heater) to a thermostat and it glows orange while that thermostat heats; a thermostat or A/C unit with a display glows on its display. Thanks to @Luca-Bachini-Barr ([#32](https://github.com/therealMRBK/NextFloor/issues/32)).
## [0.16.0]
### Added
- **Furniture builder** ([open it](https://therealmrbk.github.io/NextFloor/builder/)): build your own furniture in the browser from boxes, cylinders, tapers and round bodies, in centimetres, beside a 3D view that draws it exactly as NextFloor does. Start from a template (cabinet, table, shelf, floor lamp, sofa), tap parts in 3D to select them, set colours that follow the look, lamps and screens. The builder checks the pack as NextFloor's import does, keeps it in the browser, saves it as a pack file, and shares it in the community store with one button.
- **Community furniture** (Extensions → Furniture packs): furniture others built with the builder and shared, checked by the store and by NextFloor's import, installed with one tap; a newer release of an installed pack shows as an update.
- **Announcements, free for everyone**: *"Dinner is ready!"* – and the room that should hear it, hears it.
- **In the room panel**, a **📢 Announcement** section for rooms with a speaker: tap a sentence or type your own. Own sentences under *Editor → Settings*.
- **Each room speaks through its own speaker**: chosen in the room's form, else one placed in the room, else a voice satellite, an Echo or a speaker of its area (never a TV or a speaker that is off). Voice satellites chime, Echos make a real announcement (Alexa Devices or Alexa Media Player), speakers that can (Sonos and others) lower their music and play on after, every other speaker uses Home Assistant's text-to-speech.
- **Quiet time per room** (a nursery from 20:00): announcements to several rooms leave it out, one meant only for it still gets through.
- **Every open NextFloor screen** (panel or card) shows the message big over the house, plays a soft chime and speaks it. A screen can get a name (⚙ → 📢) to be addressed alone, or stay silent. Card options `announcements` and `screen_name`.
- **The action `nextfloor.announce`** for automations (message, rooms, floor, screens, on_speakers, on_screens, tts_entity); it answers which speaker said it and which rooms were left out.
- **Own sensors at the top of the 3D view** (Editor → Settings, up to 12): the outside temperature, the alarm, the air quality – each with its name and value at the top left, in an opened room too; a tap opens its details. Card option `sensor_bar`.
- **Markers only while active**: a device's marker can show *Only while active* (a motion sensor while it detects, a contact while open, a device while on), and *Editor → Settings* can show every motion, occupancy and presence sensor only while it detects something.
- **Irrigation**: a lawn sprinkler (garden pack) linked to a valve or a switch throws water in arcs around it while it runs – six jets that turn slowly, as far as its *Reach of the water* (default 3 m). The irrigation valve box links to a valve too.
- **Valves** (`valve.*`, irrigation or the main water) work like switches everywhere: they show open or closed, count as on while open, and a tap opens or closes them.
- **How opaque the glass walls are**: a slider under ⚙ (per screen) and the card option `glass_walls` set the walls you look through into the rooms from almost invisible (0 %) to opaque (100 %); 20 % is the faint glass as before.
- **Fridge and freezer temperatures**: a fridge (also a pack's fridge or freezer) takes a thermometer for the fridge and one for the freezer compartment. Its pin shows both ("4.3 °C · −18.2 °C") and lights up as a warning above 8 °C in the fridge or −12 °C in the freezer; sensors in °F work too.
- **Lift-and-slide doors and sliding windows**: a new kind *Lift-and-slide door*, and every window can now open *sliding*. The pane at the hinge side slides in front of the fixed one when its contact reports open; with two leaves the two middle panes slide outwards, each on its own contact. The plan draws the panes on their two tracks.
- **Top-hung windows**: a window can open *top-hung* – its bottom swings out of the wall when its contact (or a tilt sensor) reports open.
- **Opening angle for doors**: every door has an *Opening angle* (default, 15° to 180°). With a contact the leaf opens that far as soon as it reports open; without one it stands that far open instead of half open. A door that is only assumed to stand open no longer glows as open. *Default* keeps everything as it was.
- **Warning for contacts that stop answering** (off by default, Editor → Settings): when a door or window contact has been unavailable for 10 minutes (an empty battery, out of radio reach), a note in the warning bar names it, because the window then looks shut in 3D although nobody knows. It is a quiet note: the room does not pulse and the view does not jump to it. A restart of Home Assistant does not warn.
### Fixed
- **A glass wall placed from the toolbar is a glass wall**: dropping the *Glass wall* kind made a plain terrace window; it now keeps its look (doors still pick room or front door by their wall).
## 0.15.1
### Changed
- **Furniture with an own tap action keeps showing its state** by @Mika2108 ([#30](https://github.com/therealMRBK/NextFloor/pull/30)): an item linked to an entity (a meter with its power, a lamp, a washing machine, a light switch, a bin) keeps its usual marker, glow and energy flow when *Tapping the item* is set; only a tap on the item or its marker runs the action, a long press still opens the details. Example: the meter shows the grid power and a tap opens the energy dashboard. Items without a marker of their own still get the tap marker.
### Fixed
- **Plugin devices show their own icon in the editor** by @Mika2108 ([#28](https://github.com/therealMRBK/NextFloor/pull/28)): the plan, the device's form and the room's device list use the icon picked in the plan, else the plugin's Material Design icon, else the kind's symbol, as the 3D view does. Cameras no longer show as clocks.
- **A garage remote keeps its buttons in the room panel** by @Mika2108 ([#29](https://github.com/therealMRBK/NextFloor/pull/29)): a cover that only sends commands and never reports its position is no longer greyed out there, as in the quick menu since 0.14.0. *Open all* / *Close all* now leave out covers set to ask first, so a garage door no longer moves along without the confirmation, and they are hidden when no cover is left.
## [0.15.0]
### Added
- **Wall-mounted air conditioner** (#23): the *Utility & building services* pack has a split air conditioner, an indoor unit for the wall and an outdoor unit. The indoor unit links to a climate entity like the wall thermostat.
- **Switch devices only in the opened room** by @Mika2108 (#26): card option *Switch devices only in the opened room* (`tap_in_room: true`). In the house and floor views a tap opens the floor or room, even on a device or its marker, so a tap meant for a room no longer switches a lamp by accident. In the opened room nothing changes; a long press still opens the menu or details everywhere.
- **Choose the markers outside the opened room** by @Mika2108 (#26): card option `markers_outside` with one chip per kind (lights, blinds, heating, media, switches, fans, locks, contacts and detectors, sensors, furniture with an action, other). In the opened room the usual marker setting applies.
- **Own tap action for furniture** by @Mika2108 (#26): *Tapping the item* in the furniture form runs one of the own-button actions (open a path, an entity's details, a service, a browser_mod popup) instead of the usual tap, with a marker above the item.
- **Cameras and alarm panels as a plugin** (#27): the new *Cameras* plugin in the plugin store (*Extensions → Plugins → Open plugin store*) puts security cameras back into the plan. A camera shows its field of view as a wedge on the floor that stops at walls and turns red while a motion, person, vehicle or animal sensor of the same device detects something. A tap on the camera or its wedge opens Home Assistant's own live player in a small window in the corner (or HA's dialog). Mount, field of view, reach, tilt and detections are set in the camera's form, and a handle in the plan turns it. Alarm panels get a shield with their state, and a tap opens the keypad.
- **More for plugins**: a device extension can now add fields to the device's form (`settings`), draw a wedge on the floor (`floorWedge`), handle taps and open a small window in the corner of the 3D view (`tap`, `showWindow`), and name further entities to watch (`watch`). Devices a plugin takes on are drawn in the editor's plan too. See [docs/plugins.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/plugins.md).
### Changed
- **Hide any entity of a room** (#24): in a room's device list, the further entities of a device (behind *more*) can now be hidden from the room and have their state hidden too, like the device's main entity.
### Fixed
- **Editing doors and windows froze the plan** (#25): when the form of a selected item could not be drawn, the whole editor stopped updating. A new door only showed up after a second click, the door form did not open and a dragged door stayed put. The plan now keeps working, and the side bar shows what went wrong (with a way back) so it can be reported.
- An entity whose name is a number (set in YAML) no longer breaks the entity lists in the editor.
## [0.14.0]
### Added
- **Less rain and snow on a card** by @Mika2108 (#18): the card option *Amount of rain and snow* (`weather_density`, 15 to 100 %) thins out rain, hail and snow, so a wall tablet still shows the house in heavy weather. Clouds, fog and lightning stay as the weather says.
- **New furniture library**: the built-in models and all packs stand together, sorted by what they are (seating, beds, kitchen, bathroom, TV & audio, pets …) instead of pack by pack. Every card shows a picture, the size and where it comes from; a model in several sizes (a base unit from 30 to 120 cm, a bed from 90 to 200) is one card with size chips. With a room selected the library shows what fits it (*Fits Kitchen*, its main kind open and on top), *Show all rooms* lifts that. Chips narrow it to ⚡ linkable, 💡 lit or 🌳 outdoor items, ★ favourites and recently used items stand at the top. Pictures are drawn once and kept in the browser; weak tablets show the cards without pictures.
- **Resizing keeps what should stay**: a pack item made wider, deeper or taller keeps its legs, arms, plates and handles at their real size and distance from the edge, and only the middle grows: a sofa stretched to 3.6 m keeps its 20 cm arms, a taller table gets longer legs under the same plate. Pack authors can switch it off per item with `"stretch": true`.
- **Smart locks on doors**: a door takes a smart lock (door form → *Smart lock*). A tap on the door in 3D locks or unlocks it, always asking first; while it stands unlocked, the door's free edge glows in the accent colour.
- **Light switches and sockets**: the *Smart home & tech* pack has light switches and sockets with 1 to 4 buttons in one frame, and an outdoor socket with a lid. Each button gets its own entity; it glows while that is on, a light switch in its light's colour, a socket green and brighter the more it draws. A tap switches it; with several buttons a small menu asks which. The same entity may sit on several switches.
- **Curtains, screens, awnings and gates that move**: furniture with moving parts follows a cover entity (*Moves with* in its form): awnings in three widths reach out over the terrace, a curtain gathers to both sides, an inside roller blind and the roll-down projection screen roll up, a sliding gate slides away, the motorised curtain gathers to its side. They travel at motor speed, and a tap opens the cover's menu (up, stop, down). Pack authors mark parts with `move` (`down`, `left`, `right`, `out`, `slide_left`, `slide_right`) and the item with `cover`.
- **Look *Auto***: the day look while the sun is up, neon after sunset (from `sun.sun`), in the panel and as card option `theme: auto`.
- **Clock in the view**: a large clock with the date in a corner of the 3D view (panel: 🕒 next to the markers; card option `clock: top_left | top_right | bottom_left | bottom_right`).
- **3D lock** for wall tablets: the 🔒 button next to the eye stops turning, zooming and panning by hand on this device; taps, long presses and swipes on devices still work. Cards can hide the button (`lock_button: false`).
- **Own background**: *Editor → Settings → Own background* puts the house in front of a colour or a picture of your own (`/local/…` or https), dimmed as much as you like, instead of the look's sky.
- **Light wells**: an outer window whose sill lies below the ground (a cellar window) gets a concrete light well with a grating at ground level by itself; *Light well in front* in the window's form switches it off.
- **Different end at each end of a roof**: gable, hip and half-hip sections can take their own shape at the start and at the end of the ridge (a hip at one end, an upright gable at the other).
- **Sill and board per window**: automatic, none, inside only or outside only.
- **Import from Sweet Home 3D**: *Backup → Import* also takes a `.sh3d` file (Sweet Home 3D 5.3 and newer): levels become floors, rooms become rooms (moved onto the walls' centre lines, so neighbours share one wall), doors and windows go into the walls they stand in, and walls without a room become free walls. Its furniture stays behind; before taking it over NextFloor says what it found.
- **Household**: waste bins (residual, organic, paper, recycling; 120 and 240 l) and mailboxes in the garden pack. A bin shows its next pickup from a sensor (days, a date, "today"/"tomorrow" or Waste Collection Schedule) and glows the day before and on the day; a mailbox glows while there is post; a plant (the built-in one and the pack plants) shows its soil moisture and glows when it is thirsty. Their pins come up while something is due. Washers, dryers and dishwashers show the time they have left when their device has a remaining-time sensor.
- **Pets that roam**: a cat, a dog and a rabbit in the pets pack walk around their room in 3D, round the furniture, and sit for a while between their walks. While they all sit nothing is drawn, and on the *Tablet* level they rest with the other decorations.
- **Day curve on the house card**: the energy card over the roof shows the last 24 hours, solar as a filled curve and consumption as a line, worked out from the history of exactly the sensors the card reads (refreshed every 10 minutes).
- **Feet and inches**: *Editor → Settings → Show lengths in* shows the lengths and areas of the plan, the forms and the wall view in feet and inches (to the half inch) and square feet; inputs stay in metres.
- **Valleys for L- and T-shaped houses**: a wing roof that butts against the eave of a bigger roof at a right angle now runs into that roof's slope like a cross gable, so the two roofs meet in valleys instead of the wing ending in a gable wall at the eave.
- **Sloped walls**: a third wall view next to *Tall walls* and *Cut*: the walls are cut on a slope, half height on the side facing the camera and full height at the back, like a doll's house; the slope turns with the camera.
- **Solid walls with colours**: the new switch *Solid* shows opaque walls in real colours instead of glass. *Editor → Settings* sets the wall colour outside and inside, and each room can have its own inside colour. In an open room the walls in front of the camera are lowered. Works in the dashboard card too (`solid_walls: true`, `walls: slope`).
- **Seven more languages**: NextFloor now speaks French (thanks to Mika2108), Spanish, Italian, Dutch, Polish, Portuguese and Swedish besides German and English, following the language of your Home Assistant user, furniture names included. Each language loads only when it is needed.
- **Plan format and AI import**: [docs/plan-format.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/plan-format.md) describes the plan file, with a ready prompt that lets an AI turn a picture of your floor plan into a plan for *Backup → Import*.
### Fixed
- **A garage door follows its contact when the cover cannot tell** by @Mika2108 (#21): a remote without feedback (`assumed_state`, always `unknown`) no longer shows the door open while its contact says closed.
- **Quick menu for covers without feedback** by @Mika2108 (#21): such a cover keeps its open, close and stop buttons; the centre button stays off while the state is unknown.
- **Entities that a plugin gives a kind** by @Mika2108 (#21) are offered in the editor's area lists, *without area* and *other areas*.
- **Walking keys by their place on the keyboard** by @Mika2108 (#21): W A S D walk under the same fingers on QWERTY, QWERTZ and AZERTY (Z Q S D).
- **Doors and windows of an imported plan can be selected again**: a plan written by hand or by an AI without ids (or with repeated ones) gets an id for every room, door, window, piece of furniture and outdoor area, so they can be picked and changed (e.g. into a garage door). Missing sizes, the plan version and the settings are filled in instead of refusing the file.
## [0.13.0]
### Added
- **Import furniture packs again**: *Extensions → Furniture packs* imports your own packs as files or as JSON pasted straight into a text field, lists the packs you imported and removes them. The format is in [docs/packs.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/packs.md).
- **Climate devices in furniture packs** by @carmona15 (#14): a pack item marked `climate: true` (a wall-mounted A/C, a heat pump) links to a Home Assistant climate entity, found automatically in the room's area like a radiator's thermostat, and can have a power sensor. How to mark an item: [docs/packs.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/packs.md).
### Fixed
- **Wall thermostat** (#17) now links to a climate entity instead of asking for a TV. Climate items from packs are also offered under *Show as furniture* for a climate entity, next to the radiator.
## [0.12.0]
### Added
- **Plugin store**: *Extensions → Plugins → Open plugin store* lists reviewed community plugins from [NextFloor-Plugins](https://github.com/therealMRBK/NextFloor-Plugins) and installs them with one click. Authors submit a plugin with a pull request, which is reviewed by hand. Every entry points at a file pinned to one commit and carries its SHA-256; NextFloor checks the hash before the plugin runs and offers newer versions as an update.
### Fixed
- **Solar fields on a mansard roof** (#13) now lie on the roof instead of sinking into it. Each side offers two roof faces to choose from: the steep lower slope and the flatter upper slope above the break. Fields placed on a mansard before keep their spot on the lower slope; move a field that should sit higher onto the upper face.
## [0.11.0]
### Added
- **Ceiling height per room** (#12): a room can have its own ceiling height (room form → *Ceiling height*), e.g. a 2.12 m bathroom on a 4 m floor. Ceiling lights, ceiling fans, LED strips under the ceiling, ceiling devices and placed ceiling lights hang from it, and the room's walls are that high (a wall shared with a room without its own ceiling keeps the floor height; between two rooms with their own ceilings it takes the higher one). Heights set by hand on a wall still win.
- **Ceiling height at one spot** (#12): ceiling lights and other hanging items have a *Ceiling here* field for a sloping ceiling or a single high spot (a light at 4 m).
- **Ceiling fans** (#11): a new *Ceiling fan* in the lights section. Link its light kit like any lamp and its fan entity (found on the light's device or in the room). In 3D the blades turn as fast as the fan runs; the fan's pin shows its speed, a tap switches it, swiping up or down changes the speed and a long press opens the quick menu. Its height is how far it hangs from the ceiling, so a fan on a downrod hangs lower.
## [0.10.0]
### Added
- **Plugins:** NextFloor can now be extended without changing its code. A plugin is a JavaScript file you add on the **Extensions** page (from `/config/www`, HACS or HTTPS). Plugins can add their own light animations (they show up in a light's effect settings), show entities NextFloor does not know (a robot vacuum, a lawn mower) with their own icon and text, and add small cards to a room's panel. A broken plugin never breaks the house view; its errors show next to it on the Extensions page. How to write one: [docs/plugins.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/plugins.md).
- **Sub-meters (advanced energy mode)** by @TheRealSimon42 (#8): a meter can hang off another meter, e.g. one sub-meter per flat behind the house's main meter; solar plants and batteries can hang off a sub-meter, and the house card shows the common rest. Off by default.
- **Configurable light effects** by @TazztheMonster (#9): map a light's effect names to rainbow, pulse, flicker or a static look, or turn animations off for one lamp without changing anything in Home Assistant.
### Changed
- The README credits NeonPlan 3D by Mastershort, the project NextFloor started from.
### Fixed
- Light effects are no longer all shown as a rainbow: plans without a mapping and unknown effects keep the colour and brightness from Home Assistant, pulse and flicker keep the base colour, and lights that are off or unavailable do not animate.
## [0.9.1]
### Changed
- **A pool cuts itself out of the areas around it:** a pool drawn inside a terrace (or a lawn) now leaves a hole there on its own, so the terrace runs around the pool and not over it. Any other area can still do the same with **Cut out of surrounding areas**. The order the areas were drawn in no longer matters: before, only areas drawn *before* the cutting one got the hole. The hole carries no light of the area around it either. Asked for in discussion #6.
### Fixed
- **A folded room panel no longer hangs in the picture:** on a wide window or in landscape the folded panel stayed at the top right and covered the view. It now drops to the bottom edge, above the switches (and to the bottom of the card), so it is out of the way. Reported in discussion #3.
## [0.9.0]
### Added
- **Sloping walls:** every wall in the room's wall list has a new button **Sloping**. It gives the wall a height at its start and another at its end, and the top runs straight between them: a lean-to room, a wall that follows a sloping ceiling, clerestory windows high on the tall side. Both heights may be above the floor height. Windows and doors on such a wall stay under its top, so a window near the high end can be taller than one near the low end. A corner added to a sloping wall splits the slope at the height it has there. Asked for in discussion #4.
- **Outdoor areas can have any shape:** the selected lawn, terrace, pool, fence and so on now shows a **+** in the middle of every edge, like a room. Drag it to add a corner; the corner buttons in the form (**1 ×**, **2 ×** …) take a corner away again. Asked for in discussion #6.
- **Flat roofs can be reshaped the same way:** the **+** on the edges of a flat or parapet roof turns the rectangle into a free shape, and its corners can be added, dragged and removed. (Pitched roofs stay rectangles over their ridge; L- and T-shaped houses are still built from several sections.) Asked for in discussion #6.
- **Turn a solar field on a flat roof:** the solar form has **Rotation** with quick **↺ 90°** and **↻ 90°** buttons. The field turns about its middle, its modules and frames turn with it, and it is kept on the roof. Asked for in discussion #5.
- **Fold the room panel away:** the room panel has a new **−** button next to the ✕. It hides the devices and keeps the room in view, which is what you want on a phone; a tap on the arrow opens it again. The panel starts open for every room. Asked for in discussion #3.
## [0.8.3]
### Fixed
- **Real map showed "Access blocked" (403) instead of the map:** Home Assistant asks the browser to send no Referer to other sites, and OpenStreetMap's tile servers refuse requests without one. NextFloor now loads every map tile with an explicit referrer policy (only your Home Assistant's address, not the full page address), in the plan and in 3D. The tiles are kept in the browser while the map is on.
## [0.8.2]
### Added
- **Room buttons on the dashboard card:** a new switch *Room buttons* in the card editor puts a row of buttons, one per room, along the top of the card. A tap opens the room (switching to its floor first when needed), a second tap closes it. In the house view the rooms of all floors show, grouped by floor. Asked for in discussion #2.
## [0.8.1]
### Fixed
- **Blue light frame around a TV that is on, even with *Glow behind the TV* at 0:** the glow frame that fades out around the screen of a TV that is on ignored the setting. With 0 it is now gone completely, and values below 100 make it weaker. (0.8.0 only removed the bright outline of the TV's body.)
## [0.8.0]
### Added
- **Twelve new furniture packs with 417 models, all built from scratch:** Living room (70), Kitchen (66), Bedroom (41), Bathroom (38), Garden & patio (33), Home cinema & hi-fi (36), Smart home & tech (30), Office & gaming (26), Pets (24), Kids' room (18), Utility & building services (18) and Fitness (17).
- **Existing packs grew:** Vehicles now has cars of every class, vans, a pickup, a campervan, a motorhome and a caravan (34); Stairs & railings has floating and winder stairs and a corner railing (13); Architecture & fit-out has steel columns, ceiling beams, niches, a light cove, a window seat and more (21); Garage & workshop has a tool wall, shelving, a mower, wallbox holder and more (22).
- Every model is visible in the demo's showcase.
- **Compass control:** under Settings a dial shows where north lies, with **Swap north ↔ south** (180°) and quarter turns. Turning the compass never moves the drawing, the roof faces or the solar fields; sunlight, wind and the compass directions of roof faces follow it. So a plan drawn the wrong way round is fixed in one tap, without placing the solar fields again.
- **Real map under the plan (off by default):** a dimmed OpenStreetMap (or your own tile address) lies under the plan in the editor and under the house in 3D, turned by the compass. Start at Home Assistant's location, set the visibility and detail level, and move the map with arrow buttons until the house sits on its plot. Nothing is loaded while it is off.
### Fixed
- **TV without glow still had a blue frame:** with *Glow behind the TV* set to 0 the TV's own bright blue outline stayed. It now takes the plain furniture outline, so a TV set to no glow is not lit at all.
### Changed
- **Guide rewritten:** `docs/manual.md` and `docs/anleitung.md` are new, organised by what you do (install, draw, furnish, connect, use) instead of by feature list, and match the current features.
- **Demo of the development version:** the online demo now has a second page under `/dev/` that always shows the latest state of the `dev` branch (marked "DEV"); the normal demo keeps showing the released version.
- **Cameras are gone:** the camera wall, flying into a camera's live picture, the motion trail, detection pins, the field-of-view wedge and the camera device kind were removed. Placed `camera.*` entities are no longer shown.
- **Extensions tab:** it now only holds the upload of your own 3D models and the project links. The feature list and the furniture pack list are gone, and so is the hint box in the furniture library.
## [0.7.0]
### Added
- **Three new free furniture packs**, all built from scratch in NextFloor's own part format:
- **Treppen & Geländer (10):** straight, L-shaped, U-shaped, spiral and space-saving staircases, landing, outdoor steps and railings in metal, glass and wood. The staircases cut their opening into the floor above.
- **Architektur & Ausbau (10):** round and square columns, ceiling beam, chimney breast, glass partition, sliding wall, raised platform, half wall, shelving divider and pilaster.
- **Garage & Werkstatt (9):** workbench, tool cabinet and trolley, storage rack, stack of tyres, drill press, compressor, bicycle stand and paint cabinet.
- All three appear in the demo's model showcase.
## [0.6.3]
### Added
- **Model showcase in the online demo:** every model of NextFloor, the basic ones and those of all packs, can be looked at live in a room of their own, ten at a time, with the names listed in the order they stand. Open the demo and choose "All models" (bottom right), or use `?showcase`.
### Changed
- **Languages:** NextFloor now comes in German and English only; Home Assistant instances in any other language show English. The 14 further language files were removed.
### Fixed
- The online demo no longer fails to deploy on a release (it deploys when the demo changes on `main`).
- A formatting slip in the Python code that made the checks fail.
## [0.6.2]
### Added
- **Glow behind the TV:** a TV, monitor or TV board has a new setting "Glow behind the TV (%)" in the editor. 0 switches the blue ambilight off (handy with LED strips on the TV), 100 is the usual strength, up to 150.
## [0.6.1]
### Fixed
- **Camera wall:** the pictures are now tiles of a sensible size (at most 560 px wide, as many per row as fit, centred) instead of one picture stretched over the whole screen when there is a single camera. Tiles lift slightly when you point at them.
## [0.6.0]
### Added
- **Upload 3D models in the app:** on the Extensions page every item that takes a model has an "Add a model" button. Choose the `.glb`, turn the front towards you, tick the body paint (guessed for you), pick the level of detail, check the preview and store it on your Home Assistant. NextFloor does the work of `tools/prepare-model.mjs` itself: it merges the parts, makes the model lighter, writes plain glTF without textures and marks the paint. Files that are compressed (Draco, Meshopt) are refused with a hint. You can replace and remove models there too.
### Changed
- The editor, the side panel, the dashboard card and parts of the 3D view were reorganised internally into smaller, tested modules. Behaviour and look are unchanged.
- The README is shorter, with a feature table and a screenshot gallery.
## [0.5.0]
- **Twelve Tesla models:** Model 3 (to 2023, 2024 and Performance), Model S and S Plaid, Model X, Model Y (2020 to 2024, 2025 Standard, Premium and Performance, and Model Y L) and the Cybertruck are separate items, each ready for its own 3D model, in the paint colours Tesla offers. Without a model file on your Home Assistant they show the simple shape.
- `tools/prepare-model.mjs` can leave out see-through fade layers and light beams (`--drop-materials`) and finds the front of the car by its charge port (`--rear`).
## [0.4.0]
- **Paint colours for vehicles:** every Tesla has the paint colours Tesla offers (Pearl White, Solid Black, Deep Blue, Ultra Red, Quicksilver and more; the Cybertruck its steel and wraps). Pick the colour in the editor, also for a car in a parking spot.
- **Your own 3D models:** put a model you own (`.glb`) on your Home Assistant and NextFloor draws it in place of the simple shape, with the paint colour you picked. The Tesla Model Y is the first item that takes one. NextFloor ships no model files; see [docs/models.md](docs/models.md) for how to prepare and add yours.
## [0.3.0]
- **IKEA sizes:** a new furniture pack with 20 popular pieces in their published outer dimensions: bookcases, cube shelves, beds, chests of drawers, wardrobes, sofas, an armchair, a desk, tables and more. They are our own simple models of the sizes, not IKEA's designs or files.
## [0.2.0]
- **Tesla models in 3D:** Model S, 3, X, Y, Cybertruck, Roadster and Semi in the vehicles pack, with their real outer dimensions. Put one on a parking spot and the car card follows it.
- **Smooth bodies for packs:** a new part shape, `sweep`, stretches a rounded skin over cross sections along the length. The Teslas are built with it; the format is described in [docs/packs.md](docs/packs.md).
## [0.1.0]
The first release.
- Draw your home right inside Home Assistant: floors, rooms, walls, doors, windows, stairs, outdoor areas and a roof, with a 3D view next to the plan.
- Control it in 3D: lamps glow in their colours, blinds and doors follow their state, a room panel lists everything of the area.
- Ten built-in furniture packs (about 100 items) plus your own packs as plain JSON ([docs/packs.md](docs/packs.md)).
- Six live features: weather at the house, energy flow, TV screens, sound, car and cameras (camera wall, detection pins, motion trail).
- A dashboard card with a visual editor, three looks, kiosk mode for wall tablets, warnings for smoke, gas, water and open windows in the rain.
- English and German in the box, fourteen more languages fetched on demand.
- Free and open source, no account, no cloud: NextFloor does not talk to the internet.
[Unreleased]: https://github.com/therealMRBK/NextFloor/compare/v0.26.6...main
[0.26.6]: https://github.com/therealMRBK/NextFloor/compare/v0.26.5...v0.26.6
[0.26.5]: https://github.com/therealMRBK/NextFloor/compare/v0.26.4...v0.26.5
[0.25.4]: https://github.com/therealMRBK/NextFloor/compare/v0.25.3...v0.25.4
[0.25.3]: https://github.com/therealMRBK/NextFloor/compare/v0.25.2...v0.25.3
[0.25.2]: https://github.com/therealMRBK/NextFloor/compare/v0.25.1...v0.25.2
[0.25.1]: https://github.com/therealMRBK/NextFloor/compare/v0.25.0...v0.25.1
[0.25.0]: https://github.com/therealMRBK/NextFloor/compare/v0.24.0...v0.25.0
[0.24.0]: https://github.com/therealMRBK/NextFloor/compare/v0.23.1...v0.24.0
[0.23.1]: https://github.com/therealMRBK/NextFloor/compare/v0.23.0...v0.23.1
[0.23.0]: https://github.com/therealMRBK/NextFloor/compare/v0.22.0...v0.23.0
[0.22.0]: https://github.com/therealMRBK/NextFloor/compare/v0.21.0...v0.22.0
[0.21.0]: https://github.com/therealMRBK/NextFloor/compare/v0.20.0...v0.21.0
[0.20.0]: https://github.com/therealMRBK/NextFloor/compare/v0.17.0...v0.20.0
[0.17.0]: https://github.com/therealMRBK/NextFloor/compare/v0.16.1...v0.17.0
[0.16.1]: https://github.com/therealMRBK/NextFloor/compare/v0.16.0...v0.16.1
[0.16.0]: https://github.com/therealMRBK/NextFloor/compare/v0.15.0...v0.16.0
[0.15.0]: https://github.com/therealMRBK/NextFloor/compare/v0.14.0...v0.15.0
[0.14.0]: https://github.com/therealMRBK/NextFloor/compare/v0.13.0...v0.14.0
[0.13.0]: https://github.com/therealMRBK/NextFloor/compare/v0.12.0...v0.13.0
[0.12.0]: https://github.com/therealMRBK/NextFloor/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/therealMRBK/NextFloor/compare/v0.10.0...v0.11.0
[0.10.0]: https://github.com/therealMRBK/NextFloor/compare/v0.9.1...v0.10.0
[0.9.1]: https://github.com/therealMRBK/NextFloor/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/therealMRBK/NextFloor/compare/v0.8.3...v0.9.0
[0.8.3]: https://github.com/therealMRBK/NextFloor/compare/v0.8.2...v0.8.3
[0.8.2]: https://github.com/therealMRBK/NextFloor/compare/v0.8.1...v0.8.2
[0.8.1]: https://github.com/therealMRBK/NextFloor/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/therealMRBK/NextFloor/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/therealMRBK/NextFloor/compare/v0.6.3...v0.7.0
[0.6.3]: https://github.com/therealMRBK/NextFloor/compare/v0.6.2...v0.6.3
[0.6.2]: https://github.com/therealMRBK/NextFloor/compare/v0.6.1...v0.6.2
[0.6.1]: https://github.com/therealMRBK/NextFloor/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/therealMRBK/NextFloor/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/therealMRBK/NextFloor/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/therealMRBK/NextFloor/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/therealMRBK/NextFloor/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/therealMRBK/NextFloor/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/therealMRBK/NextFloor/releases/tag/v0.1.0
-18
View File
@@ -1,18 +0,0 @@
# NextFloor – notes for Claude
- Spec and phase plan: `docs/plan.md` (German). Talk to the user in German; code, identifiers and comments in English.
- Domain `nextfloor`, repo `therealMRBK/NextFloor`, minimum Home Assistant 2025.1.
- Frontend lives in `frontend/` (Lit 3 + TypeScript, no decorators; three.js in a separate lazily loaded bundle).
Bundles are committed to `custom_components/nextfloor/frontend/`, and CI fails when they are stale, so run `npm run build` before committing.
- Checks: `npm test`, `npm run typecheck`, `npm run build` (size budgets), `ruff check` / `ruff format`.
HA integration tests only run in the Linux CI.
- Visual self-check: `npm run screenshot` renders `preview/index.html` (invented demo data, mock hass) into `preview/screenshots/`.
- Deploy to the user's HA: `npm run deploy` (target in the untracked `deploy.local.json`). Never commit real floor plans, IPs or device names.
- **Branches:** work happens on `dev` (CI runs there too). `main` is what HACS users receive, so it only moves about once a day or after a bigger batch of features: merge `dev` into `main` (fast-forward), bump `manifest.json`, write the changelog section and cut the GitHub release then, not per commit. Never push single small changes straight to `main`.
- After each phase: commit and push to `dev`, check CI, and tell the user in German what is new and how to test it. Only a release (merge to `main`) is published.
- **Changelog:** every change that reaches users goes into `CHANGELOG.md` in the same commit, under the version it ships in, sorted into **Added**, **Changed** and **Fixed** (bump `manifest.json` when a release is cut). Say what the user notices, not what the code did. Use the same text for the GitHub release notes.
- **README is shown inside HACS too, which does not resolve relative paths:** keep every image and link in `README.md` absolute (`raw.githubusercontent.com/therealMRBK/NextFloor/main/…` for images, `github.com/therealMRBK/NextFloor/blob/main/…` for files).
- **Token economy:** when a symbol or string is known, use a targeted `grep -rn` (graphify only for "where does X live" questions); `graphify update .` after code changes. No broad exploration when the scope is clear: read only the lines you need. While developing, run only the affected test file (`npx tsx --test src/<file>.test.ts`); the full gate (typecheck, tests, build, ruff, HA tests) runs once before each commit, with its output filtered to pass/fail lines. Do not spawn subagents for work that fits in a few commands. Do not take screenshots unless the change is visual and the check can answer a concrete question.
- **Quality rules (as in good open-source projects):** commits as Conventional Commits (`feat:`, `fix:`, `docs:`, `build:`, `test:`); larger features on a branch with a pull request, small fixes straight to `dev`; version numbers as in `CONTRIBUTING.md` → *Version numbers* (decided with the user 2026-11-08): `0.MINOR.PATCH.HOTFIX` — a fourth part only for a fix of a reported bug on top of the current release (hotfix branch from the tag, PR into `main`, then merge `main` back into `dev`), patch for the usual collected release, minor for a topic release or anything users must act on; the gate also runs `mypy custom_components/nextfloor`; `main` is protected (CI must be green, no force-push); a release is cut only with the user's go and needs tag = manifest version (the release workflow checks it and attaches `nextfloor.zip`); security reports go through the private advisory, never a public issue.
-7
View File
@@ -1,7 +0,0 @@
# Code of conduct
This project follows the [Contributor Covenant 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
In short: be kind and patient, assume good faith, keep criticism about the work and not the person, and no harassment of any kind. Issues, pull requests and discussions that break this can be edited, locked or removed.
To report a problem, contact the maintainer through a private message on GitHub (@therealMRBK). Reports are handled confidentially.
-53
View File
@@ -1,53 +0,0 @@
# Contributing
Thanks for looking. NextFloor is free and open source out of conviction, and every contribution keeps it that way: whatever you add belongs to everyone, under the MIT licence. It is a small project and is built with AI assistance (see the README), so contributions are welcome the same way: written by you, with a tool, or both. Please just say in the pull request if an AI wrote a good part of it, and make sure you have understood and run what you send.
## Before a pull request
```bash
cd frontend
npm install
npm run typecheck
npm test
npm run build # the built bundles are committed; CI fails when they are stale
cd ..
ruff check . && ruff format --check .
pytest -q # the Home Assistant side
```
- Keep a change small and say what it is for. A screenshot helps for anything you can see (`npm run screenshot` renders the preview).
- New furniture or vehicles: the built-in packs come from `tools/build_packs.py`; the format of your own packs is in [docs/packs.md](docs/packs.md). Please only use sizes and shapes you made yourself, never another project's files or a brand's own 3D models.
- 3D models you own (for example a car): they stay on your own Home Assistant and never go into this repository, see [docs/models.md](docs/models.md).
## How changes flow
- Work happens on `dev`; `main` is what HACS users receive and only moves with a release. Larger features are developed on a branch and merged through a pull request, so CI runs before the merge.
- Commit messages: a short summary in the style `feat: …`, `fix: …`, `docs: …`, `build: …`, `test: …` (Conventional Commits), with the issue number when there is one.
- Every user-visible change goes into `CHANGELOG.md` under **Unreleased** in the same commit.
- A release: `manifest.json` version, the changelog section, a tag `v<version>` on `main` and a GitHub release with the changelog text. The release workflow then attaches `nextfloor.zip`, which HACS installs.
## Version numbers
Versions read `0.MINOR.PATCH` or `0.MINOR.PATCH.HOTFIX`. The number tells what an update brings:
| Part | Example | When |
| --- | --- | --- |
| **Hotfix** | 0.26.5 → 0.26.5.1 | A bug reported in an issue that breaks something in the current release. The hotfix holds that fix only, nothing else from `dev`. |
| **Patch** | 0.26.5.x → 0.26.6 | The usual release: fixes and small additions collected on `dev`, nothing anyone has to change. The hotfix part is dropped again. |
| **Minor** | 0.26.x → 0.27.0 | A planned release around one big topic, or anything users have to act on: a storage migration, a removed or renamed option, changed card YAML. Rule of thumb: if someone has to do or relearn something after the update, it is a minor. |
| **Major** | 1.0.0 | Once, when storage format, card YAML and plugin API are stable and documented, and no known bug loses data or crashes. |
- A wish or an improvement is never a hotfix, even when it comes as an issue: it ships with the next patch.
- **A hotfix:** branch `hotfix/<version>` from the release tag, the fix and its changelog section `## [<version>]`, a pull request into `main`, then the release. Afterwards `main` is merged into `dev`, so the next release is a fast-forward again. The fix lands on `dev` as well and is part of the next patch.
- Before a minor, a pre-release `0.27.0-beta.1` can go out on GitHub for those who switched on betas.
- Counted on their own, not with the app version: the plugin API (`apiVersion`) only climbs when plugins would break, and a change of the stored plan format always means a minor.
- Home Assistant and HACS accept and sort the four-part numbers (0.26.5 < 0.26.5.1 < 0.26.5.10 < 0.26.6).
- Security problems go through [private reporting](SECURITY.md), not a public issue.
## Translations
German and English are built in. Further languages are files in `frontend/lang/<code>.json` (keys as in `frontend/src/i18n.ts`), fetched only when Home Assistant runs in that language; a key a file lacks shows in English. They are community-maintained: new texts land in German and English first. Pack items and paint colours are named under `pack:<pack>:<item>`, `packname:<pack>` and `color:<colour>`. The integration's own texts are in `custom_components/nextfloor/translations/`.
## Ideas and bugs
[Discussions](https://github.com/therealMRBK/NextFloor/discussions) for ideas and questions, [issues](https://github.com/therealMRBK/NextFloor/issues/new/choose) for bugs. For a bug, the version, your Home Assistant version and what you expected help most.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4296,7 +4296,7 @@ vNfTile = tile;`,xR=`#ifdef USE_MAP
vec4 sampledDiffuseColor = textureGrad(map, nfUv, dFdx(vMapUv) / vec2(3.0, 2.0), dFdy(vMapUv) / vec2(3.0, 2.0));
diffuseColor *= sampledDiffuseColor;
#endif`;function bR(i){let e=new Ke({map:i,transparent:!0,blending:Ft,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2});return e.onBeforeCompile=t=>{t.vertexShader=t.vertexShader.replace("#include <common>",mR).replace("#include <begin_vertex>",gR),t.fragmentShader=t.fragmentShader.replace("#include <common>",`#include <common>
varying vec2 vNfTile;`).replace("#include <map_fragment>",xR)},e.customProgramCacheKey=()=>"nf-pattern",e}var qu=(i={})=>new Ke({vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1,...i});function Ty({mask:i,look:e,theme:t,textures:n}){let r=(o={})=>new Ke({vertexColors:!0,...o}),s=(o,a)=>My(o,i,a);return{floor:Zn(r(),e),pattern:bR(n.pattern),wall:Zn(s(r(),"solid"),e),glassWall:s(r({transparent:!0,depthWrite:!1}),"glass"),shadow:r({blending:za,premultipliedAlpha:!0,transparent:!0,depthWrite:!1,side:ut,polygonOffset:!0,polygonOffsetFactor:-1}),lines:Zn(s(new Lt({vertexColors:!0,transparent:!0,blending:xl(t),depthWrite:!1})),e,!0),glow:s(qu({side:ut,polygonOffset:!0,polygonOffsetFactor:-3}),"solid"),frames:Zn(s(r({side:ut})),e),glass:s(qu({side:ut})),blinds:Zn(s(r({map:n.blinds,side:ut})),e),lamps:Zn(r(),e),halos:new cn({map:n.halo,size:.9,sizeAttenuation:!0,vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1}),cones:qu({side:ut}),screens:qu({side:ut}),ghosts:[]}}var $u=i=>Object.assign(document.createElement("span"),{className:i});function Ay(i,e){let t=Object.assign(document.createElement("button"),{className:"nf-dev"});t.dataset.entity=i,t.append($u("nf-dev-icon"),$u("nf-dev-text"),$u("nf-dev-watt"),$u("nf-dev-name"));let n,r=!1,s=a=>{let{x:l,y:c}=e.centre(t);a(i,l,c)},o=()=>clearTimeout(n);t.addEventListener("pointerdown",a=>{if(e.furnishing())return e.pressedWhileFurnishing(i);a.stopPropagation(),r=!1,o(),n=setTimeout(()=>{r=!0,s(e.hold)},500)});for(let a of["pointerleave","pointercancel","pointerup"])t.addEventListener(a,o);return t.addEventListener("contextmenu",a=>a.preventDefault()),t.addEventListener("click",a=>{if(a.stopPropagation(),e.furnishing())return e.selectWhileFurnishing(i);r||s(e.tap)}),t.addEventListener("keydown",a=>{(a.key==="Enter"&&a.shiftKey||a.key==="ContextMenu")&&(a.preventDefault(),s(e.hold))}),t}function Ey(i,e=10,t="NextFloor"){let n=[];for(let{positions:o,lift:a}of i)for(let l=0;l+8<o.length;l+=9){let c=[0,3,6].map(x=>[o[l+x]*e,-o[l+x+2]*e,(o[l+x+1]+a)*e]),[u,h,f]=c,d=[(h[1]-u[1])*(f[2]-u[2])-(h[2]-u[2])*(f[1]-u[1]),(h[2]-u[2])*(f[0]-u[0])-(h[0]-u[0])*(f[2]-u[2]),(h[0]-u[0])*(f[1]-u[1])-(h[1]-u[1])*(f[0]-u[0])],p=Math.hypot(d[0],d[1],d[2]);p<1e-9||n.push([d[0]/p,d[1]/p,d[2]/p,...u,...h,...f])}let r=new Uint8Array(84+n.length*50),s=new DataView(r.buffer);return r.set(new TextEncoder().encode(`${t} STL`.slice(0,79)),0),s.setUint32(80,n.length,!0),n.forEach((o,a)=>{let l=84+a*50;o.forEach((c,u)=>s.setFloat32(l+u*4,c,!0))}),r}var Rs=Math.PI/180;function Ry(i,e,t){let n=i.getTime()/864e5-10957.5,r=(357.529+.98560028*n)*Rs,o=(280.459+.98564736*n+1.915*Math.sin(r)+.02*Math.sin(2*r))*Rs,a=(23.439-36e-8*n)*Rs,l=Math.atan2(Math.cos(a)*Math.sin(o),Math.cos(o)),c=Math.asin(Math.sin(a)*Math.sin(o)),h=(((18.697374558+24.06570982441908*n)%24+24)%24*15+t)*Rs-l,f=e*Rs,d=Math.asin(Math.sin(f)*Math.sin(c)+Math.cos(f)*Math.cos(c)*Math.cos(h)),p=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(f)-Math.tan(c)*Math.cos(f))/Rs+180;return{elevation:d/Rs,azimuth:(p%360+360)%360}}function fp(i,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(i)).map(n=>[n.type,Number(n.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function Cy(i,e,t=new Date){let[n,r]=[Math.floor(i),Math.round(i%1*60)];if(e)try{let o=new Date(fp(t.getTime(),e)),a=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),n,r),l=a-(fp(a,e)-a);return l=a-(fp(l,e)-l),new Date(l)}catch{}let s=new Date(t);return s.setHours(n,r,0,0),s}function yR(i,e=new Date){let t=[];for(let n=0;n<=24;n+=.25){let r=Ry(Cy(Math.min(n,23.99),i.zone,e),i.latitude,i.longitude);r.elevation<0||t.push(Py(i,r))}return t}function Py(i,e){let[t,n]=Lo(e.azimuth,i.north),r=Math.max(0,e.elevation)*Math.PI/180;return[i.centre[0]+t*i.radius*Math.cos(r),Math.sin(r)*i.radius*.9,i.centre[1]+n*i.radius*Math.cos(r)]}function _R(i,e){let t=document.createElement("canvas");t.width=t.height=64;let n=t.getContext("2d");n&&(n.font="bold 44px system-ui, sans-serif",n.fillStyle=e,n.textAlign="center",n.textBaseline="middle",n.fillText(i,32,34));let r=new ji(new vi({map:new zt(t),transparent:!0,depthWrite:!1,depthTest:!1}));return r.renderOrder=20,r}var Ku=class{group=new ct;key="";constructor(){this.group.visible=!1,this.group.renderOrder=15}update(e,t,n){let r=e?`${e.centre},${e.radius.toFixed(1)},${e.north},${e.latitude.toFixed(2)},${e.longitude.toFixed(2)},${new Date().toDateString()},${n},${t?`${t.elevation.toFixed(0)},${t.azimuth.toFixed(0)}`:"-"}`:"off";if(r===this.key)return;if(this.key=r,this.clear(),!e){this.group.visible=!1;return}this.group.visible=!0;let s=n+.05,o=[];for(let h=0;h<=96;h++){let f=h/96*Math.PI*2;o.push(e.centre[0]+Math.cos(f)*e.radius,s,e.centre[1]+Math.sin(f)*e.radius)}let a=new Fe;a.setAttribute("position",new ke(o,3)),this.group.add(new Pn(a,new Lt({color:7311304,tra Line truncated
varying vec2 vNfTile;`).replace("#include <map_fragment>",xR)},e.customProgramCacheKey=()=>"nf-pattern",e}var qu=(i={})=>new Ke({vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1,...i});function Ty({mask:i,look:e,theme:t,textures:n}){let r=(o={})=>new Ke({vertexColors:!0,...o}),s=(o,a)=>My(o,i,a);return{floor:Zn(r(),e),pattern:bR(n.pattern),wall:Zn(s(r(),"solid"),e),glassWall:s(r({transparent:!0,depthWrite:!1}),"glass"),shadow:r({blending:za,premultipliedAlpha:!0,transparent:!0,depthWrite:!1,side:ut,polygonOffset:!0,polygonOffsetFactor:-1}),lines:Zn(s(new Lt({vertexColors:!0,transparent:!0,blending:xl(t),depthWrite:!1})),e,!0),glow:s(qu({side:ut,polygonOffset:!0,polygonOffsetFactor:-3}),"solid"),frames:Zn(s(r({side:ut})),e),glass:s(qu({side:ut})),blinds:Zn(s(r({map:n.blinds,side:ut})),e),lamps:Zn(r(),e),halos:new cn({map:n.halo,size:.9,sizeAttenuation:!0,vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1}),cones:qu({side:ut}),screens:qu({side:ut}),ghosts:[]}}var $u=i=>Object.assign(document.createElement("span"),{className:i});function Ay(i,e){let t=Object.assign(document.createElement("button"),{className:"nf-dev"});t.dataset.entity=i,t.append($u("nf-dev-icon"),$u("nf-dev-text"),$u("nf-dev-watt"),$u("nf-dev-name"));let n,r=!1,s=a=>{let{x:l,y:c}=e.centre(t);a(i,l,c)},o=()=>clearTimeout(n);t.addEventListener("pointerdown",a=>{if(e.furnishing())return e.pressedWhileFurnishing(i);a.stopPropagation(),r=!1,o(),n=setTimeout(()=>{r=!0,s(e.hold)},500)});for(let a of["pointerleave","pointercancel","pointerup"])t.addEventListener(a,o);return t.addEventListener("contextmenu",a=>a.preventDefault()),t.addEventListener("click",a=>{if(a.stopPropagation(),e.furnishing())return e.selectWhileFurnishing(i);r||s(e.tap)}),t.addEventListener("keydown",a=>{(a.key==="Enter"&&a.shiftKey||a.key==="ContextMenu")&&(a.preventDefault(),s(e.hold))}),t}function Ey(i,e=10,t="NextFloor"){let n=[];for(let{positions:o,lift:a}of i)for(let l=0;l+8<o.length;l+=9){let c=[0,3,6].map(x=>[o[l+x]*e,-o[l+x+2]*e,(o[l+x+1]+a)*e]),[u,h,f]=c,d=[(h[1]-u[1])*(f[2]-u[2])-(h[2]-u[2])*(f[1]-u[1]),(h[2]-u[2])*(f[0]-u[0])-(h[0]-u[0])*(f[2]-u[2]),(h[0]-u[0])*(f[1]-u[1])-(h[1]-u[1])*(f[0]-u[0])],p=Math.hypot(d[0],d[1],d[2]);p<1e-9||n.push([d[0]/p,d[1]/p,d[2]/p,...u,...h,...f])}let r=new Uint8Array(84+n.length*50),s=new DataView(r.buffer);return r.set(new TextEncoder().encode(`${t} STL`.slice(0,79)),0),s.setUint32(80,n.length,!0),n.forEach((o,a)=>{let l=84+a*50;o.forEach((c,u)=>s.setFloat32(l+u*4,c,!0))}),r}var Rs=Math.PI/180;function Ry(i,e,t){let n=i.getTime()/864e5-10957.5,r=(357.529+.98560028*n)*Rs,o=(280.459+.98564736*n+1.915*Math.sin(r)+.02*Math.sin(2*r))*Rs,a=(23.439-36e-8*n)*Rs,l=Math.atan2(Math.cos(a)*Math.sin(o),Math.cos(o)),c=Math.asin(Math.sin(a)*Math.sin(o)),h=(((18.697374558+24.06570982441908*n)%24+24)%24*15+t)*Rs-l,f=e*Rs,d=Math.asin(Math.sin(f)*Math.sin(c)+Math.cos(f)*Math.cos(c)*Math.cos(h)),p=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(f)-Math.tan(c)*Math.cos(f))/Rs+180;return{elevation:d/Rs,azimuth:(p%360+360)%360}}function fp(i,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(i)).map(n=>[n.type,Number(n.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function Cy(i,e,t=new Date){let[n,r]=[Math.floor(i),Math.round(i%1*60)];if(e)try{let o=new Date(fp(t.getTime(),e)),a=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),n,r),l=a-(fp(a,e)-a);return l=a-(fp(l,e)-l),new Date(l)}catch{}let s=new Date(t);return s.setHours(n,r,0,0),s}function yR(i,e=new Date){let t=[];for(let n=0;n<=24;n+=.25){let r=Ry(Cy(Math.min(n,23.99),i.zone,e),i.latitude,i.longitude);r.elevation<0||t.push(Py(i,r))}return t}function Py(i,e){let[t,n]=Lo(e.azimuth,i.north),r=Math.max(0,e.elevation)*Math.PI/180;return[i.centre[0]+t*i.radius*Math.cos(r),Math.sin(r)*i.radius*.9,i.centre[1]+n*i.radius*Math.cos(r)]}function _R(i,e){let t=document.createElement("canvas");t.width=t.height=64;let n=t.getContext("2d");n&&(n.font="bold 44px system-ui, sans-serif",n.fillStyle=e,n.textAlign="center",n.textBaseline="middle",n.fillText(i,32,34));let r=new ji(new vi({map:new zt(t),transparent:!0,depthWrite:!1,depthTest:!1}));return r.renderOrder=20,r}var Ku=class{group=new ct;key="";constructor(){this.group.visible=!1,this.group.renderOrder=15}update(e,t,n){let r=e?`${e.centre},${e.radius.toFixed(1)},${e.north},${e.latitude.toFixed(2)},${e.longitude.toFixed(2)},${new Date().toDateString()},${n},${t?`${t.elevation.toFixed(0)},${t.azimuth.toFixed(0)}`:"-"}`:"off";if(r===this.key)return;if(this.key=r,this.clear(),!e){this.group.visible=!1;return}this.group.visible=!0;let s=n+.05,o=[];for(let h=0;h<=96;h++){let f=h/96*Math.PI*2;o.push(e.centre[0]+Math.cos(f)*e.radius,s,e.centre[1]+Math.sin(f)*e.radius)}let a=new Fe;a.setAttribute("position",new ke(o,3)),this.group.add(new Pn(a,new Lt({color:7311304,tra Line truncated
/*! Bundled license information:
three/build/three.core.js:
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==U)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,U),V=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,U)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ue}=Object,C=globalThis,ge=C.trustedTypes,Ve=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ve:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=be){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ue(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=x;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===x?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??x,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=x:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===x?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],H()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],H())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(H()),this.O(H()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=be){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,W=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=W;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===W?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??W,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=W:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===W?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],x()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],x())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=H(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),H(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&H(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(x()),this.O(x()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),se=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
@@ -22,7 +22,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
<select @change=${a=>i.set(e,O(a)==="switch"?void 0:O(a)==="on")}>
${o.map(([a,s])=>l`<option value=${a} ?selected=${r===a}>${i.t(s)}</option>`)}
</select>
</label>`}var Pe=V`
</label>`}var Pe=U`
:host {
display: block;
color: var(--primary-text-color);
@@ -115,7 +115,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
grid-template-columns: 1fr;
}
}
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,He(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,xe(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
<legend>${this.form.t("card_rooms")}</legend>
<small>${this.form.t("card_rooms_hint")}</small>
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
@@ -190,7 +190,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
</div>`:d}
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
${We.map(r=>l`<label class="field"
${He.map(r=>l`<label class="field"
>${e.t(`furn_color_${r}`)}
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,5 +1,5 @@
{
"$schema": "https://www.symcon.de/assets/files/validation/form.json",
"$schema": "https://www.symcon.de/assets/files/validation/formSchema.json",
"elements": [
{
"type": "ValidationTextBox",
@@ -12,6 +12,12 @@
}
],
"actions": [
{
"type": "Button",
"caption": "WebHook reparieren",
"onClick": "echo NFSC_RepairWebHook($id);",
"link": false
},
{
"type": "Button",
"caption": "Designer in der Konsole öffnen",
@@ -27,6 +33,16 @@
}
],
"status": [
{
"code": 104,
"icon": "inactive",
"caption": "Warte auf den Symcon-Start; WebHook wird automatisch registriert"
},
{
"code": 200,
"icon": "error",
"caption": "WebHook-Registrierung fehlgeschlagen – WebHook reparieren oder Log prüfen"
},
{
"code": 102,
"icon": "active",
@@ -1,11 +1,13 @@
{
"$schema": "https://www.symcon.de/assets/files/validation/moduleSchema.json",
"id": "{D5A5129D-C8CF-4535-8EBD-B89A8A6B7DB2}",
"name": "NextFloor",
"type": 6,
"type": 3,
"vendor": "NextFloor",
"aliases": [
"NextFloor Designer und 3D-Kachel"
],
"url": "https://git.portal.se-cloud.de/Hannes/NextFloor/src/branch/main/symcon/README.md",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
@@ -11,10 +11,13 @@ declare(strict_types=1);
*/
class NextFloor extends IPSModuleStrict
{
private const VERSION = '0.1.0';
private const MAX_BUILDING_BYTES = 8_000_000;
private const MAX_IMAGE_BYTES = 8_000_000;
private const MAX_HISTORY = 20;
private const MAX_API_RESPONSE_BYTES = 256 * 1024;
private const TRANSFER_CHUNK_BYTES = 128 * 1024;
private const MAX_TRANSFER_BYTES = 64 * 1024 * 1024;
private const TRANSFER_TTL = 120;
public function Create(): void
{
@@ -27,25 +30,51 @@ class NextFloor extends IPSModuleStrict
$this->RegisterAttributeString('History', '[]');
$this->RegisterAttributeString('AccessToken', '');
$this->RegisterAttributeString('StateHash', '');
$this->RegisterAttributeString('HookError', '');
$this->RegisterAttributeInteger('BuildingRevision', 0);
$this->RegisterAttributeInteger('StateRevision', 0);
$this->RegisterMessage(0, IPS_KERNELSTARTED);
$this->RegisterTimer('WebHookRetry', 0, 'NFSC_RetryWebHook($_IPS[\'TARGET\']);');
$this->ensureAccessToken();
$this->SetVisualizationType(1);
$this->RegisterHook($this->hookPath());
$this->ensureWebHook();
}
public function ApplyChanges(): void
{
parent::ApplyChanges();
$this->SetVisualizationType(1);
$this->RegisterHook($this->hookPath());
$this->SetStatus(102);
$this->ensureWebHook();
}
public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data): void
{
parent::MessageSink($TimeStamp, $SenderID, $Message, $Data);
if ($SenderID === 0 && $Message === IPS_KERNELSTARTED) {
$this->ensureWebHook();
}
}
/** Timer callback; stops itself as soon as the volatile hook has been restored. */
public function RetryWebHook(): void
{
$this->ensureWebHook();
}
/** Explicit recovery from the console without recreating the instance or changing its project. */
public function RepairWebHook(): string
{
if (!$this->ensureWebHook()) {
return $this->hookErrorMessage();
}
return 'WebHook registriert: /hook/' . $this->hookPath() . '. Jetzt den Designer öffnen.';
}
/** URL returned to the console form. It opens in a console tab, as IPSView does. */
public function OpenDesigner(): string
{
$this->requireWebHook();
// `link:` is the documented Form-Button marker for a relative Symcon WebHook URL.
return 'link:' . $this->designerUrl('designer');
}
@@ -53,6 +82,7 @@ class NextFloor extends IPSModuleStrict
/** Invalidates links from copied browser history and returns a fresh designer URL. */
public function RotateAccessToken(): string
{
$this->requireWebHook();
$this->WriteAttributeString('AccessToken', $this->newToken());
return 'link:' . $this->designerUrl('designer');
}
@@ -60,6 +90,10 @@ class NextFloor extends IPSModuleStrict
/** The custom tile is deliberately an iframe: the full 3D viewer can lazy-load its assets via the same protected hook. */
public function GetVisualizationTile(): string
{
if (!$this->ensureWebHook()) {
return '<div style="padding:16px;font-family:system-ui">'
. htmlspecialchars($this->hookErrorMessage(), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '</div>';
}
$src = htmlspecialchars($this->designerUrl('tile'), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
return '<style>html,body{margin:0;width:100%;height:100%;overflow:hidden}iframe{display:block;width:100%;height:100%;min-height:260px;border:0;background:#111}</style>'
. '<iframe title="NextFloor" src="' . $src . '" loading="eager" allow="fullscreen"></iframe>';
@@ -68,7 +102,11 @@ class NextFloor extends IPSModuleStrict
/** IP-Symcon calls this for /hook/nextfloor/<instance id>/... */
protected function ProcessHookData(): void
{
$path = (string) (parse_url((string) ($_SERVER['REQUEST_URI'] ?? ''), PHP_URL_PATH) ?? '');
$requestPath = (string) ($_SERVER['REQUEST_URI'] ?? '');
if ($requestPath === '') {
$requestPath = (string) ($_SERVER['SCRIPT_NAME'] ?? '');
}
$path = (string) (parse_url($requestPath, PHP_URL_PATH) ?? '');
$prefix = '/hook/' . $this->hookPath();
if (!str_starts_with($path, $prefix)) {
$this->sendError(404, 'not_found');
@@ -102,6 +140,53 @@ class NextFloor extends IPSModuleStrict
// --------------------------------------------------------------------- WebHook pages
private function ensureWebHook(): bool
{
// Native hooks are volatile. Create/ApplyChanges can run before WebHook Control is ready;
// register again after the kernel has started and whenever a designer/tile link is requested.
if (IPS_GetKernelRunlevel() !== KR_READY) {
$this->SetStatus(104);
$this->SetTimerInterval('WebHookRetry', 5000);
return false;
}
try {
$registered = $this->RegisterHook($this->hookPath());
// Older native implementations return void; an explicit false reports rejection.
if ($registered === false) {
throw new RuntimeException('Symcon hat die Registrierung von /hook/' . $this->hookPath() . ' abgelehnt.');
}
} catch (Throwable $error) {
$message = $error->getMessage();
if ($message !== $this->ReadAttributeString('HookError')) {
$this->LogMessage('WebHook-Registrierung fehlgeschlagen: ' . $message, KL_ERROR);
}
$this->WriteAttributeString('HookError', $message);
$this->SetStatus(200);
$this->SetTimerInterval('WebHookRetry', 5000);
return false;
}
$this->WriteAttributeString('HookError', '');
$this->SetTimerInterval('WebHookRetry', 0);
$this->SetStatus(102);
return true;
}
private function requireWebHook(): void
{
if (!$this->ensureWebHook()) {
throw new RuntimeException($this->hookErrorMessage());
}
}
private function hookErrorMessage(): string
{
if (IPS_GetKernelRunlevel() !== KR_READY) {
return 'IP-Symcon startet noch. Der NextFloor-WebHook wird nach dem Start automatisch registriert.';
}
return 'NextFloor-WebHook nicht verfügbar: ' . $this->ReadAttributeString('HookError')
. ' Bitte in der NextFloor-Instanz „WebHook reparieren“ ausführen.';
}
private function hookPath(): string
{
return 'nextfloor/' . $this->InstanceID;
@@ -160,7 +245,8 @@ class NextFloor extends IPSModuleStrict
'language' => 'de',
'title' => $this->ReadPropertyString('Title') ?: 'NextFloor'
];
$asset = '/hook/' . $this->hookPath() . '/assets/nextfloor-designer.js?token=' . rawurlencode($this->ensureAccessToken());
$asset = '/hook/' . $this->hookPath() . '/assets/nextfloor-designer.js?v=' . rawurlencode($this->moduleVersion())
. '&token=' . rawurlencode($this->ensureAccessToken());
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-store');
echo '<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">'
@@ -206,7 +292,7 @@ class NextFloor extends IPSModuleStrict
$result = match ($request['action']) {
'bootstrap' => $this->bootstrap(),
'variables/snapshot' => $this->variablesSnapshot((int) ($request['revision'] ?? -1)),
'building/get' => ['building' => $this->building(), 'revision' => $this->ReadAttributeInteger('BuildingRevision'), 'version' => self::VERSION],
'building/get' => ['building' => $this->building(), 'revision' => $this->ReadAttributeInteger('BuildingRevision'), 'version' => $this->moduleVersion()],
'building/save' => ['revision' => $this->saveBuilding($this->arrayValue($request, 'building'))],
'image/get' => $this->imageGet((string) ($request['image_id'] ?? '')),
'image/set' => $this->imageSet((string) ($request['image_id'] ?? ''), (string) ($request['data'] ?? '')),
@@ -222,9 +308,11 @@ class NextFloor extends IPSModuleStrict
'backup/export' => ['format' => 'nextfloor-backup', 'version' => 1, 'building' => $this->building(), 'packs' => $this->importedPacks()],
'backup/import' => $this->backupImport($this->arrayValue($request, 'building'), $request['packs'] ?? []),
'variables/action' => $this->variableAction((string) ($request['domain'] ?? ''), (string) ($request['service'] ?? ''), $this->arrayValue($request, 'data')),
'transport/read' => $this->readTransfer((string) ($request['transfer_id'] ?? ''), (int) ($request['index'] ?? -1)),
'transport/release' => $this->releaseTransfer((string) ($request['transfer_id'] ?? '')),
default => throw new RuntimeException('unknown_action')
};
$this->sendJson($result);
$this->sendApiResult($result, ($request['transport'] ?? '') === 'nextfloor-chunks-v1');
} catch (InvalidArgumentException $error) {
$this->sendError(400, $error->getMessage());
} catch (RuntimeException $error) {
@@ -240,7 +328,8 @@ class NextFloor extends IPSModuleStrict
'state_revision' => $stateRevision,
'building_revision' => $this->ReadAttributeInteger('BuildingRevision'),
'variables' => $objects['variables'],
'areas' => $objects['areas']
'areas' => $objects['areas'],
'objects' => $objects['objects']
];
}
@@ -255,24 +344,40 @@ class NextFloor extends IPSModuleStrict
if ($stateRevision !== $knownRevision) {
$result['variables'] = $objects['variables'];
$result['areas'] = $objects['areas'];
$result['objects'] = $objects['objects'];
}
return $result;
}
/** Returns every selectable variable and every category that can serve as a room area. */
/** Export real object nodes, not paths reconstructed from variable names. */
private function objectTree(): array
{
$variables = [];
$areas = [];
$nodes = [];
foreach (IPS_GetChildrenIDs(0) as $child) {
$this->collectObjects($child, [], null, $variables, $areas);
$this->collectObjects($child, [], null, $variables, $areas, $nodes);
}
$byVariable = [];
foreach ($variables as $variable) {
$byVariable[$variable['attributes']['symcon_id']] = $variable['entity_id'];
}
// A link stays at its original position in the tree and selects its target variable.
foreach ($nodes as &$node) {
if ($node['object_type'] === 6) {
$target = (int) IPS_GetLink($node['object_id'])['TargetID'];
if (isset($byVariable[$target])) {
$node['entity_id'] = $byVariable[$target];
}
}
}
unset($node);
usort($variables, static fn(array $a, array $b): int => strnatcasecmp($a['path'], $b['path']));
usort($areas, static fn(array $a, array $b): int => strnatcasecmp($a['name'], $b['name']));
return ['variables' => $variables, 'areas' => $areas];
return ['variables' => $variables, 'areas' => $areas, 'objects' => $nodes];
}
private function collectObjects(int $objectID, array $parents, ?int $nearestCategory, array &$variables, array &$areas): void
private function collectObjects(int $objectID, array $parents, ?int $nearestCategory, array &$variables, array &$areas, array &$nodes): void
{
if (!IPS_ObjectExists($objectID)) {
return;
@@ -281,22 +386,40 @@ class NextFloor extends IPSModuleStrict
$name = IPS_GetName($objectID);
$path = [...$parents, $name];
$type = (int) $object['ObjectType'];
$node = [
'object_id' => $objectID,
'parent_id' => (int) $object['ParentID'],
'name' => $name,
'path' => implode(' / ', $path),
'object_type' => $type,
'position' => (int) $object['ObjectPosition'],
'hidden' => (bool) $object['ObjectIsHidden'],
'icon' => (string) $object['ObjectIcon']
];
if ($type === 1) { // OBJECTTYPE_INSTANCE: the logical console view separates system modules.
$node['module_type'] = (int) IPS_GetInstance($objectID)['ModuleInfo']['ModuleType'];
}
if ($type === 0) { // OBJECTTYPE_CATEGORY
$nearestCategory = $objectID;
$areas[] = ['area_id' => 'symcon-category-' . $objectID, 'name' => implode(' / ', $path)];
}
if ($type === 2) { // OBJECTTYPE_VARIABLE
$variables[] = $this->describeVariable($objectID, $name, implode(' / ', $path), $nearestCategory);
$variable = $this->describeVariable($objectID, $name, implode(' / ', $path), $nearestCategory);
$variables[] = $variable;
$node['entity_id'] = $variable['entity_id'];
}
$nodes[] = $node;
foreach (IPS_GetChildrenIDs($objectID) as $child) {
$this->collectObjects($child, $path, $nearestCategory, $variables, $areas);
$this->collectObjects($child, $path, $nearestCategory, $variables, $areas, $nodes);
}
}
private function describeVariable(int $variableID, string $name, string $path, ?int $categoryID): array
{
$variable = IPS_GetVariable($variableID);
$profile = (string) ($variable['VariableCustomProfile'] ?: $variable['VariableProfile']);
$meta = $this->variableMetadata($variableID, $variable);
$profile = $meta['profile'];
$unit = $meta['unit'];
$value = GetValue($variableID);
$kind = $this->kindFor($variable, $profile, $name . ' ' . $path);
$attributes = [
@@ -306,19 +429,26 @@ class NextFloor extends IPSModuleStrict
'symcon_variable_type' => (int) $variable['VariableType'],
'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) !== 0,
'symcon_formatted' => GetValueFormatted($variableID),
'device_class' => $this->deviceClassFor($profile, $name . ' ' . $path)
'device_class' => $this->deviceClassFor($profile, $name, $unit)
];
$profileData = $profile !== '' && IPS_VariableProfileExists($profile) ? IPS_GetVariableProfile($profile) : null;
if (is_array($profileData) && (string) ($profileData['Suffix'] ?? '') !== '') {
$attributes['unit_of_measurement'] = trim((string) $profileData['Suffix']);
if ($unit !== '') {
$attributes['unit_of_measurement'] = $unit;
}
if (in_array((int) $variable['VariableType'], [1, 2], true)) {
// Keep the actual numeric reading even when legacy name heuristics chose an actuator domain.
// Existing synthetic entity IDs stay stable so saved plan mappings keep working.
$attributes['symcon_numeric_value'] = $value;
$attributes['symcon_min'] = $meta['min'];
$attributes['symcon_max'] = $meta['max'];
$attributes['symcon_step'] = $meta['step'];
}
if ($kind === 'light' && is_numeric($value)) {
$attributes['brightness'] = (int) round(max(0, min(100, (float) $value)) * 2.55);
$attributes['brightness'] = (int) round($this->valuePercent((float) $value, $meta) * 2.55);
$attributes['color_mode'] = 'brightness';
$attributes['supported_color_modes'] = ['brightness'];
}
if ($kind === 'cover' && is_numeric($value)) {
$attributes['current_position'] = max(0, min(100, (int) round((float) $value)));
$attributes['current_position'] = $this->valuePercent((float) $value, $meta);
$attributes['supported_features'] = 4;
}
if ($kind === 'climate' && is_numeric($value)) {
@@ -329,17 +459,55 @@ class NextFloor extends IPSModuleStrict
$attributes['hvac_modes'] = ['off', 'heat'];
$attributes['hvac_action'] = (float) $value > 0 ? 'heating' : 'idle';
}
$state = $this->stateFor($kind, $value);
if (in_array($kind, ['light', 'cover'], true) && is_numeric($value)) {
$on = $this->valuePercent((float) $value, $meta) > 0;
$state = $kind === 'light' ? ($on ? 'on' : 'off') : ($on ? 'open' : 'closed');
}
return [
'entity_id' => $kind . '.' . $variableID,
'name' => $name,
'path' => $path,
'state' => $this->stateFor($kind, $value),
'state' => $state,
'attributes' => $attributes,
'area_id' => $categoryID === null ? null : 'symcon-category-' . $categoryID,
'device_id' => 'symcon-variable-' . $variableID
];
}
/** The effective Symcon 9 presentation takes precedence over an old profile's range and unit. */
private function variableMetadata(int $variableID, array $variable): array
{
$presentation = IPS_GetVariablePresentation($variableID);
$profile = (string) ($presentation['PROFILE'] ?? (($variable['VariableCustomProfile'] ?? '') ?: ($variable['VariableProfile'] ?? '')));
$legacy = $profile !== '' && IPS_VariableProfileExists($profile) ? IPS_GetVariableProfile($profile) : [];
$min = (float) ($presentation['MIN'] ?? $legacy['MinValue'] ?? 0);
$max = (float) ($presentation['MAX'] ?? $legacy['MaxValue'] ?? 100);
if (!is_finite($min) || !is_finite($max) || $max <= $min) {
[$min, $max] = [0.0, 100.0];
}
$step = (float) ($presentation['STEP_SIZE'] ?? $legacy['StepSize'] ?? 0);
return ['profile' => $profile, 'unit' => trim((string) ($presentation['SUFFIX'] ?? $legacy['Suffix'] ?? '')),
'min' => $min, 'max' => $max, 'step' => is_finite($step) && $step > 0 ? $step : 0.0];
}
private function valuePercent(float $value, array $meta): float
{
return max(0, min(100, ($value - $meta['min']) / ($meta['max'] - $meta['min']) * 100));
}
private function percentValue(mixed $percent, array $meta): float
{
if (!is_numeric($percent) || !is_finite((float) $percent)) {
throw new InvalidArgumentException('invalid_control_percentage');
}
$value = $meta['min'] + max(0, min(100, (float) $percent)) / 100 * ($meta['max'] - $meta['min']);
if ($meta['step'] > 0) {
$value = $meta['min'] + round(($value - $meta['min']) / $meta['step']) * $meta['step'];
}
return max($meta['min'], min($meta['max'], $value));
}
private function kindFor(array $variable, string $profile, string $haystack): string
{
$text = mb_strtolower($profile . ' ' . $haystack);
@@ -369,13 +537,24 @@ class NextFloor extends IPSModuleStrict
return 'sensor';
}
private function deviceClassFor(string $profile, string $haystack): string
private function deviceClassFor(string $profile, string $haystack, string $unit = ''): string
{
$text = mb_strtolower($profile . ' ' . $haystack);
$text = str_replace('co₂', 'co2', mb_strtolower($profile . ' ' . $haystack));
$unitClass = match (preg_replace('/[\s\x{00A0}]+/u', '', mb_strtolower($unit))) {
'°c', '°f', '℃', '℉', 'k' => 'temperature',
'ppm' => str_contains($text, 'co2') || str_contains($text, 'co₂') ? 'carbon_dioxide' : '',
'w', 'kw' => 'power',
'lx', 'lux' => 'illuminance',
default => ''
};
if ($unitClass !== '') {
return $unitClass;
}
return match (true) {
str_contains($text, 'temperature') || str_contains($text, 'temperatur') => 'temperature',
str_contains($text, 'humidity') || str_contains($text, 'feuchte') => 'humidity',
str_contains($text, 'humidity') || str_contains($text, 'feucht') => 'humidity',
str_contains($text, 'co2') => 'carbon_dioxide',
str_contains($text, 'illuminance') || str_contains($text, 'beleuchtungsst') => 'illuminance',
str_contains($text, 'watt') || str_contains($text, 'power') || str_contains($text, 'leistung') => 'power',
preg_match('/kontakt|fenster|tür|tuer|motion|bewegung|presence|anwesen/', $text) === 1 => 'opening',
default => ''
@@ -407,7 +586,7 @@ class NextFloor extends IPSModuleStrict
private function stateRevision(array $objects): int
{
$hash = hash('sha256', json_encode($objects, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
$hash = hash('sha256', $this->encodeResponse($objects));
if (!hash_equals($this->ReadAttributeString('StateHash'), $hash)) {
$this->WriteAttributeString('StateHash', $hash);
$this->WriteAttributeInteger('StateRevision', $this->ReadAttributeInteger('StateRevision') + 1);
@@ -631,6 +810,23 @@ class NextFloor extends IPSModuleStrict
{
$variable = IPS_GetVariable($variableID);
$current = GetValue($variableID);
if ($domain === 'cover' && $service === 'stop_cover') {
throw new InvalidArgumentException('cover_stop_not_supported');
}
if (in_array($domain, ['light', 'cover'], true) && in_array((int) $variable['VariableType'], [1, 2], true)) {
$meta = $this->variableMetadata($variableID, $variable);
$percent = match ($service) {
'toggle' => (float) $current > $meta['min'] ? 0 : 100,
'turn_off', 'close_cover', 'close_cover_tilt' => 0,
'set_cover_position' => $data['position'] ?? null,
'set_cover_tilt_position' => $data['tilt_position'] ?? null,
'turn_on' => $data['brightness_pct'] ?? (isset($data['brightness']) ? (float) $data['brightness'] / 2.55 : 100),
'open_cover', 'open_cover_tilt' => 100,
default => throw new InvalidArgumentException('unsupported_control_service')
};
$this->setVariable($variableID, $variable, $this->percentValue($percent, $meta));
return;
}
$value = match ($service) {
'toggle', 'media_play_pause' => is_bool($current) ? !$current : (is_numeric($current) ? ((float) $current > 0 ? 0 : 100) : true),
'turn_on', 'open_cover', 'lock' => $this->onValue($variable, $data),
@@ -685,6 +881,12 @@ class NextFloor extends IPSModuleStrict
// --------------------------------------------------------------------- small helpers
private function moduleVersion(): string
{
$library = json_decode((string) file_get_contents(__DIR__ . '/../library.json'), true, 512, JSON_THROW_ON_ERROR);
return (string) $library['version'];
}
private function arrayValue(array $source, string $key): array
{
if (!is_array($source[$key] ?? null)) {
@@ -706,9 +908,119 @@ class NextFloor extends IPSModuleStrict
private function sendJson(array $data): void
{
$encoded = $this->encodeResponse($data);
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
echo json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
echo $encoded;
}
private function encodeResponse(array $data): string
{
return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE | JSON_THROW_ON_ERROR);
}
/** Never emit a JSON response near the kernel's default 1 MiB PHP output limit. */
private function sendApiResult(array $data, bool $supportsChunks): void
{
$encoded = $this->encodeResponse($data);
if (strlen($encoded) <= self::MAX_API_RESPONSE_BYTES) {
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
echo $encoded;
return;
}
if (!$supportsChunks) {
$this->sendError(409, 'client_update_required: Bitte den Designer neu laden.');
return;
}
$this->sendJson(['_nextfloor_transfer' => $this->createTransfer($encoded)]);
}
/** Large results use private, short-lived snapshots, not the module's size-limited SetBuffer. */
private function transferDirectory(): string
{
$directory = rtrim(sys_get_temp_dir(), '/\\') . DIRECTORY_SEPARATOR . 'nextfloor-transfers-' . $this->InstanceID;
if (is_link($directory) || (!is_dir($directory) && !mkdir($directory, 0700, true) && !is_dir($directory))) {
throw new RuntimeException('transfer_storage_unavailable');
}
return $directory;
}
private function transferFile(string $id): string
{
if (preg_match('/^[a-f0-9]{32}$/D', $id) !== 1) {
throw new InvalidArgumentException('invalid_transfer_id');
}
return $this->transferDirectory() . DIRECTORY_SEPARATOR . $id . '.json';
}
private function createTransfer(string $encoded): array
{
$bytes = strlen($encoded);
if ($bytes > self::MAX_TRANSFER_BYTES) {
throw new InvalidArgumentException('response_too_large');
}
$active = 0;
foreach (glob($this->transferDirectory() . DIRECTORY_SEPARATOR . '*.json') ?: [] as $file) {
if (preg_match('/^[a-f0-9]{32}\.json$/D', basename($file)) !== 1 || is_link($file)) continue;
if ((int) filemtime($file) < time() - self::TRANSFER_TTL) {
unlink($file);
} else {
$active++;
}
}
if ($active >= 8) throw new RuntimeException('transfer_busy: Bitte kurz warten und erneut laden.');
$id = bin2hex(random_bytes(16));
$file = $this->transferFile($id);
$handle = fopen($file, 'xb');
if ($handle === false) throw new RuntimeException('transfer_storage_unavailable');
chmod($file, 0600);
try {
$written = 0;
while ($written < $bytes) {
$count = fwrite($handle, substr($encoded, $written));
if ($count === false || $count === 0) throw new RuntimeException('transfer_write_failed');
$written += $count;
}
} catch (Throwable $error) {
fclose($handle);
unlink($file);
throw $error;
}
fclose($handle);
return ['id' => $id, 'bytes' => $bytes, 'chunk_bytes' => self::TRANSFER_CHUNK_BYTES, 'chunks' => (int) ceil($bytes / self::TRANSFER_CHUNK_BYTES)];
}
private function readTransfer(string $id, int $index): array
{
$file = $this->transferFile($id);
if (!is_file($file) || is_link($file)) throw new RuntimeException('transfer_not_found');
if ((int) filemtime($file) < time() - self::TRANSFER_TTL) {
unlink($file);
throw new RuntimeException('transfer_expired: Bitte erneut laden.');
}
$bytes = (int) filesize($file);
if ($index < 0 || $index >= (int) ceil($bytes / self::TRANSFER_CHUNK_BYTES)) {
throw new InvalidArgumentException('invalid_transfer_index');
}
$handle = fopen($file, 'rb');
if ($handle === false) throw new RuntimeException('transfer_not_found');
try {
if (fseek($handle, $index * self::TRANSFER_CHUNK_BYTES) !== 0) throw new RuntimeException('transfer_read_failed');
$data = fread($handle, self::TRANSFER_CHUNK_BYTES);
if ($data === false) throw new RuntimeException('transfer_read_failed');
} finally {
fclose($handle);
}
touch($file); // Active slow connections keep their immutable snapshot alive.
return ['index' => $index, 'data' => base64_encode($data)];
}
private function releaseTransfer(string $id): array
{
$file = $this->transferFile($id);
if (is_file($file) && !is_link($file)) unlink($file);
return [];
}
private function sendError(int $status, string $error): void
File renamed without changes.
+206 -212
View File
@@ -1,230 +1,224 @@
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/custom_components/nextfloor/brand/icon@2x.png" width="110" alt="NextFloor logo"></p>
# NextFloor für IP-Symcon 9.0
<h1 align="center">NextFloor</h1>
Dieses Verzeichnis ist eine vollständige IP-Symcon-Bibliothek. Der gleiche NextFloor-Designer
läuft damit in zwei Symcon-Oberflächen:
<p align="center"><b>Draw your home once. Watch it live in 3D.</b><br>
Lamps light their room, blinds move, doors open, the TV shows what plays, rain falls outside.<br>
A free 3D floor plan for Home Assistant. No cloud, no account. Made for wall tablets.</p>
- **Designer:** Die Instanzkonfiguration öffnet den Designer per geschütztem WebHook in einem
eigenen Konsolen-/Browser-Tab – derselbe Ansatz, den auch IPSView für seinen Designer nutzt.
- **Kachel-Visualisierung:** Die NextFloor-Instanz kann direkt in der Tile-Visualisierung als
HTML-SDK-Kachel abgelegt werden. Sie zeigt die 3D-Ansicht samt Bedienung.
<p align="center">
<a href="https://my.home-assistant.io/redirect/hacs_repository/?owner=therealMRBK&repository=NextFloor&category=integration"><img src="https://my.home-assistant.io/badges/hacs_repository.svg" alt="Open in HACS"></a>
<a href="https://therealmrbk.github.io/NextFloor/docs/en/"><img src="https://img.shields.io/badge/%F0%9F%93%9A-Documentation-1f6feb?style=for-the-badge" alt="Documentation"></a>
<a href="https://therealmrbk.github.io/NextFloor/"><img src="https://img.shields.io/badge/%E2%96%B6-Online%20demo-00b4d8?style=for-the-badge" alt="Online demo"></a>
<a href="https://therealmrbk.github.io/NextFloor/preview/index.html?showcase&lang=en"><img src="https://img.shields.io/badge/%E2%96%A6-All%20models-8a63d2?style=for-the-badge" alt="All models"></a>
</p>
## Für Module Control bereitstellen
<p align="center">
<a href="https://github.com/therealMRBK/NextFloor/releases"><img src="https://img.shields.io/github/v/release/therealMRBK/NextFloor?style=flat-square" alt="Release"></a>
<a href="https://github.com/therealMRBK/NextFloor/actions"><img src="https://img.shields.io/github/actions/workflow/status/therealMRBK/NextFloor/ci.yml?branch=main&style=flat-square&label=CI" alt="CI"></a>
<a href="https://hacs.xyz"><img src="https://img.shields.io/badge/HACS-official%20store-41bdf5?style=flat-square" alt="In the official HACS store"></a>
<a href="#-free-forever"><img src="https://img.shields.io/badge/price-free%20forever-2ea44f?style=flat-square" alt="Free forever"></a>
<a href="https://github.com/therealMRBK/NextFloor/blob/main/LICENSE"><img src="https://img.shields.io/badge/licence-MIT-blue?style=flat-square" alt="MIT"></a>
<a href="#-made-with-ai"><img src="https://img.shields.io/badge/built%20with-AI%20assistance-8a63d2?style=flat-square" alt="Built with AI"></a>
</p>
In **Kerninstanzen → Modules** wird dieses Repository verwendet:
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/demo-live.gif" alt="NextFloor in a real house: the house turns, the ground floor opens, a room panel with its lights and blinds slides in" width="900"></p>
`https://git.portal.se-cloud.de/Hannes/NextFloor.git`
<p align="center">
<a href="https://therealmrbk.github.io/NextFloor/docs/en/"><b>📚 Documentation</b></a> ·
<a href="https://therealmrbk.github.io/NextFloor/docs/en/quickstart/">Quick start</a> ·
<a href="https://therealmrbk.github.io/NextFloor/docs/en/cards/">Card options</a> ·
<a href="https://therealmrbk.github.io/NextFloor/docs/en/plugins/">Plugins</a> ·
<a href="https://therealmrbk.github.io/NextFloor/docs/en/faq/">FAQ</a> ·
<a href="https://therealmrbk.github.io/NextFloor/docs/de/">Deutsch</a> ·
<a href="https://github.com/therealMRBK/NextFloor/blob/main/README.zh-CN.md">简体中文</a> ·
<a href="https://therealmrbk.github.io/NextFloor/tutorial/">🎬 Setup video</a> ·
<a href="https://github.com/therealMRBK/NextFloor/blob/main/ROADMAP.md">Roadmap</a>
</p>
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
Nach der Aktualisierung auf **0.2.7 / Build 10** die Konsole neu laden. Unter
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
---
### Für die Entwicklung
## ✨ In one minute
IP-Symcon erwartet `library.json` im Wurzelverzeichnis eines Repositories. Das eigentliche
Projekt behält dieses Modul deshalb unter `symcon/`; aus einem Fork wird daraus ein reiner
`symcon`-Branch. Auf dem Entwicklungsbranch bauen, prüfen und die Änderungen committen,
bevor der Installationsbranch veröffentlicht wird (`git subtree` übernimmt nur Commits):
| | | |
|---|---|---|
| **✏️ Draw it** | **💡 Watch it live** | **🧩 Make it yours** |
| Floors, rooms, curved walls, doors, windows, stairs, roofs and gardens, with the 3D model growing beside the plan. Or import a room scan, a CAD drawing or a Sweet Home 3D plan. | Tap a lamp and the real light switches. Blinds travel, doors open, the TV shows the running app, solar power flows along your real cables, rain falls. | 43 free furniture packs with about 800 models, a furniture studio and a browser builder, a dashboard card with templates, and a reviewed plugin store. |
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-house.jpg" width="900" alt="A house in the 3D view, floors apart, rooms lit"></p>
## 🖼️ What it looks like
<table>
<tr>
<td align="center" width="50%"><a href="https://therealmrbk.github.io/NextFloor/docs/en/draw/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/editor.jpg" alt="The plan editor with the 3D view beside it"></a><br><sub><b>The editor.</b> Draw while the house grows beside you.</sub></td>
<td align="center" width="50%"><a href="https://therealmrbk.github.io/NextFloor/docs/en/view3d/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-room.jpg" alt="A room in 3D with its lamps and the room panel"></a><br><sub><b>A room.</b> Every device of the room in one panel.</sub></td>
</tr>
<tr>
<td align="center"><a href="https://therealmrbk.github.io/NextFloor/docs/en/climate-energy/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-energy.jpg" alt="The energy flow from the solar field through the house"></a><br><sub><b>Energy.</b> Power flows along the cables you drew.</sub></td>
<td align="center"><a href="https://therealmrbk.github.io/NextFloor/docs/en/climate-energy/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-heat.jpg" alt="A heat map of the house by temperature"></a><br><sub><b>Climate.</b> Temperature, humidity, CO₂, mould and sun by room.</sub></td>
</tr>
<tr>
<td align="center"><a href="https://therealmrbk.github.io/NextFloor/docs/en/live/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-weather-rain.jpg" alt="Rain falling on the house"></a><br><sub><b>Weather.</b> Rain, snow, fog, lightning, sun and moon.</sub></td>
<td align="center"><a href="https://therealmrbk.github.io/NextFloor/docs/en/furnish/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/new-furniture.jpg" alt="Furniture from several packs in a room"></a><br><sub><b>Furniture.</b> About 800 models, and your own.</sub></td>
</tr>
<tr>
<td align="center"><a href="https://therealmrbk.github.io/NextFloor/docs/en/tablet/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/tablet.jpg" alt="NextFloor on a wall tablet"></a><br><sub><b>The wall tablet.</b> Kiosk mode, night dimming, announcements.</sub></td>
<td align="center"><a href="https://therealmrbk.github.io/NextFloor/docs/en/cards/"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/card.jpg" alt="The NextFloor card on a dashboard"></a><br><sub><b>The card.</b> On any dashboard, with a visual editor.</sub></td>
</tr>
</table>
Looks: <a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-blueprint.jpg"><b>Blueprint</b></a> · <a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-day.jpg"><b>Day</b></a> · <a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-cut.jpg"><b>Cut-away walls</b></a> · <a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-stacked.jpg"><b>Stacked floors</b></a> · <a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/vehicles-tesla.jpg"><b>Vehicles</b></a> · <a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/furniture-ikea.jpg"><b>IKEA sizes</b></a>
## 🚀 Install in two minutes
NextFloor is in the **official HACS store**.
1. Open **HACS**, search for **NextFloor** and press **Download** (or use the HACS button above).
2. **Restart Home Assistant.**
3. Add the integration: [![Start setting up NextFloor.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=nextfloor), or *Settings → Devices & services → Add integration → NextFloor*.
4. Open **NextFloor** in the sidebar, switch to **Editor** and draw your first floor. The [quick start](https://therealmrbk.github.io/NextFloor/docs/en/quickstart/) takes you through the first room and lamp.
**Manual install:** copy `custom_components/nextfloor` into `config/custom_components/` and restart. Needs Home Assistant 2025.1 or newer. **Installed earlier as a custom repository?** Nothing to change: your plan and settings stay, and updates keep coming through HACS. More in the [installation guide](https://therealmrbk.github.io/NextFloor/docs/en/install/).
## 🧭 What it does
<details open>
<summary><b>Draw and plan</b></summary>
- **Plan editor:** floors, rooms, curved and sloping walls, doors, windows, shaped stairs, outdoor areas with fences and gates, roofs with overhang per side. Rooms open to the floor above, turned roof sections, wall thickness per part.
- **Import:** iPhone room scans (Apple RoomPlan), Sweet Home 3D, DXF and IFC, or a plan an AI draws from a picture of your floor plan.
- **Plan check:** one list of what is missing or off, with a fix in one tap, including standby eaters and their yearly cost.
- **Areas and paper:** living area per room, floor and house, counted like the German *Wohnflächenverordnung*; the plan at 1:100 to print or save as PDF.
- **Versions and notes:** named states of the plan ("before the renovation"), compared with the plan now; notes pinned to a spot, with a due day.
- **3D print:** save the house as an STL file at 1:100.
→ [Draw the house](https://therealmrbk.github.io/NextFloor/docs/en/draw/) · [Plan tools](https://therealmrbk.github.io/NextFloor/docs/en/plan-tools/)
</details>
<details open>
<summary><b>Furnish and connect</b></summary>
- **Furniture:** 40 basic models and 43 packs with about 800 more: season and decoration, wellness, music, loft, Japandi, workshop, vehicles, picture frames with your own photos, L- and U-sofas, IKEA sizes.
- **Build your own:** the furniture studio in the editor, and the [browser builder](https://therealmrbk.github.io/NextFloor/builder/) that shares to a community store.
- **Devices:** lamps with several bulbs, light programs, blinds (roller, venetian, inside, Somfy *My*), smart locks, gates, TVs with ambilight, speakers, a 3D printer, a heat pump, the car, pets, robot vacuums and mowers.
- **People:** a room sensor or a default room per person, shown in their rooms and counted per floor.
→ [Furnish](https://therealmrbk.github.io/NextFloor/docs/en/furnish/) · [Connect devices](https://therealmrbk.github.io/NextFloor/docs/en/devices/) · [Furniture packs](https://therealmrbk.github.io/NextFloor/docs/en/packs/)
</details>
<details open>
<summary><b>Live in 3D</b></summary>
- **Control:** tap to switch, swipe to dim, long press for colours, a room panel with scenes and moods, a central menu, search.
- **Weather and sun:** rain, snow, hail, fog, lightning, sun and moon, real shadows, a time-of-day slider, the sun's arc over the property.
- **Walk and time travel:** walk through the house at eye level, or replay the last day or week.
- **Warnings:** smoke, gas, water, the alarm with the sensor that set it off, windows open in the rain, and your own warnings.
- **Announcements:** *"Dinner is ready!"* in the room that should hear it, through its speaker and on every open screen.
→ [The 3D view](https://therealmrbk.github.io/NextFloor/docs/en/view3d/) · [Live features](https://therealmrbk.github.io/NextFloor/docs/en/live/) · [Announcements](https://therealmrbk.github.io/NextFloor/docs/en/announcements/)
</details>
<details open>
<summary><b>Climate, sun and energy</b></summary>
- **Heat maps:** temperature (summer and winter scale), humidity, CO₂, mould risk and a comfort score, Wi-Fi reach, hours of sun and power draw per room.
- **Room hints:** airing, low batteries, lights left on in empty rooms, shade when the sun heats a room, a window open while the heating runs.
- **Energy:** solar fields (also east-west racks), power flow along real cable routes, battery charge, gas and water meters, a meter per floor, the last 24 hours and seven days.
→ [Climate and energy](https://therealmrbk.github.io/NextFloor/docs/en/climate-energy/) · [Outside, roof and energy](https://therealmrbk.github.io/NextFloor/docs/en/outside/)
</details>
<details open>
<summary><b>Dashboard, tablet and automations</b></summary>
- **The card:** `custom:nextfloor-card` with a visual editor, card templates, a card for chosen rooms, floor-plan-only mode.
- **Wall tablet:** kiosk mode with night dimming, an easy-to-read mode, and quality that steps down by itself on slow tablets.
- **Automations:** *Open windows and doors* and *Lights on* as sensors for the house and every floor, plus the actions `nextfloor.announce` and `nextfloor.reload_screens`.
- **Look:** colours, font and corner radius from your Home Assistant theme; looks *Neon*, *Blueprint* and *Day*. Nineteen languages.
→ [The dashboard card](https://therealmrbk.github.io/NextFloor/docs/en/cards/) · [Wall tablet](https://therealmrbk.github.io/NextFloor/docs/en/tablet/) · [Services and sensors](https://therealmrbk.github.io/NextFloor/docs/en/automations/)
</details>
## 🧩 The dashboard card
```yaml
type: custom:nextfloor-card
floor: ground # optional: start floor
theme: neon # neon | blueprint | day
room_buttons: true # a row of room buttons
template: kitchen # optional: a card template set up once in the editor
```
The visual editor sets every option without YAML. The [complete list of card options](https://therealmrbk.github.io/NextFloor/docs/en/cards/) has them all, with their defaults.
## 📚 Documentation
The full documentation is at **[therealmrbk.github.io/NextFloor/docs](https://therealmrbk.github.io/NextFloor/docs/en/)**: search, a dark and a light look, and every page in English and German.
| I want to … | Read |
|---|---|
| install and draw my first room | [Install](https://therealmrbk.github.io/NextFloor/docs/en/install/) · [Quick start](https://therealmrbk.github.io/NextFloor/docs/en/quickstart/) · [How it works](https://therealmrbk.github.io/NextFloor/docs/en/concepts/) |
| draw the house, furnish it, connect devices | [Draw](https://therealmrbk.github.io/NextFloor/docs/en/draw/) · [Furnish](https://therealmrbk.github.io/NextFloor/docs/en/furnish/) · [Connect devices](https://therealmrbk.github.io/NextFloor/docs/en/devices/) |
| use weather, energy, climate and announcements | [The 3D view](https://therealmrbk.github.io/NextFloor/docs/en/view3d/) · [Live features](https://therealmrbk.github.io/NextFloor/docs/en/live/) · [Climate and energy](https://therealmrbk.github.io/NextFloor/docs/en/climate-energy/) |
| put it on a dashboard or a wall tablet | [The dashboard card](https://therealmrbk.github.io/NextFloor/docs/en/cards/) · [Wall tablet](https://therealmrbk.github.io/NextFloor/docs/en/tablet/) |
| automate, extend, build my own | [Services and sensors](https://therealmrbk.github.io/NextFloor/docs/en/automations/) · [Plugins](https://therealmrbk.github.io/NextFloor/docs/en/plugins/) · [Furniture packs](https://therealmrbk.github.io/NextFloor/docs/en/packs/) · [Plan format](https://therealmrbk.github.io/NextFloor/docs/en/plan-format/) |
| fix something | [FAQ and troubleshooting](https://therealmrbk.github.io/NextFloor/docs/en/faq/) |
The Markdown sources are in [`docs/content`](https://github.com/therealMRBK/NextFloor/tree/main/docs/content). A pull request that improves a page is welcome.
## 💚 Free forever
NextFloor is free, and it stays free: not "free to try", not "free with a paid Pro", not "free until the next version". **Free, for everyone, forever.**
- **Nothing to buy, ever.** No Pro version, no paid modules, no packs sold one by one, no supporter pass, no licence key, no shop. The weather, the energy flow, TV screens, the car, announcements, the heat pump and the 3D printer are simply part of NextFloor.
- **New furniture all the time, for free.** 43 packs with about 800 models come with it, and new packs keep coming.
- **Build and extend it yourself.** The [furniture builder](https://therealmrbk.github.io/NextFloor/builder/) shares to a community store; a [plugin system](https://therealmrbk.github.io/NextFloor/docs/en/plugins/) with a reviewed [plugin store](https://github.com/therealMRBK/NextFloor-Plugins) adds device kinds, light animations and room cards, from anyone.
- **Your data stays home.** No account, no cloud, no usage data.
- **The promise is in the licence.** NextFloor is MIT licensed: anyone may read, change and share it. Nobody can take it away from you, not even me.
I believe in open source: software that anyone may read, change and share, and that every home can use without paying a cent. That conviction is the reason NextFloor exists.
## 🔒 Privacy
The plan, its pictures and the packs live in Home Assistant's `.storage`. NextFloor does not talk to the internet on its own. Only if you switch on the optional real map, your browser loads map tiles from the tile server (OpenStreetMap by default). Pictures and history come from your own Home Assistant.
## 🤖 Made with AI
NextFloor was built entirely with AI assistance. The idea, the decisions and the testing in a real house come from a person; the design, the code, the tests and the documentation were written together with [Claude](https://www.anthropic.com/claude) (Anthropic) in [Claude Code](https://www.anthropic.com/claude-code). I would rather say so openly than let you guess.
What that means for you:
- **It is tested, but young.** There are automated tests (frontend logic, the furniture packs, the Home Assistant side) and releases are looked at in a real browser and installed on a real Home Assistant, but it has far fewer users than most integrations. Expect rough edges and report them.
- **Back up before you trust it.** The plan lives in Home Assistant's `.storage`; the editor has a backup and restore of the whole plan.
- **Read the code if it matters to you.** It is MIT licensed and small enough to read. Pull requests are welcome, also ones written with AI, as long as you say so and have run the checks (see [CONTRIBUTING.md](https://github.com/therealMRBK/NextFloor/blob/main/CONTRIBUTING.md)).
## 💬 Ideas, questions and bugs
[Discussions](https://github.com/therealMRBK/NextFloor/discussions) for ideas and questions, [Issues](https://github.com/therealMRBK/NextFloor/issues/new/choose) for bugs. Security problems go through [private reporting](https://github.com/therealMRBK/NextFloor/security/advisories/new).
## 🛠️ Development
<details>
<summary>Build, test, preview</summary>
```bash
```powershell
cd C:\Pfad\zu\NextFloor
cd frontend
npm install
npm test # pure logic
npm run typecheck
npm run build # writes the bundles to custom_components/nextfloor/frontend (committed)
npm run screenshot # renders preview/index.html (invented demo data) with a local Chrome or Chromium
npm run build
cd ..
node --test symcon/tests/package.test.mjs
git add symcon frontend custom_components/nextfloor/frontend CHANGELOG.md
git commit -m "feat: add Symcon object tree picker"
git subtree push --prefix=symcon origin symcon
```
- **Preview without Home Assistant:** open `preview/index.html` through any local web server.
- **Deploy to a test instance:** create `deploy.local.json` with `{"target": "<config>/custom_components/nextfloor"}` and run `npm run deploy` in `frontend/`.
- **Python tests** run in CI with `pytest-homeassistant-custom-component`.
- **Documentation site:** `cd tools/docs && npm install && npm run build` (sources in `docs/content`, English and German).
- **Furniture packs:** the built-in packs are generated by `tools/build_packs.py`. The format of your own packs is in the [documentation](https://therealmrbk.github.io/NextFloor/docs/en/packs/).
Danach in IP-Symcon unter **Kerninstanzen → Modules** den Git-Link des Forks hinzufügen und
im Zahnrad des Eintrags den Branch `symcon` wählen. Anschließend steht **NextFloor** bei
„Instanz hinzufügen“ zur Verfügung.
</details>
Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
`frontend` mit `npm run build` erzeugt beziehungsweise kopiert und gehören daher in den Branch.
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
## 🙏 Credits
## Änderungen in 0.2.7
NextFloor started as a fork of [NeonPlan 3D](https://github.com/Mastershort/neonplan3d) by Mastershort (Torsten). The idea of a live 3D home right inside Home Assistant, and the groundwork NextFloor grew from, are his. NextFloor carries that idea on in its own direction: entirely free and open source, for everyone. Thank you, Torsten!
- Im Raumklima ist **Helligkeit** als weiterer Datenpunkt wählbar. Die Raumkarte zeigt ihn
mit einem Sonnensymbol in Lux; CO₂ verwendet ein Wolkensymbol.
- Unter **Zusätzliche Werte** fügt **+** beliebig weitere Datenpunkte an Geräte und
verknüpfte Möbel an. Jeder Wert hat eine eigene Auswahl aus dem Objektbaum, ein frei
eingebbares Symbol (Emoji/Zeichen) und eine optionale Bezeichnung. Mehrere Temperaturen
oder andere Werte erscheinen gemeinsam am Gerät und im Raumfenster; einzelne Werte
lassen sich wieder entfernen.
- Erklärende Hilfetexte im Designer sind hinter **ⓘ** zusammengefasst. Ein Klick öffnet
die jeweilige Erklärung als Popup, das per Schließen-Knopf oder Escape geschlossen wird.
## Licence
- Der **Positions-Sensor (live)** einer Jalousie lässt sich unabhängig vom automatisch
vermuteten Gerätetyp aus dem Objektbaum auswählen. Integer und Float werden unterstützt;
Rückmeldungen in 0–100, 0–255 oder 0–1 werden anhand des Symcon-Wertebereichs eingelesen.
- **Wirksinn Behang umkehren** und **Wirksinn Lamellen umkehren** sind getrennt einstellbar,
auch bei einzeln platzierten Jalousien und beim zweiten Behang eines Fensters. Die Umkehrung
gilt für die Anzeige, 3D-Darstellung, Regler, Auf/Zu, Schnellmenü, Wischbedienung und
Gruppenbefehle. Der Positionssensor wird dabei ausschließlich gelesen.
- Die bisherige Option **Sensor zählt umgekehrt** korrigiert weiterhin nur eine abweichende
Richtung der Rückmeldung. Die neuen Wirksinn-Schalter drehen Anzeige und Bedienung zusammen.
- Die Raumklimakarten zeigen nur Symbole und Werte, ohne erneut den Raumnamen oder die
Messwert-Beschriftungen anzuzeigen. Nicht verknüpfte Messwerte erhalten keine Zeile;
eine vollständig unbestückte Karte wird nicht angezeigt. Verknüpfte, vorübergehend nicht
verfügbare Werte bleiben als „–“ erkennbar.
MIT, see [LICENSE](https://github.com/therealMRBK/NextFloor/blob/main/LICENSE). NextFloor ships [three.js](https://threejs.org) (MIT), [Lit](https://lit.dev) (BSD-3-Clause); their notices are in [THIRD_PARTY_NOTICES.md](https://github.com/therealMRBK/NextFloor/blob/main/THIRD_PARTY_NOTICES.md).
## Änderungen in 0.2.6
"Home Assistant" is a trademark of its owners; "Tesla" and the Tesla model names are trademarks of Tesla, Inc., and "IKEA" and its product names are trademarks of Inter IKEA Systems B.V.; they are used here only to name the sizes and models. NextFloor is an independent community project and not affiliated with or endorsed by Nabu Casa, Tesla or IKEA.
- Pro Raum lässt sich unter **Raumklima → Raumklima als schwebende Karte** eine Glaskarte
mit Temperatur, Luftfeuchtigkeit und CO₂ einschalten. Sie hängt über dem jeweiligen Raum
und verwendet die dort ausgewählten Variablen, einschließlich mehrerer gemittelter Sensoren.
- Die Karte zeigt Celsius/Fahrenheit entsprechend der Anzeigeeinstellung, Feuchte in Prozent
und CO₂ in ppm. Fehlende Werte stehen als „–“ statt einer erfundenen Null dort.
- Der Schalter **Karten** bleibt auch ohne Energiezähler verfügbar. Karten funktionieren
in der Gesamtansicht, auf einzelnen Etagen und beim geöffneten Raum sowie in der HTML-SDK-Kachel.
- Die Variablenauswahl für Raumklima akzeptiert manuell jeden passenden numerischen
Symcon-Datenpunkt (Integer/Float), auch ohne erkannten Profilnamen oder vermuteten Gerätetyp.
„Feuchtigkeit“ und „CO₂“ werden erkannt; Namen übergeordneter Kategorien überschreiben
die Bedeutung des Messwerts nicht mehr.
Nach dem Update den Designer neu laden, den Raum auswählen und unter **Raumklima** die
Messwerte über den Objektbaum zuweisen. Dort **Raumklima als schwebende Karte** aktivieren.
In der 3D-Ansicht bei Bedarf **Karten** einschalten.
## Änderungen in 0.2.5
- Numerische Variablen lassen sich im Objektbaum ausdrücklich als Licht-Dimmer oder
Behangposition auswählen, auch wenn der automatisch vermutete Gerätetyp nicht passt.
Integer und Float werden unterstützt; zusätzliche Rollen erzeugen keine doppelten
Objekte im Baum oder Geräte in automatisch gefüllten Raumlisten.
- Helligkeitsregler bleiben auch bei ausgeschaltetem Licht sichtbar. Echte Boolean-Schalter
erhalten keinen Dimmer. Die bewusste Einstellung „Im Raumfenster nur schalten“ bleibt wirksam.
- Wertebereiche und Schrittweiten kommen aus der aktuellen Symcon-Darstellung bzw. dem
Legacy-Profil. 0–255 und 0–1 werden bei Anzeige und Steuerbefehlen in Prozent umgerechnet.
- Im Fenster-/Jalousieformular sind **Position (Behang)** und **Lamellenposition** getrennt
über den Objektbaum verknüpfbar. Auch ein zweiter Behang kann eine eigene Lamellenvariable
erhalten. Die Auswahl steuert die richtigen Variablen im Raumfenster und im Schnellmenü;
die 3D-Lamellen folgen ihrer eigenen Position.
Auch einzeln platzierte Jalousie-Geräte bieten eine eigene Auswahl für die Lamellenposition.
- Ohne unterstützten Stoppbefehl wird kein Stoppknopf angeboten. Ein unbekannter Stoppbefehl
wird abgewiesen, statt versehentlich die Position zu verändern.
Nach dem Update den Designer neu laden. War der Dimmer bisher falsch zugeordnet, dessen
Datenpunkt im Licht-Feld erneut über den Objektbaum auswählen. Bei Jalousien die Position
im Feld **Position (Behang)** und den zweiten Datenpunkt unter **Lamellenposition** wählen.
## Änderungen in 0.2.4
- Das Wandmenü in der rechten Raumleiste lässt sich über die Überschrift auf- und zuklappen.
- **Variablen neu laden** in der Titelleiste lädt den Objektbaum, Variablen und deren aktuelle
Darstellungen vollständig neu. Der Plan bleibt geöffnet. Während des Abrufs ist der Knopf
gesperrt; Erfolg oder Fehler werden angezeigt. Laufende Abfragen werden zuvor abgeschlossen.
- KNX-Temperaturen werden auch anhand der Einheit aus der aktuellen Symcon-9-Darstellung
erkannt, wenn kein altes Variablenprofil vorhanden ist. Numerische Temperaturwerte bleiben
für die Raumtemperatur auswählbar, auch wenn ein übergeordneter Objektname zuvor einen
Aktor-Datentyp vermuten ließ. Bestehende Verknüpfungen bleiben erhalten.
## Änderungen in 0.2.3
- Große Objektbäume verursachen beim Laden nicht mehr „Output-Buffer exceeds Limit
(1048576 bytes)“. Große API-Antworten werden vollständig in kleinen Paketen übertragen;
keine einzelne JSON-Antwort überschreitet 256 KiB. Das gilt auch für Möbelpakete,
Bilder, Pläne und Backups, die über dieselbe API geladen werden.
- Ein Test mit 10.000 Variablen und Objekten überträgt rund 5,5 MB bei höchstens
rund 175 KB pro Antwort. Namen und Werte bleiben einschließlich Umlauten und Emojis erhalten.
- Die Übertragung verwendet eine unveränderliche Momentaufnahme in privaten temporären
Dateien statt des ebenfalls größenbegrenzten Modul-Buffers. Nach Abschluss werden diese
gelöscht; verwaiste Übertragungen verfallen nach zwei Minuten Inaktivität und werden
beim nächsten Zugriff aufgeräumt.
- Während einer laufenden Aktualisierung wird keine zweite gestartet. Fehlerhafte
oder leere Antworten werden verständlich gemeldet statt nur als „HTTP 200“.
Nach dem Update den Designer neu laden, damit die neue Übertragung auf beiden Seiten aktiv ist.
## Änderungen in 0.2.2
- Die Datenpunktauswahl zeigt in der Hauptansicht die Objekte der Hauptkategorie.
Ausgeblendete Kategorien bleiben inklusive aller Unterkategorien und Variablen sichtbar
und werden als „ausgeblendet“ gekennzeichnet.
- I/O, Splitter, Kerninstanzen, Konfiguratoren, Discovery und Visualisierungen sind unter
einem anfangs zugeklappten virtuellen **„System“**-Ordner zusammengefasst. Die Zuordnung
richtet sich nach dem tatsächlichen Symcon-Modultyp, nicht nach dem Namen.
- Unterobjekte bleiben bei ihrer Systeminstanz. Suche, Vorauswahl und Bestätigung
funktionieren auch für Systemvariablen; die echten Symcon-Objekte werden nicht verschoben.
## Änderungen in 0.2.1
- Fehlende interne WebHooks werden nach dem Symcon-Start, beim Übernehmen der
Instanzkonfiguration und beim Öffnen von Designer oder Kachel erneut registriert.
- Fehlgeschlagene Registrierungen erhalten einen Fehlerstatus und werden automatisch
erneut versucht. Die Instanz meldet dann nicht mehr fälschlich „bereit“.
- Der Button **„WebHook reparieren“** registriert den Hook direkt und zeigt das Ergebnis.
Die bestehende Instanz, der Grundriss und der Zugangsschlüssel bleiben dabei erhalten.
- Nach einem Update lädt der Designer seine neue JavaScript-Version statt einer
möglicherweise noch im Browser zwischengespeicherten Vorgängerversion.
### Update bei „Hook not found“
Das vollständige Modul auf 0.2.1 aktualisieren und die NextFloor-Instanzkonfiguration
neu öffnen. Einmal **„WebHook reparieren“**, anschließend **„Designer in der Konsole öffnen“**
anklicken. Der Eintrag gehört unter **WebHook Control → Hooks (Intern)**; ein eigener
PHP-Skript-Hook unter „Benutzerdefiniert“ ist nicht erforderlich. Die bestehende Instanz
nicht neu anlegen, da ihr Plan in ihren Attributen gespeichert ist.
## Änderungen in 0.2.0
- Die Datenpunktauswahl öffnet ein Popup mit dem vollständigen Symcon-Objektbaum.
Kategorien, Instanzen, Variablen, Skripte, Ereignisse, Medien und Links behalten
ihre Elternobjekte, Namen und Reihenfolge (Position, Typ, Name).
- Äste lassen sich auf- und zuklappen. Die Suche zeigt Fundstellen in ihrer Hierarchie;
beim erneuten Öffnen ist der bisherige Datenpunkt bereits aufgeklappt und markiert.
- Ein Klick markiert eine Variable, „Übernehmen“ bestätigt sie. Doppelklick übernimmt
direkt; „Abbrechen“ und Escape lassen die bisherige Zuordnung unverändert.
- Auch Variablenlinks sind auswählbar. Für das jeweilige Feld ungeeignete Objekte
bleiben zur Orientierung im Baum sichtbar und können nicht übernommen werden.
## Änderungen in 0.1.1
- NextFloor wird als Geräteinstanz (Modultyp 3) registriert und ist damit im Dialog
„Instanz hinzufügen“ auswählbar. Die HTML-SDK-Darstellung bleibt verfügbar.
- Die Dokumentations-URL in `module.json` und die Schema-URL des Formulars sind korrigiert.
- Designer und PHP-Backend verwenden dieselbe Symcon-Modulversion; es erscheint keine
falsche Aufforderung zum Neustart von Home Assistant.
- Die Paketprüfung erkennt fehlende Metadaten, falsche Modultypen und Verzeichnisstrukturen.
## Einrichtung
1. Eine **NextFloor**-Instanz anlegen.
2. In ihrer Konfiguration auf **„Designer in der Konsole öffnen“** klicken und den Grundriss
anlegen.
3. Für die Anzeige in der Tile-Visualisierung die Instanz wie jede andere Visualisierungs-
Instanz als Kachel hinzufügen.
Jede Instanz besitzt einen eigenen Plan, Bilder, Möbelpakete und Versionsverlauf.
## Objektbaum statt Objekt-ID
Alle Objekte werden beim Öffnen des Designers aus dem Symcon-Objektbaum gelesen. Ein Klick
auf ein Datenpunktfeld öffnet ein Popup mit diesem Baum. In jeder Auswahl erscheint zusätzlich
der vollständige Pfad, etwa `Haus / Erdgeschoss / Küche / Temperatur`.
Die Hauptansicht enthält die Objekte der Hauptkategorie einschließlich ausgeblendeter
Kategorien. Selten benötigte Systeminstanzen stehen im virtuellen Ordner **„System“**.
Die Suche durchsucht Name und Pfad; eine Objekt-ID wird weder angezeigt noch als Eingabe
akzeptiert. Kategorien stehen zusätzlich als Bereiche zur Raumzuordnung bereit.
Zur Darstellung werden Variablen anhand von Typ, Profil, Name und vorhandener Aktion als
Sensor, Kontakt, Schalter, Licht, Rollladen, Schloss oder Klima eingeordnet. Ist eine
Variablenaktion vorhanden, führt die 3D-Ansicht Änderungen über `RequestAction` aus;
ansonsten bleibt der jeweilige Wert als Anzeige verfügbar.
## Zugriff
Der Designer- und Kachel-Link enthält pro Instanz einen zufällig erzeugten Zugangsschlüssel.
Die Instanz setzt ihn zusätzlich als HttpOnly-Cookie für nachgeladene 3D- und Sprachdateien.
Über **„Neuen Designer-Zugang erzeugen“** lassen sich bestehende Links sofort ungültig machen.
Den generierten Link daher wie einen privaten WebFront-Link behandeln.
-209
View File
@@ -1,209 +0,0 @@
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/custom_components/nextfloor/brand/icon@2x.png" width="110" alt="NextFloor 标志"></p>
<h1 align="center">NextFloor</h1>
<p align="center"><b>在 Home Assistant 里画出你的家,实时看它活起来。</b><br>
灯会照亮所在的房间,卷帘会动,门会开,电视播什么就显示什么,屋外在下雨。<br>
没有云端,不用账号。为墙上平板而生。</p>
<p align="center"><b>💚 永久免费。每一个功能、每一个家具包、每一次更新——所有人都能用,而且一直如此。</b><br>
没有 Pro 版,没有付费插件,没有赞助通行证,没有许可证密钥,没有商店。</p>
<p align="center">
<a href="https://my.home-assistant.io/redirect/hacs_repository/?owner=therealMRBK&repository=NextFloor&category=integration"><img src="https://my.home-assistant.io/badges/hacs_repository.svg" alt="在 HACS 中打开"></a>
<a href="https://therealmrbk.github.io/NextFloor/"><img src="https://img.shields.io/badge/%E2%96%B6-%E5%9C%A8%E7%BA%BF%E6%BC%94%E7%A4%BA-00b4d8?style=for-the-badge" alt="在线演示"></a>
<a href="https://therealmrbk.github.io/NextFloor/preview/index.html?showcase&lang=en"><img src="https://img.shields.io/badge/%E2%96%A6-%E5%85%A8%E9%83%A8%E6%A8%A1%E5%9E%8B-8a63d2?style=for-the-badge" alt="全部模型"></a>
<a href="https://therealmrbk.github.io/NextFloor/dev/"><img src="https://img.shields.io/badge/%E2%9A%99-%E5%BC%80%E5%8F%91%E7%89%88%E6%BC%94%E7%A4%BA-ffb547?style=for-the-badge" alt="开发版演示"></a>
</p>
<p align="center">
<a href="https://github.com/therealMRBK/NextFloor/releases"><img src="https://img.shields.io/github/v/release/therealMRBK/NextFloor?style=flat-square" alt="版本"></a>
<a href="https://github.com/therealMRBK/NextFloor/actions"><img src="https://img.shields.io/github/actions/workflow/status/therealMRBK/NextFloor/ci.yml?branch=main&style=flat-square&label=CI" alt="CI"></a>
<a href="https://hacs.xyz"><img src="https://img.shields.io/badge/HACS-%E5%AE%98%E6%96%B9%E5%95%86%E5%BA%97-41bdf5?style=flat-square" alt="HACS 官方商店"></a>
<a href="#-永久免费--一个承诺"><img src="https://img.shields.io/badge/%E4%BB%B7%E6%A0%BC-%E6%B0%B8%E4%B9%85%E5%85%8D%E8%B4%B9-2ea44f?style=flat-square" alt="永久免费"></a>
<a href="https://github.com/therealMRBK/NextFloor/blob/main/LICENSE"><img src="https://img.shields.io/badge/%E8%AE%B8%E5%8F%AF%E8%AF%81-MIT-blue?style=flat-square" alt="MIT"></a>
<a href="#-由-ai-协助构建"><img src="https://img.shields.io/badge/%E6%9E%84%E5%BB%BA%E6%96%B9%E5%BC%8F-AI%20%E5%8D%8F%E5%8A%A9-8a63d2?style=flat-square" alt="由 AI 协助构建"></a>
</p>
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/demo-live.gif" alt="真实住宅里的 NextFloor:房子旋转,一层展开,房间面板列出它的灯和设备"></p>
<p align="center">📖 <a href="https://github.com/therealMRBK/NextFloor/blob/main/README.md">English</a> · <b>简体中文</b></p>
<p align="center">🎬 <a href="https://therealmrbk.github.io/NextFloor/tutorial/">在浏览器里看安装视频,从空白页面开始(45 分钟,英语配音,中/英/德字幕)</a></p>
<p align="center">📖 <a href="https://github.com/therealMRBK/NextFloor/blob/main/docs/manual.zh-CN.md">中文手册</a> · <a href="https://github.com/therealMRBK/NextFloor/blob/main/docs/manual.md">英文手册</a> · <a href="https://github.com/therealMRBK/NextFloor/blob/main/docs/anleitung.md">Anleitung(德语)</a> · 🗺️ <a href="https://github.com/therealMRBK/NextFloor/blob/main/ROADMAP.md">路线图</a> · 📝 <a href="https://github.com/therealMRBK/NextFloor/blob/main/CHANGELOG.md">更新日志</a></p>
---
## ✨ 它能做什么
| | |
|---|---|
| ✏️ **平面图编辑器** | 楼层、房间、弧形墙、门窗、异形楼梯、室外区域和屋顶,都在 Home Assistant 里绘制,3D 视图就在平面图旁边。房间内的分区、图层、内侧尺寸、分段墙厚、**通到上层的挑高房间**、可转向的屋顶段、DXF 导入。 |
| ✓ **平面图检查** | 一张清单列出缺什么、哪里不对——房间没有区域、设备没放进去、房间重叠、门窗不在墙上、关联的实体已不存在——还有待机耗电设备及其年度电费,每项都能一键修复。新平面图有简短引导,按 `?` 看快捷键表。 |
| 📐 **面积与图纸** | 每个房间、每个楼层、整栋房子的居住面积,按德国《居住面积条例》计算;**1:100 的纸质平面图**,带尺寸和面积表,可直接打印或存为 PDF。 |
| 🕘 **版本与便签** | 给平面图起名存档(比如"装修前"),会一直保留,可与当前平面图对比;**便签可以钉在某个位置**,带到期日,在 3D 里显示为标记,搜索也能找到。 |
| 💡 **实时 3D** | 点击开关、滑动调光、长按换色。多灯泡灯具、卷帘(卷帘、百叶、内遮阳、Somfy *My*)、门窗都跟随对应实体;房间面板列出房间里的一切,场景排在最前。 |
| ✨ **灯光设计器** | 把房间的灯存成一个氛围,一键重现,还能套用到另一个房间。 |
| 🌡️ **房间气候** | 温度(夏季/冬季色阶)、湿度、CO₂、**发霉风险**和**舒适度评分**的热图,通风提示、低电量、空房间里忘关的灯、每个房间 24 小时温度曲线、会发亮的地暖。 |
| ☀️ **每个房间的阳光与用电** | 热图显示每个房间今天透过窗户获得的**日照小时**(依据平面图、朝向和太阳轨迹)和**当前用电功率**;房间面板里还有今日与本月的 kWh 和费用、全年日照、阳光晒热房间时的**遮阳提示**,以及供暖时开窗的提示。 |
| ⚡ **能源** | 光伏板阵(含东西向支架)、沿真实线缆路径的功率流动、储能电池电量、燃气与水表、每层独立电表,房屋卡片上显示最近 24 小时和**最近七天**。 |
| 🤖 **给自动化用的传感器** | *开着的门窗*和*开着的灯*作为 Home Assistant 传感器,有全屋和每层两种,实体列在属性里。按房间或按楼层**一键全关**,可撤销。 |
| 🔥 **热泵与 🖨️ 3D 打印机** | 实时卡片:出水/回水温度、热量与 COP;打印进度、剩余时间、层数、温度与耗材——打印件会在热床上长出来。 |
| 🚗 **汽车** | 电量、续航、充电时电流沿充电线从充电桩流向车、出发时间、离家距离、开着的门和后备箱、门锁与空调按钮。 |
| 📶 **Wi-Fi 地图** | 每个接入点在本层的覆盖范围、它带的设备,以及哪些网络设备离线。 |
| 📅 **今日** | 当天的日程和要收的垃圾桶,做成墙上平板的一张卡片。 |
| ⚠️ **告警** | 烟雾、燃气、漏水、报警器(并指出是哪个传感器触发的)、下雨时开着的窗、失联的门磁——还能为任意实体做**你自己的告警**。 |
| 📢 **播报** | *"开饭了!"* 只传给该听到的房间,通过它的音箱播,也会显示在每个打开的 NextFloor 屏幕上。 |
| 🏡 **家务与庭院** | 垃圾桶、信箱、缺水的植物、只在真实所在房间走动的宠物、扫地机和**割草机器人**按路线工作、喷灌、带水温和水泵的泳池、关联到 Home Assistant 区域的花园、每个房间的 *🧹 清洁*、每个房间对应的配电箱回路。 |
| 📺 **媒体** | 电视屏幕带封面和氛围灯;每个音箱和电视都有快捷菜单,含输入源、音量和每个音箱的预设。 |
| 🛋️ **家具** | 40 个基础模型和**41 个家具包、近 800 件家具**——季节与装饰、卫浴、音乐、Loft、日式、工坊、车辆、**可放自己照片的相框**——L 形和 U 形沙发、宜家尺寸、按原厂漆色渲染的特斯拉车型。任何家具都能设为"仅当某个辅助实体开启时显示"。 |
| 🚶 **漫游与时光回溯** | 以视线高度在屋里走动;回放最近几小时或几天。 |
| 🖥️ **为墙上平板准备** | 展示模式支持夜间调暗、星标菜单常开且更大、小屏幕的缩放与固定视角、慢速平板上**画质自动降级**、对比度更高字号更大的**易读模式**。 |
| 🎨 **跟随你的主题** | 颜色、字体、圆角都取自 Home Assistant;外观有 *Neon*、*Blueprint*、*Day*,以及实心刷漆墙面。 |
| 🧩 **卡片、插件、多语言** | `custom:nextfloor-card` 带可视化编辑器,插件系统带自己的商店,支持九种语言(含**简体中文**)。 |
| 🪑 **自己动手做** | **编辑器里的 🛠️ 家具工作室**(带门和抽屉的柜子、搁架、灯具、带屏幕的设备)、[家具构建器](https://therealmrbk.github.io/NextFloor/builder/)和社区商店、自己的 `.glb` 模型、Sweet Home 3D 与 DXF 导入、可被 AI 直接编写的平面图格式——还能把房屋**分享成一个视图文件**,在任何浏览器里打开。 |
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/new-0-22.jpg" width="900" alt="0.22 新增:编辑器里的家具工作室、按日照小时的热图与房间面板、平面图检查、带居住面积的纸质平面图"></p>
<p align="center"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/new-furniture.jpg" width="760" alt="放着自己照片的相框、L 形与 U 形沙发、带实时卡片正在打印的 3D 打印机,以及显示电量家用储能"></p>
## 💚 永久免费 —— 一个承诺
NextFloor 是免费的,而且会一直免费。不是"免费试用",不是"免费但 Pro 要钱",也不是"这一版免费":**对所有人、永远免费。** 每一个功能、每一个家具包、每一次更新,发布当天就属于所有人。
- **没有任何要买的东西。** 没有 Pro 版,没有付费模块,没有逐个售卖的家具包,没有能优先拿到功能的赞助通行证,没有许可证密钥,没有商店。所有东西——窗外天气、能量流动、电视与音箱、汽车、播报、家务与庭院、热泵和 3D 打印机——本来就是 NextFloor 的一部分。
- **家具一直在增加,而且免费。** 自带 41 个家具包、近 800 个模型,新家具包会随更新持续到来。
- **自己做家具。** [家具构建器](https://therealmrbk.github.io/NextFloor/builder/)在浏览器里运行:做完就能看到它和 NextFloor 里一模一样的样子,还能分享到社区商店,别人一键就能装上。
- **自己扩展。** 带审核[插件商店](https://github.com/therealMRBK/NextFloor-Plugins)的[插件系统](https://github.com/therealMRBK/NextFloor/blob/main/docs/plugins.md):新的设备类型、灯光动画、房间卡片——谁都可以做。
- **数据留在家里。** 没有账号,没有云端,不上传任何使用数据。
- **承诺写进了许可证。** NextFloor 采用 MIT 许可证:任何人都可以阅读、修改和分发。没有人能把它从你手里拿走——包括我。
我相信开源:任何人都能阅读、修改和分享的软件,每个家庭都能不花一分钱地用。这个信念就是 NextFloor 存在的原因。它起初是 NeonPlan 3D 的一个分支,后来走上自己的路,由这一个承诺支撑,由使用它的人一起塑造。
## 🖼️ 图集
<table>
<tr><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-room.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-room.jpg" alt="带面板的实时房间视图"></a><br><sub>带面板的实时房间视图</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/editor.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/editor.jpg" alt="平面图编辑器与旁边的 3D"></a><br><sub>平面图编辑器与旁边的 3D</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-stacked.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-stacked.jpg" alt="楼层叠放"></a><br><sub>楼层叠放</sub></td></tr>
<tr><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-energy.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-energy.jpg" alt="能量流动"></a><br><sub>能量流动</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-weather-rain.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-weather-rain.jpg" alt="窗外天气"></a><br><sub>窗外天气</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-media.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-media.jpg" alt="电视屏幕"></a><br><sub>电视屏幕</sub></td></tr>
<tr><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-heat.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-heat.jpg" alt="热图"></a><br><sub>热图</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-cut.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-cut.jpg" alt="剖切墙体"></a><br><sub>剖切墙体</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/tablet.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/tablet.jpg" alt="墙上平板"></a><br><sub>墙上平板</sub></td></tr>
<tr><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/editor-furniture.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/editor-furniture.jpg" alt="家具库"></a><br><sub>家具库</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/furniture-ikea.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/furniture-ikea.jpg" alt="宜家尺寸"></a><br><sub>宜家尺寸</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/vehicles-tesla.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/vehicles-tesla.jpg" alt="特斯拉车型"></a><br><sub>特斯拉车型</sub></td></tr>
</table>
<table>
<tr><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-room.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-room.jpg" alt="Neon"></a><br><sub>Neon</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-blueprint.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-blueprint.jpg" alt="Blueprint"></a><br><sub>Blueprint</sub></td><td align="center" width="33%"><a href="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-day.jpg"><img src="https://raw.githubusercontent.com/therealMRBK/NextFloor/main/docs/images/view-day.jpg" alt="Day"></a><br><sub>Day</sub></td></tr>
</table>
## 🚀 安装
**HACS**(推荐)
1. NextFloor 已进入 **HACS 官方商店**:打开 HACS,搜索 **NextFloor** 并下载(或点上面的 HACS 按钮)。
2. 重启 Home Assistant。
3. 添加集成:[![开始配置 NextFloor。](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=nextfloor),或 *设置 → 设备与服务 → 添加集成 → NextFloor*。
4. 在侧边栏打开 **NextFloor**,切到**编辑器**,画出你的第一个楼层。
**之前是通过自定义仓库安装的?** 无需任何更改。NextFloor 现已进入 HACS 官方商店,你的安装、平面图和设置保持不变,更新仍通过 HACS 提供。HACS 刷新列表后会自动把它识别为普通仓库。
**手动安装:** 把 `custom_components/nextfloor` 复制到 `config/custom_components/` 并重启。需要 Home Assistant 2025.1 或更高版本。
## 🧩 仪表盘卡片
所有选项都在卡片的可视化编辑器里。YAML 里也一样:
<details>
<summary>全部选项</summary>
```yaml
type: custom:nextfloor-card
floor: floor_ab12cd34 # 可选:只显示某一层(id 来自编辑器)
room: room_ab12cd34 # 可选:从这个房间开始
height: 420 # 可选:高度(像素)
fill: false # 可选:填满仪表盘标题以下的整屏,而不是固定高度
walls: auto # 可选:auto | cut
explode: true # 可选:在房屋视图里把楼层拉开
floor_stack: dim # 可选:打开某层时下面楼层的处理:dim | stacked | single
quality: auto # 可选:auto | low | high
theme: neon # 可选:neon | blueprint | day
accent: "#00e5ff" # 可选:Neon 外观的强调色
markers: important # 可选:none | important | all
heatmap: none # 可选:none | temperature | humidity | co2 | mould | values | wifi
room_panel: true # 可选:点击房间打开详情
room_names: true # 可选:3D 里显示房间名
controls: true # 可选:卡片里的开关,或 wall、floor、temperature、humidity、co2 的列表
floor_thumbs: true # 可选:用楼层缩略图切换楼层
fullscreen_button: false
stats: false # 可选:性能显示
alerts: true # 可选:烟雾、燃气、CO、漏水、报警器,以及下雨时开着的窗,会脉动提示
alert_jump: false # 可选:出现新告警时跳到对应房间
scenes: true # 可选:所选房间的场景与脚本按钮
energy: true # 可选:顶部显示能源数值
flows: true # 可选:功率流动线常开(true)或常关(false);留空则显示为开关
holograms: true # 可选:实时卡片(能量平衡、汽车、媒体)常开或常关;留空则显示为开关
weather: true # 可选:窗外天气
weather_entity: weather.home # 可选:用哪个天气实体(默认:按平面图里的设置)
idle_return: 0 # 可选:展示模式,无操作多少秒后回到起始视图
night: "off" # 可选:展示模式,夜间调暗:off | sun | "22:00-06:00"
idle_orbit: false # 可选:展示模式,空闲返回后镜头缓慢转动
central_open: false # 可选:星标菜单(收藏)默认展开,且字号更大
keep_camera: false # 可选:切换楼层时保持方位、高度和距离
readable: false # 可选:更高对比度和更大字号(墙上平板)
zoom: 1 # 可选:0.6 … 2.5,自适应视图的拉近程度
today: true # 可选:带日程和垃圾桶的「今日」卡片
sensor_bar: true # 可选:把你自己的传感器显示在顶部
```
</details>
## 📦 使用自己的 3D 模型
有车辆模型(`.glb`)?在 NextFloor 面板里打开**扩展**,选择文件,把车头转向你,选好细节级别,保存到你的 Home Assistant。NextFloor 在浏览器里完成预处理,本身不带任何模型。详见 [docs/models.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/models.md)。
## 🔒 隐私
平面图、图片和家具包都存放在 Home Assistant 的 `.storage` 里。NextFloor 不会自行联网;只有当你打开可选的真实地图时,浏览器才会从瓦片服务器加载地图瓦片(默认是 OpenStreetMap)。图片和历史都来自你自己的 Home Assistant。
## 🤖 由 AI 协助构建
NextFloor 完全在 AI 协助下构建。想法、决策和在真实住宅里的测试来自一个人;设计、代码、测试和文档是与 [Claude](https://www.anthropic.com/claude)(Anthropic)在 [Claude Code](https://www.anthropic.com/claude-code) 里一起写出来的。我更愿意直接说出来,而不是让你去猜。
这对你意味着什么:
- **有测试,但还年轻。** 有自动化测试(前端逻辑、家具包、Home Assistant 后端),每个版本也会在真实浏览器里看、装到真实的 Home Assistant 上,但用户数远少于大多数集成。请预期会有粗糙的地方,并反馈给我们。
- **信任它之前先备份。** 平面图保存在 Home Assistant 的 `.storage` 里;编辑器里有整份平面图的备份与恢复。
- **在意的话就去读代码。** 它是 MIT 许可,体量小到可以通读。欢迎提交 PR,AI 写的也欢迎,只要说明并跑过检查(见 [CONTRIBUTING.md](https://github.com/therealMRBK/NextFloor/blob/main/CONTRIBUTING.md))。
## 🛠️ 开发
<details>
<summary>构建、测试、预览</summary>
```bash
cd frontend
npm install
npm test # 纯逻辑测试
npm run typecheck
npm run build # 把 bundle 写到 custom_components/nextfloor/frontend(需提交)
npm run screenshot # 用本地 Chrome 或 Chromium 渲染 preview/index.html(虚构的演示数据)
```
- **不装 Home Assistant 也能预览**:用任意本地 Web 服务器打开 `preview/index.html`。
- **部署到测试实例**:创建 `deploy.local.json`,内容为 `{"target": "<config>/custom_components/nextfloor"}`,然后在 `frontend/` 里运行 `npm run deploy`。
- **Python 测试**在 CI 里用 `pytest-homeassistant-custom-component` 运行。
- **家具包**:内置家具包由 `tools/build_packs.py` 生成。自己做的家具包格式见 [docs/packs.md](https://github.com/therealMRBK/NextFloor/blob/main/docs/packs.md)(德语)。
</details>
## 💬 想法、问题与缺陷
想法和问题请到 [Discussions](https://github.com/therealMRBK/NextFloor/discussions),缺陷请到 [Issues](https://github.com/therealMRBK/NextFloor/issues/new/choose)。
## 🙏 致谢
NextFloor 起初是 Mastershort(Torsten)的 [NeonPlan 3D](https://github.com/Mastershort/neonplan3d) 的一个分支。"在 Home Assistant 里拥有一套实时 3D 的家"这个想法,以及 NextFloor 生长所依赖的基础,都是他的。NextFloor 沿着自己的方向把这个想法继续下去:完全免费、开源,面向所有人。谢谢你,Torsten!
## 许可证
MIT,见 [LICENSE](https://github.com/therealMRBK/NextFloor/blob/main/LICENSE)。NextFloor 包含 [three.js](https://threejs.org)(MIT)、[Lit](https://lit.dev)(BSD-3-Clause);它们的声明在 [THIRD_PARTY_NOTICES.md](https://github.com/therealMRBK/NextFloor/blob/main/THIRD_PARTY_NOTICES.md) 里。
"Home Assistant" 是其所有者的商标;"Tesla" 及特斯拉车型名称是 Tesla, Inc. 的商标;"IKEA" 及其产品名称是 Inter IKEA Systems B.V. 的商标;此处仅用于说明尺寸和车型。NextFloor 是独立的社区项目,与 Nabu Casa、Tesla 或 IKEA 没有关联,也未获其背书。
-19
View File
@@ -1,19 +0,0 @@
# NextFloor – Roadmap
Ideas for what comes next. There are no fixed dates; everything lands in NextFloor for free. What comes next is mostly decided by the wishes in [Discussions](https://github.com/therealMRBK/NextFloor/discussions) and the [issues](https://github.com/therealMRBK/NextFloor/issues) – vote there or add your own. Everything has to keep running on old, weak wall tablets. What is already done is in the [changelog](https://github.com/therealMRBK/NextFloor/blob/main/CHANGELOG.md).
*Deutsch weiter unten.*
| Topic | What it is about |
|---|---|
| More imports | More plan and scan formats besides JSON, Sweet Home 3D, DXF and IFC (doors and windows from IFC next) |
---
# NextFloor – Roadmap (Deutsch)
Ideen für das, was als Nächstes kommt. Es gibt keine festen Termine; alles kommt kostenlos in NextFloor. Was als Nächstes kommt, bestimmen vor allem die Wünsche in den [Discussions](https://github.com/therealMRBK/NextFloor/discussions) und den [Issues](https://github.com/therealMRBK/NextFloor/issues) – stimm dort ab oder schreib deinen eigenen. Alles muss weiter auf alten, schwachen Wand-Tablets laufen. Was schon fertig ist, steht im [Changelog](https://github.com/therealMRBK/NextFloor/blob/main/CHANGELOG.md).
| Thema | Worum es geht |
|---|---|
| Weitere Importe | Weitere Plan- und Scan-Formate neben JSON, Sweet Home 3D, DXF und IFC (als Nächstes Türen und Fenster aus IFC) |
-18
View File
@@ -1,18 +0,0 @@
# Security policy
## Supported versions
Only the latest release receives fixes. Update through HACS.
## Reporting a vulnerability
Please do **not** open a public issue for a security problem. Use GitHub's private reporting instead:
[Report a vulnerability](https://github.com/therealMRBK/NextFloor/security/advisories/new).
Include what you found, the NextFloor and Home Assistant versions and, if you can, how to reproduce it. You get an answer within a few days; a confirmed problem is fixed in a patch release and credited in the changelog unless you prefer otherwise.
## What NextFloor does and does not do
- It does not talk to the internet on its own and has no account or cloud part.
- Plugins run with the same rights as NextFloor in your browser, so install only plugins whose source you trust (the plugin store pins every file by sha256).
- Shared plans and share views are built from an allowlist and carry no entity ids, areas, map position or other data of your home.
-18
View File
@@ -1,18 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#16243f"/><stop offset="1" stop-color="#0a1222"/></linearGradient>
<linearGradient id="top" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5fe0ff"/><stop offset="1" stop-color="#2f8bff"/></linearGradient>
<linearGradient id="mid" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#8ab6f5"/><stop offset="1" stop-color="#5e8ad6"/></linearGradient>
<linearGradient id="low" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#5f7fb6"/><stop offset="1" stop-color="#43608f"/></linearGradient>
<filter id="glow" x="-80%" y="-80%" width="260%" height="260%"><feGaussianBlur stdDeviation="9" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
</defs>
<rect width="512" height="512" rx="112" fill="url(#bg)"/>
<!-- the next floor, not built yet -->
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="#5fe0ff" stroke-opacity=".55" stroke-width="7" stroke-dasharray="4 16" stroke-linecap="round" stroke-linejoin="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="url(#low)" />
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="url(#mid)" />
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="url(#top)" />
<!-- the light that is on -->
<ellipse cx="256" cy="238" rx="40" ry="22" fill="#ffd86b" fill-opacity=".30" filter="url(#glow)"/>
<circle cx="256" cy="236" r="14" fill="#ffe08a" filter="url(#glow)"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

-22
View File
@@ -1,22 +0,0 @@
MIT License
Copyright (c) 2026 Mastershort
Copyright (c) 2026 therealMRBK
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -1,76 +0,0 @@
# Third-party notices
NextFloor ships the following third-party software inside its bundles
(`custom_components/nextfloor/frontend/`). Their licence texts are reproduced here, as they require.
NextFloor itself is released under the MIT licence (see `LICENSE`).
## three.js 0.186.1 (MIT)
<https://threejs.org>
```
The MIT License
Copyright © 2010-2026 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```
## Lit 3.3.3 (BSD-3-Clause)
Includes `lit-html` 3.3.3, `lit-element` 4.2.2 and `@lit/reactive-element` 2.1.2, all by Google LLC under the same licence.
<https://lit.dev>
```
BSD 3-Clause License
Copyright (c) 2017 Google LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
## Build and development tools
TypeScript (Apache-2.0), esbuild (MIT) and puppeteer-core (Apache-2.0) are used to build and test the project.
They are not part of what is distributed.
-115
View File
@@ -1,115 +0,0 @@
"""NextFloor: draw your home in Home Assistant and control it in 3D."""
from __future__ import annotations
import hashlib
from pathlib import Path
from homeassistant.components import frontend, panel_custom
from homeassistant.components.http import StaticPathConfig
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import async_get_integration
from .announce import async_register_announce
from .card_resource import async_remove_card_resource, async_schedule_card_resource
from .const import (
DOMAIN,
MAIN_BUNDLE,
PANEL_COMPONENT,
PANEL_ICON,
PANEL_TITLE,
PANEL_URL_PATH,
URL_BASE,
)
from .meshes import async_register_mesh_view
from .storage import NextFloorData
from .store_notice import async_notify_official_store
from .websocket import async_register_commands
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
_STATIC_REGISTERED = f"{DOMAIN}_static_registered"
# sensors from the plan: open windows and doors, lights on (per floor and for the house)
PLATFORMS = [Platform.SENSOR]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Register the websocket commands and the actions once."""
async_register_commands(hass)
async_register_mesh_view(hass)
async_register_announce(hass)
return True
_MAIN_URL = f"{DOMAIN}_main_url"
def _bundle_hash() -> str:
"""A short hash of the main bundle: a rebuilt bundle gets a new URL even when the version stays."""
path = Path(__file__).parent / "frontend" / MAIN_BUNDLE
try:
return hashlib.sha256(path.read_bytes()).hexdigest()[:10]
except OSError:
return "0"
async def _async_main_url(hass: HomeAssistant) -> str:
# computed once per run, so adding and removing the script use the same URL
if url := hass.data.get(_MAIN_URL):
return url
integration = await async_get_integration(hass, DOMAIN)
digest = await hass.async_add_executor_job(_bundle_hash)
url = f"{URL_BASE}/{MAIN_BUNDLE}?v={integration.version}-{digest}"
hass.data[_MAIN_URL] = url
return url
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Load the stores and register the frontend (panel and card)."""
data = NextFloorData(hass)
await data.async_load()
hass.data[DOMAIN] = data
# static paths cannot be unregistered, so they are registered once per run
if not hass.data.get(_STATIC_REGISTERED):
await hass.http.async_register_static_paths(
[StaticPathConfig(URL_BASE, str(Path(__file__).parent / "frontend"), cache_headers=False)]
)
hass.data[_STATIC_REGISTERED] = True
url = await _async_main_url(hass)
frontend.add_extra_js_url(hass, url)
# and as a dashboard resource, so a dashboard never draws the card before its script is there (#252)
async_schedule_card_resource(hass, url)
await panel_custom.async_register_panel(
hass,
frontend_url_path=PANEL_URL_PATH,
webcomponent_name=PANEL_COMPONENT,
sidebar_title=PANEL_TITLE,
sidebar_icon=PANEL_ICON,
module_url=url,
require_admin=False,
config={},
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
await async_notify_official_store(hass, entry)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Remove panel, card and sensors."""
await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
frontend.async_remove_panel(hass, PANEL_URL_PATH)
frontend.remove_extra_js_url(hass, await _async_main_url(hass))
hass.data.pop(DOMAIN, None)
return True
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""The plan, its pictures and packs stay in .storage when the integration is removed: they are the
user's work, and removing and re-adding the integration must never cost it."""
await async_remove_card_resource(hass)
-347
View File
@@ -1,347 +0,0 @@
"""Announcements: the action nextfloor.announce speaks a message in rooms of the plan and on the open NextFloor screens.
Each room speaks through its own speaker: the one chosen for the room in the plan, else one placed in the room, else
one of the room's area. A voice satellite announces with its chime, an Echo through its announce entity (Alexa Devices)
or as an announcement (Alexa Media Player), a speaker that can announce (Sonos and others) lowers its music for it, any
other speaker plays it through text-to-speech. TVs and speakers that are off are never picked by themselves. Rooms
with a quiet time are left out while it runs, unless the announcement names only that room.
"""
from __future__ import annotations
from datetime import time as dtime
import logging
from typing import Any
from homeassistant.core import HomeAssistant, ServiceCall, SupportsResponse, callback
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.util import dt as dt_util
import voluptuous as vol
from .const import DOMAIN, SIGNAL_ANNOUNCE
_LOGGER = logging.getLogger(__name__)
SERVICE_ANNOUNCE = "announce"
ANNOUNCE_SCHEMA = vol.Schema(
{
vol.Required("message"): vol.All(cv.string, vol.Length(min=1, max=500)),
# rooms by name, room id or area id; none and no floor: every room with a speaker
vol.Optional("rooms"): vol.All(cv.ensure_list, [cv.string]),
vol.Optional("floor"): cv.string,
vol.Optional("on_speakers", default=True): cv.boolean,
vol.Optional("on_screens", default=True): cv.boolean,
# only the NextFloor screens with these names (set on each screen); none: every screen
vol.Optional("screens"): vol.All(cv.ensure_list, [cv.string]),
# a text-to-speech entity instead of the one chosen in the plan (or the first one)
vol.Optional("tts_entity"): cv.entity_id,
}
)
_TV_CLASSES = {"tv"}
# MediaPlayerEntityFeature.MEDIA_ANNOUNCE: the speaker lowers what it plays for the announcement and carries on after
_MEDIA_ANNOUNCE = 1048576
class NoSpeech(Exception):
"""A speaker that needs text-to-speech while there is no text-to-speech entity."""
def _point_in(points: list[list[float]], x: float, z: float) -> bool:
"""Ray casting: whether (x, z) lies inside the polygon."""
inside = False
j = len(points) - 1
for i, (xi, zi) in enumerate(points):
xj, zj = points[j]
if (zi > z) != (zj > z) and x < (xj - xi) * (z - zi) / ((zj - zi) or 1e-12) + xi:
inside = not inside
j = i
return inside
def _parse_time(text: Any) -> dtime | None:
try:
hours, minutes = str(text).split(":")[:2]
return dtime(int(hours), int(minutes))
except (ValueError, TypeError):
return None
def in_quiet_time(room: dict[str, Any], now: dtime) -> bool:
"""Whether the room's quiet time runs at `now` (a time span over midnight works too)."""
quiet = room.get("announce_quiet") or {}
start, end = _parse_time(quiet.get("from")), _parse_time(quiet.get("to"))
if start is None or end is None or start == end:
return False
return start <= now < end if start < end else now >= start or now < end
def _matches(room: dict[str, Any], wanted: str) -> bool:
key = wanted.strip().casefold()
return key in (
str(room.get("id", "")).casefold(),
str(room.get("area_id") or "").casefold(),
str(room.get("name", "")).strip().casefold(),
)
def target_rooms(
building: dict[str, Any], rooms: list[str] | None, floor: str | None
) -> tuple[list[tuple[dict, dict]], bool]:
"""The (floor, room) pairs an announcement goes to, and whether exactly the rooms asked for were named."""
pairs = [(f, r) for f in building.get("floors", []) for r in f.get("rooms", [])]
if floor:
key = floor.strip().casefold()
pairs = [
(f, r)
for f, r in pairs
if key
in (
str(f.get("id", "")).casefold(),
str(f.get("name", "")).strip().casefold(),
str(f.get("ha_floor") or "").casefold(),
)
]
if rooms:
pairs = [(f, r) for f, r in pairs if any(_matches(r, w) for w in rooms)]
return pairs, True
return pairs, False
def _area_entities(hass: HomeAssistant, area_id: str | None) -> list[str]:
if not area_id:
return []
ent_reg = er.async_get(hass)
dev_reg = dr.async_get(hass)
found = []
for entry in ent_reg.entities.values():
if entry.disabled_by or entry.hidden_by:
continue
area = entry.area_id
if area is None and entry.device_id and (device := dev_reg.async_get(entry.device_id)):
area = device.area_id
if area == area_id:
found.append(entry.entity_id)
return found
def _is_echo_announce(hass: HomeAssistant, entity_id: str) -> bool:
"""The announce entity of an Echo (Alexa Devices: a notify entity whose unique id ends in "-announce")."""
if not entity_id.startswith("notify."):
return False
entry = er.async_get(hass).async_get(entity_id)
return entry is not None and str(entry.unique_id).endswith("-announce")
def _usable_speaker(hass: HomeAssistant, entity_id: str) -> bool:
"""A speaker that may be picked by itself: no TV, not off or gone. An Echo's announce entity has no state to ask."""
st = hass.states.get(entity_id)
if st is None or st.state == "unavailable":
return False
if entity_id.startswith("notify."):
return _is_echo_announce(hass, entity_id)
if st.state in ("off", "unknown"):
return False
return st.attributes.get("device_class") not in _TV_CLASSES
def room_speaker(hass: HomeAssistant, floor: dict[str, Any], room: dict[str, Any]) -> str | None:
"""A room's speaker: chosen in the plan, else placed in the room, else a voice satellite or speaker of its area."""
chosen = room.get("announce_speaker")
if chosen == "none":
return None
if chosen:
return chosen
points = room.get("points") or []
if len(points) >= 3:
placed = [
p["entity_id"]
for p in floor.get("placements", [])
if str(p.get("entity_id", "")).startswith(("media_player.", "assist_satellite."))
and _point_in(points, float(p.get("x", 0)), float(p.get("z", 0)))
]
placed += [
f["entity"]
for f in floor.get("furniture", [])
if str(f.get("entity") or "").startswith(("media_player.", "assist_satellite."))
and _point_in(points, float(f.get("x", 0)), float(f.get("z", 0)))
]
for entity_id in placed:
if _usable_speaker(hass, entity_id):
return entity_id
area = _area_entities(hass, room.get("area_id"))
for domain in ("assist_satellite.", "notify.", "media_player."):
for entity_id in sorted(e for e in area if e.startswith(domain)):
if _usable_speaker(hass, entity_id):
return entity_id
return None
def _announce_entity(hass: HomeAssistant, media_player: str) -> str | None:
"""The announce entity of the same device (an Echo of the Alexa Devices integration)."""
ent_reg = er.async_get(hass)
entry = ent_reg.async_get(media_player)
if entry is None or entry.device_id is None:
return None
for other in er.async_entries_for_device(ent_reg, entry.device_id):
if other.domain == "notify" and str(other.unique_id).endswith("-announce"):
return other.entity_id
return None
def _platform(hass: HomeAssistant, entity_id: str) -> str | None:
entry = er.async_get(hass).async_get(entity_id)
return entry.platform if entry else None
def _tts_entity(hass: HomeAssistant, building: dict[str, Any], wanted: str | None) -> str | None:
"""The text-to-speech entity: asked for, chosen in the plan, else the first one."""
for candidate in (wanted, (building.get("settings") or {}).get("announce_tts")):
if candidate and candidate != "none" and hass.states.get(candidate):
return candidate
entities = sorted(hass.states.async_entity_ids("tts"))
return entities[0] if entities else None
async def _speak(hass: HomeAssistant, speaker: str, message: str, tts: str | None) -> str:
"""Say the message on one speaker; returns how (for the response). Raises NoSpeech when it needs text-to-speech."""
if speaker.startswith("assist_satellite."):
await hass.services.async_call(
"assist_satellite", "announce", {"entity_id": speaker, "message": message}, blocking=True
)
return "satellite"
announce = speaker if speaker.startswith("notify.") else _announce_entity(hass, speaker)
if announce:
await hass.services.async_call(
"notify", "send_message", {"entity_id": announce, "message": message}, blocking=True
)
return "echo"
if _platform(hass, speaker) == "alexa_media" and hass.services.has_service("notify", "alexa_media"):
await hass.services.async_call(
"notify",
"alexa_media",
{"message": message, "target": [speaker], "data": {"type": "announce"}},
blocking=True,
)
return "echo"
if tts is None:
raise NoSpeech
st = hass.states.get(speaker)
features = int(st.attributes.get("supported_features", 0)) if st else 0
if features & _MEDIA_ANNOUNCE:
media_id = tts_media_id(hass, message, tts)
await hass.services.async_call(
"media_player",
"play_media",
{"entity_id": speaker, "media_content_id": media_id, "media_content_type": "music", "announce": True},
blocking=True,
)
return "announce"
await hass.services.async_call(
"tts",
"speak",
{"entity_id": tts, "media_player_entity_id": speaker, "message": message, "cache": True},
blocking=True,
)
return "tts"
def tts_media_id(hass: HomeAssistant, message: str, tts: str) -> str:
"""The media source id of the spoken message (text-to-speech is loaded only when it is needed)."""
from homeassistant.components.tts import generate_media_source_id
return generate_media_source_id(hass, message, engine=tts, cache=True)
async def screen_audio(hass: HomeAssistant, tts: str | None, message: str) -> str | None:
"""A URL with the spoken message for the screens (None: they speak with the browser's own voice)."""
if tts is None:
return None
try:
from homeassistant.components import media_source
resolved = await media_source.async_resolve_media(hass, tts_media_id(hass, message, tts), None)
except Exception as err: # any engine error just leaves the screens to the browser's voice
_LOGGER.debug("No text-to-speech audio for the screens: %s", err)
return None
return resolved.url
async def async_announce(hass: HomeAssistant, building: dict[str, Any], data: dict[str, Any]) -> dict[str, Any]:
"""Speak an announcement on the rooms' speakers and send it to the NextFloor screens."""
message: str = data["message"]
tts = _tts_entity(hass, building, data.get("tts_entity"))
spoken: dict[str, str] = {}
skipped: dict[str, str] = {}
if data.get("on_speakers", True):
pairs, named = target_rooms(building, data.get("rooms"), data.get("floor"))
if data.get("rooms") and not pairs:
raise ServiceValidationError(translation_domain=DOMAIN, translation_key="no_rooms")
now = dt_util.now().time()
done: set[str] = set()
for floor, room in pairs:
name = room.get("name") or room.get("id", "")
# a quiet room only hears what is meant for it alone
if in_quiet_time(room, now) and not (named and len(pairs) == 1):
skipped[name] = "quiet"
continue
speaker = room_speaker(hass, floor, room)
if speaker is None:
if named:
skipped[name] = "no_speaker"
continue
if speaker in done:
continue
done.add(speaker)
try:
spoken[speaker] = await _speak(hass, speaker, message, tts)
except NoSpeech:
skipped[name] = "no_tts"
except Exception as err: # one speaker failing must not stop the others
_LOGGER.warning("Announcement on %s failed: %s", speaker, err)
skipped[name] = "failed"
on_screens = bool(data.get("on_screens", True))
if on_screens:
audio = await screen_audio(hass, tts, message)
payload = {
"message": message,
"screens": data.get("screens") or [],
"audio": audio,
"time": dt_util.utcnow().isoformat(),
}
async_dispatcher_send(hass, SIGNAL_ANNOUNCE, payload)
# nobody heard it because no speaker could talk: say why instead of failing silently
if not spoken and not on_screens and skipped and all(why == "no_tts" for why in skipped.values()):
raise ServiceValidationError(translation_domain=DOMAIN, translation_key="no_tts")
return {"speakers": spoken, "skipped": skipped, "screens": on_screens}
RELOAD_SCHEMA = vol.Schema({vol.Optional("template"): vol.All(cv.string, vol.Length(max=64))})
@callback
def async_register_announce(hass: HomeAssistant) -> None:
"""Register the actions nextfloor.announce and nextfloor.reload_screens."""
async def reload_screens(call: ServiceCall) -> None:
# the open screens load their page again, some seconds apart; with a template only the cards that use it
payload = {"reload": True, "template": call.data.get("template"), "time": dt_util.utcnow().isoformat()}
async_dispatcher_send(hass, SIGNAL_ANNOUNCE, payload)
hass.services.async_register(DOMAIN, "reload_screens", reload_screens, schema=RELOAD_SCHEMA)
async def handle(call: ServiceCall) -> dict[str, Any] | None:
data = hass.data.get(DOMAIN)
if data is None:
raise ServiceValidationError(translation_domain=DOMAIN, translation_key="not_loaded")
result = await async_announce(hass, data.building, call.data)
return result if call.return_response else None
hass.services.async_register(
DOMAIN, SERVICE_ANNOUNCE, handle, schema=ANNOUNCE_SCHEMA, supports_response=SupportsResponse.OPTIONAL
)
-167
View File
@@ -1,167 +0,0 @@
"""Locate a Bluetooth tag by room, learned by walking.
Every Bluetooth scanner Home Assistant knows (ESPHome Bluetooth proxies, Shelly devices with Bluetooth scanning on, the
host's own adapters) hears a tag with a different signal strength. While you walk from room to room with the tag, the
editor records that pattern per room (a fingerprint). Later the current pattern is compared with the fingerprints and
the nearest room wins. Nothing here talks to the tag; it only reads what the scanners already report.
"""
from __future__ import annotations
from collections.abc import Iterable, Mapping
import math
import statistics
from typing import Any
from homeassistant.core import HomeAssistant
# a scanner that does not hear the tag counts as this (dBm); differences are capped, so one odd scanner cannot decide
MISSING = -100.0
MAX_DIFF = 40.0
# above this distance (RMS over the scanners, in dB) no room is a good match
UNKNOWN_DISTANCE = 18.0
# a new room has to win this many readings in a row before the sensor switches
SWITCH_VOTES = 3
Reading = Mapping[str, float]
def distance(a: Reading, b: Reading) -> float:
"""The distance between two signal patterns: RMS of the per-scanner differences in dB."""
keys = set(a) | set(b)
if not keys:
return math.inf
total = sum(min(abs(a.get(k, MISSING) - b.get(k, MISSING)), MAX_DIFF) ** 2 for k in keys)
return math.sqrt(total / len(keys))
def locate(prints: Iterable[Mapping[str, Any]], reading: Reading) -> tuple[str | None, float, float]:
"""The room that fits a reading best: (room id, its distance in dB, how far the runner-up is behind).
`prints` are {"room": id, "rssi": {scanner: dBm}}; a room may have several (one per spot you recorded there).
No room is returned when nothing is heard or no fingerprint is close enough.
"""
if not reading:
return None, math.inf, 0.0
best: dict[str, float] = {}
for fp in prints:
d = distance(fp.get("rssi") or {}, reading)
room = fp.get("room")
if isinstance(room, str) and d < best.get(room, math.inf):
best[room] = d
if not best:
return None, math.inf, 0.0
ranked = sorted(best.items(), key=lambda kv: kv[1])
room, dist = ranked[0]
if dist > UNKNOWN_DISTANCE:
return None, dist, 0.0
margin = ranked[1][1] - dist if len(ranked) > 1 else UNKNOWN_DISTANCE
return room, dist, margin
def median_reading(samples: Iterable[Reading]) -> dict[str, float]:
"""The median signal per scanner over several samples. A scanner that missed the tag in most samples is left out."""
samples = list(samples)
if not samples:
return {}
out: dict[str, float] = {}
for key in {k for s in samples for k in s}:
values = [s[key] for s in samples if key in s]
if len(values) * 2 > len(samples):
out[key] = round(statistics.median(values), 1)
return out
class Smoother:
"""Keeps the answer from flickering: a different room has to win several readings in a row."""
def __init__(self, votes: int = SWITCH_VOTES) -> None:
self.votes = votes
self.room: str | None = None
self._candidate: str | None = None
self._count = 0
def update(self, room: str | None) -> str | None:
"""Take one reading's room and return the room to show."""
if room == self.room:
self._candidate, self._count = None, 0
return self.room
if room == self._candidate:
self._count += 1
else:
self._candidate, self._count = room, 1
if self._count >= self.votes:
self.room, self._candidate, self._count = room, None, 0
return self.room
def smooth_reading(history: list[dict[str, float]], reading: Reading, size: int = 5) -> dict[str, float]:
"""Adds a reading to the history (newest last, `size` kept) and returns the median over it."""
history.append(dict(reading))
del history[:-size]
return median_reading(history)
def rooms_of(building: Mapping[str, Any]) -> dict[str, dict[str, str]]:
"""Room id -> {"name", "floor"} of every room of the plan."""
out: dict[str, dict[str, str]] = {}
for floor in building.get("floors", []):
for room in floor.get("rooms", []):
out[room["id"]] = {"name": room.get("name") or room["id"], "floor": floor.get("name") or floor["id"]}
return out
def tags_of(building: Mapping[str, Any]) -> list[dict[str, Any]]:
"""The Bluetooth tags set up in the plan."""
ble = building.get("settings", {}).get("ble") or {}
return list(ble.get("tags") or [])
# --- Home Assistant side ---------------------------------------------------------------------------------------------
def available(hass: HomeAssistant) -> bool:
"""Whether Home Assistant's Bluetooth integration is running."""
return "bluetooth" in hass.config.components
def tag_address(hass: HomeAssistant, tag: Mapping[str, Any]) -> str | None:
"""The address to listen for: the fixed one, or the current one of a Private BLE Device tracker."""
if entity := tag.get("entity"):
state = hass.states.get(entity)
current = state.attributes.get("current_address") if state else None
return str(current).upper() if current else None
address = tag.get("address")
return str(address).upper() if address else None
def scanner_readings(hass: HomeAssistant, address: str) -> dict[str, tuple[str, float]]:
"""What every scanner last heard of an address: source -> (scanner name, RSSI in dBm)."""
if not available(hass):
return {}
from homeassistant.components import bluetooth # imported late: Bluetooth is optional
out: dict[str, tuple[str, float]] = {}
for device in bluetooth.async_scanner_devices_by_address(hass, address.upper(), False):
rssi = device.advertisement.rssi
if rssi is not None and rssi > -127:
out[device.scanner.source] = (device.scanner.name, float(rssi))
return out
def discovered(hass: HomeAssistant, limit: int = 80) -> dict[str, Any]:
"""The scanners and the devices they hear, strongest first, for choosing a tag in the editor."""
if not available(hass):
return {"available": False, "scanners": [], "devices": []}
from homeassistant.components import bluetooth
scanners = [{"source": s.source, "name": s.name} for s in bluetooth.async_current_scanners(hass)]
seen: dict[str, dict[str, Any]] = {}
for info in bluetooth.async_discovered_service_info(hass, False):
row = seen.setdefault(info.address, {"address": info.address, "name": info.name, "rssi": -200, "named": False})
row["rssi"] = max(row["rssi"], info.rssi)
# a device without a name shows up with its address as the name
row["named"] = info.name != info.address
row["name"] = info.name
devices = sorted(seen.values(), key=lambda r: (not r["named"], -r["rssi"]))[:limit]
return {"available": True, "scanners": scanners, "devices": devices}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

@@ -1,83 +0,0 @@
"""The dashboard card as a Lovelace resource.
The main bundle is also loaded as an extra frontend module, but in the companion app a dashboard may be drawn
before that module has arrived; the card then stays "Custom element doesn't exist: nextfloor-card" until the
sidebar page is opened (#252). Lovelace waits for its resources before it draws cards, so the card's bundle is
kept in the resource list as well, in storage mode only (YAML resources belong to the user).
"""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import CoreState, Event, HomeAssistant
from .const import MAIN_BUNDLE, URL_BASE
_LOGGER = logging.getLogger(__name__)
def _resources(hass: HomeAssistant) -> Any | None:
"""Lovelace's resource collection when it can be changed (storage mode), else None."""
data = hass.data.get("lovelace")
if data is None:
return None
# since 2025.2 a LovelaceData object, before a dict
resources = data.get("resources") if isinstance(data, dict) else getattr(data, "resources", None)
if resources is None or not hasattr(resources, "async_create_item"):
return None
return resources
def _is_ours(url: str) -> bool:
"""A resource that loads our main bundle: ours, or an older copy of it (another path, an old hand install)."""
return url.split("?")[0].endswith(f"/{MAIN_BUNDLE}")
async def async_ensure_card_resource(hass: HomeAssistant, url: str) -> None:
"""Keep exactly our current bundle URL in the dashboard resources (added once, updated after an update)."""
resources = _resources(hass)
if resources is None:
return
try:
await resources.async_get_info() # loads the collection
ours = [item for item in resources.async_items() if _is_ours(str(item.get("url", "")))]
if not ours:
await resources.async_create_item({"res_type": "module", "url": url})
_LOGGER.debug("Added the dashboard card resource %s", url)
return
for item in ours:
if item.get("url") != url:
# an older version or an old copy of the bundle: it would define the card first, so it points to ours
await resources.async_update_item(item["id"], {"res_type": "module", "url": url})
_LOGGER.debug("Updated dashboard resource %s to %s", item.get("url"), url)
except Exception: # the card still loads as an extra module, this is only a help
_LOGGER.debug("Could not update the dashboard resources", exc_info=True)
def async_schedule_card_resource(hass: HomeAssistant, url: str) -> None:
"""Run once Home Assistant has started (Lovelace and its resources are set up by then)."""
if hass.state is CoreState.running:
hass.async_create_task(async_ensure_card_resource(hass, url))
return
async def _started(_event: Event) -> None:
await async_ensure_card_resource(hass, url)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _started)
async def async_remove_card_resource(hass: HomeAssistant) -> None:
"""When the integration is removed: drop the resources that point to our own static path."""
resources = _resources(hass)
if resources is None:
return
try:
await resources.async_get_info()
for item in list(resources.async_items()):
if str(item.get("url", "")).startswith(f"{URL_BASE}/"):
await resources.async_delete_item(item["id"])
except Exception:
_LOGGER.debug("Could not remove the dashboard resource", exc_info=True)
@@ -1,21 +0,0 @@
"""Config flow for NextFloor (no options: everything is set up in the panel)."""
from __future__ import annotations
from typing import Any
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from .const import DOMAIN, PANEL_TITLE
class NextFloorConfigFlow(ConfigFlow, domain=DOMAIN):
"""Single-step flow."""
VERSION = 1
async def async_step_user(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
"""Confirm and create the entry."""
if user_input is not None:
return self.async_create_entry(title=PANEL_TITLE, data={})
return self.async_show_form(step_id="user")
-27
View File
@@ -1,27 +0,0 @@
"""Constants for NextFloor."""
from __future__ import annotations
DOMAIN = "nextfloor"
STORAGE_VERSION = 1
# minor versions of the building store; each step has a migration in storage.py
STORAGE_MINOR_VERSION = 2
STORAGE_KEY_BUILDING = f"{DOMAIN}.building"
STORAGE_KEY_IMAGES = f"{DOMAIN}.images"
STORAGE_KEY_HISTORY = f"{DOMAIN}.history"
STORAGE_KEY_PACKS = f"{DOMAIN}.packs"
# restore points: at most this many, and a new one only after this pause since the last one
HISTORY_MAX = 20
HISTORY_INTERVAL = 600
URL_BASE = "/nextfloor_static"
MAIN_BUNDLE = "nextfloor.js"
PANEL_URL_PATH = "nextfloor"
PANEL_COMPONENT = "nextfloor-panel"
PANEL_ICON = "mdi:floor-plan"
PANEL_TITLE = "NextFloor"
SIGNAL_BUILDING_UPDATED = f"{DOMAIN}_building_updated"
SIGNAL_ANNOUNCE = f"{DOMAIN}_announce"
@@ -1,295 +0,0 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==U)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,U),V=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,U)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ue}=Object,C=globalThis,ge=C.trustedTypes,Ve=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ve:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=be){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ue(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=x;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===x?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??x,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=x:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===x?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],H()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],H())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(H()),this.O(H()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),se=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
>${i.t(t)}
<select @change=${o=>i.set(e,O(o))}>
${n.map(([o,a])=>l`<option value=${o} ?selected=${o===r}>${i.t(a)}</option>`)}
</select>
</label>`}function le(i,e,t,n){return l`<label class="field"
>${i.t(t)}
<select @change=${r=>i.set(e,Number(O(r))||void 0)}>
${n.map(r=>l`<option value=${r.value} ?selected=${i.value[e]===r.value}>${r.text}</option>`)}
</select>
</label>`}function I(i,e,t,n=""){return l`<label class="field wide"
>${i.t(t)}
<input type="text" placeholder=${n} .value=${i.value[e]??""} @change=${r=>i.set(e,tt(r).trim()||void 0)} />
</label>`}function he(i,e,t,n){let r=n===void 0?"switch":n?"on":"off",o=[["switch","card_flows_switch"],["on","card_flows_on"],["off","card_flows_off"]];return l`<label class="field wide"
>${i.t(t)}
<select @change=${a=>i.set(e,O(a)==="switch"?void 0:O(a)==="on")}>
${o.map(([a,s])=>l`<option value=${a} ?selected=${r===a}>${i.t(s)}</option>`)}
</select>
</label>`}var Pe=V`
:host {
display: block;
color: var(--primary-text-color);
}
h3 {
margin: 18px 0 8px;
font-size: 14px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--secondary-text-color);
}
h3:first-child {
margin-top: 0;
}
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px 12px;
}
[hidden] {
display: none;
}
.wide {
grid-column: 1 / -1;
}
.field {
display: grid;
gap: 4px;
font-size: 13px;
color: var(--secondary-text-color);
}
select,
input[type="number"],
input[type="text"] {
box-sizing: border-box;
width: 100%;
min-height: 40px;
padding: 8px 10px;
border: 1px solid var(--divider-color, rgba(127, 127, 127, 0.4));
border-radius: 8px;
background: var(--card-background-color, transparent);
color: var(--primary-text-color);
font: inherit;
font-size: 14px;
}
.toggle {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 8px 0;
font-size: 14px;
cursor: pointer;
}
.toggle input {
flex: none;
width: 18px;
height: 18px;
margin: 1px 0 0;
accent-color: var(--primary-color);
}
.sub {
display: flex;
flex-wrap: wrap;
gap: 6px 14px;
margin: -2px 0 6px 28px;
}
.chip {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 13px;
cursor: pointer;
}
.chip input {
width: 16px;
height: 16px;
margin: 0;
accent-color: var(--primary-color);
}
.toggle small,
.hint {
display: block;
margin: 2px 0 0;
font-size: 12px;
color: var(--secondary-text-color);
}
@media (max-width: 450px) {
.grid {
grid-template-columns: 1fr;
}
}
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,He(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
<legend>${this.form.t("card_rooms")}</legend>
<small>${this.form.t("card_rooms_hint")}</small>
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
</fieldset>`}floorThumbsToggle(){let e=!this._config.floor,t=this._config.floor?"card_floor_thumbs_hint_start":"card_floor_thumbs_hint";return f(this.form,this._config.floor_thumbs??e,"card_floor_thumbs",t,n=>{let r={...this._config};n===e?delete r.floor_thumbs:r.floor_thumbs=n,this.publish(r)})}controlsSection(){let e=this.form,t=this._config.controls,n=!!t&&(t===!0||t.length>0),r=t===!0?[...$]:Array.isArray(t)?t:[],o=s=>e.set("controls",s.length===$.length?!0:s.length>0?s:void 0),a=[0,10,30,60,120].map(s=>({value:s,text:s?e.t("card_hide_after_s",{n:s}):e.t("card_idle_off")}));return l`${f(e,n,"card_controls","card_controls_hint",s=>e.set("controls",s?!0:void 0))}
${f(e,e.value.central,"card_central","card_central_hint",s=>e.set("central",s?void 0:!1))}
${f(e,e.value.lock_button!==!1,"card_lock_button",void 0,s=>e.set("lock_button",s?void 0:!1))}
${f(e,e.value.walk_button!==!1,"card_walk_button",void 0,s=>e.set("walk_button",s?void 0:!1))}
${f(e,e.value.time_travel!==!1,"card_travel_button",void 0,s=>e.set("time_travel",s?void 0:!1))}
${se(e,"marker_names","card_marker_names","card_marker_names_hint")} ${se(e,"controls_hidden","card_controls_hidden","card_controls_hidden_hint")}
${le(e,"controls_hide_after","card_controls_hide_after",a)}
${n?l`<div class="sub">
${$.map(s=>l`<label class="chip">
<input
type="checkbox"
.checked=${r.includes(s)}
@change=${h=>o(h.target.checked?$.filter(u=>u===s||r.includes(u)):r.filter(u=>u!==s))}
/>
${e.t(`card_control_${s}`)}
</label>`)}
</div>`:d}`}kioskSection(){let e=this.form,{night:t}=e.value,n=t==="off"||t==="sun"?t:"time",r=[0,1,2,5,10].map(a=>({value:a*60,text:a?e.t("card_idle_min",{n:a}):e.t("card_idle_off")})),o=[["off","card_night_off"],["sun","card_night_sun"],["time","card_night_time"]];return l`<h3>${e.t("card_section_kiosk")}</h3>
<div class="grid">
${le(e,"idle_return","card_idle_return",r)}
<label class="field"
>${e.t("card_night")}
<select @change=${a=>e.set("night",{off:void 0,sun:"sun",time:"22:00-06:00"}[a.target.value])}>
${o.map(([a,s])=>l`<option value=${a} ?selected=${n===a}>${e.t(s)}</option>`)}
</select>
</label>
${n==="time"?l`<label class="field wide"
>${e.t("card_night_range")}
<input type="text" pattern="\\d{1,2}:\\d{2}-\\d{1,2}:\\d{2}" placeholder="22:00-06:00" .value=${t} @change=${a=>e.set("night",a.target.value.trim()||void 0)} />
</label>`:d}
</div>
<p class="hint">${e.t("card_idle_hint")}</p>
${c(e,"idle_orbit","card_idle_orbit","card_idle_orbit_hint")}
<div class="grid">${I(e,"dashboard","card_dashboard","/lovelace/home")} ${I(e,"dashboard_label","card_dashboard_label")}</div>
<p class="hint">${e.t("card_dashboard_hint")}</p>`}featuresSection(){let e=this.form,t=Object.keys(this.hass?.states??{}).filter(n=>n.startsWith("weather.")).sort();return l`<h3>${e.t("card_section_features")}</h3>
${c(e,"alerts","card_alerts","card_alerts_hint")} ${c(e,"alert_jump","card_alert_jump","card_alert_jump_hint")}
${c(e,"scenes","card_scenes","card_scenes_hint")}
${c(e,"sensor_bar","card_sensor_bar","card_sensor_bar_hint")}
${c(e,"central_open","card_central_open","card_central_open_hint")}
${c(e,"keep_camera","card_keep_camera","card_keep_camera_hint")}
${c(e,"readable","card_readable","readable_hint")}
${c(e,"plain","card_plain","plain_hint")}
${c(e,"right_back","right_back","right_back_hint")}
${this.roomsChoice()}
${c(e,"today","card_today","card_today_hint")}
<label class="field"
>${e.t("view_zoom")}
<select @change=${n=>e.set("zoom",Number(n.target.value))}>
${[.8,1,1.25,1.5,1.75,2,2.5].map(n=>l`<option value=${n} ?selected=${(e.value.zoom??1)===n}>${Math.round(n*100)} %</option>`)}
</select>
</label>
${c(e,"announcements","card_announcements","card_announcements_hint")}
${e.value.announcements!==!1?l`<div class="grid">${I(e,"screen_name","screen_name")}</div>`:d}
${c(e,"weather","card_weather","card_weather_hint")}
${e.value.weather!==!1?l`<div class="grid">
<label class="field wide"
>${e.t("weather_entity")}
<select @change=${n=>e.set("weather_entity",n.target.value||void 0)}>
<option value="" ?selected=${!e.value.weather_entity}>${e.t("card_weather_plan")}</option>
${t.map(n=>l`<option value=${n} ?selected=${n===e.value.weather_entity}>${String(this.hass?.states[n]?.attributes.friendly_name??n)}</option>`)}
</select>
</label>
<label class="field"
>${e.t("card_weather_density")}
<select @change=${n=>e.set("weather_density",Number(n.target.value))}>
${[1,.75,.5,.3,.15].map(n=>l`<option value=${n} ?selected=${(e.value.weather_density??1)===n}>${Math.round(n*100)} %</option>`)}
</select>
</label>
<p class="hint wide">${e.t("card_weather_density_hint")}</p>
</div>`:d}
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
${We.map(r=>l`<label class="field"
>${e.t(`furn_color_${r}`)}
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
</label>`)}
</details>`}viewSection(){let e=this.form,t=e.value;return l`<h3>${e.t("card_section_view")}</h3>
<div class="grid">
${this._templates.length?l`<label class="field wide"
>${e.t("card_template")}
<select @change=${n=>e.set("template",n.target.value||void 0)}>
<option value="" ?selected=${!t.template}>${e.t("card_template_none")}</option>
${this._templates.map(n=>l`<option value=${n} ?selected=${n===t.template}>${n}</option>`)}
${t.template&&!this._templates.includes(t.template)?l`<option value=${t.template} selected>${t.template}</option>`:d}
</select>
</label>`:d}
<label class="field wide"
>${e.t("card_floor")}
<select @change=${n=>e.set("floor",n.target.value||void 0)}>
<option value="" ?selected=${!t.floor}>${e.t("card_floor_house")}</option>
${this._floors.map(n=>l`<option value=${n.id} ?selected=${n.id===t.floor}>${n.name}</option>`)}
${t.floor&&!this._floors.some(n=>n.id===t.floor)?l`<option value=${t.floor} selected>${t.floor}</option>`:d}
</select>
</label>
<label class="field"
>${e.t("card_size")}
<select @change=${n=>e.set("fill",n.target.value==="fill")}>
<option value="fixed" ?selected=${!t.fill}>${e.t("card_size_fixed")}</option>
<option value="fill" ?selected=${t.fill}>${e.t("card_size_fill")}</option>
</select>
</label>
<label class="field" ?hidden=${t.fill}
>${e.t("card_height")}
<input
type="number"
min="150"
max="2000"
step="10"
.value=${String(t.height)}
@change=${n=>{let r=Math.round(Number(n.target.value));r>100&&e.set("height",r)}}
/>
</label>
${w(e,"theme","theme",[["auto","theme_auto"],["neon","theme_neon"],["blueprint","theme_blueprint"],["day","theme_day"]],t.theme)}
${w(e,"clock","clock",[["none","clock_none"],["top_left","clock_top_left"],["top_right","clock_top_right"],["bottom_left","clock_bottom_left"],["bottom_right","clock_bottom_right"]],t.clock??"none")}
<label class="field"
>${e.t("accent")}
<input type="color" .value=${this._config.accent??"#37e0ff"} @input=${n=>e.set("accent",n.target.value)} />
${this._config.accent?l`<button type="button" class="link" @click=${()=>e.set("accent",void 0)}>${e.t("accent_reset")}</button>`:d}
</label>
${this.furnitureColors(e)}
${w(e,"walls","card_walls",[["auto","walls_auto"],["cut","walls_cut"],["slope","walls_slope"]],t.walls)}
${c(e,"solid_walls","card_solid_walls")}
<label class="field" title=${e.t("glass_walls_hint")}
>${e.t("glass_walls")} (${this._config.glass_walls??20} %)
<input type="range" min="0" max="100" step="5" .value=${String(this._config.glass_walls??20)} @change=${n=>{let r=Number(n.target.value);e.set("glass_walls",r===20?void 0:r)}} />
</label>
${w(e,"quality","quality",[["auto","quality_auto"],["low","quality_low"],["high","quality_high"]],t.quality)}
${w(e,"floor_stack","card_floor_stack",[["dim","floor_stack_dim"],["stacked","floor_stack_stacked"],["single","floor_stack_single"]],t.floor_stack)}
</div>
${t.fill?l`<p class="hint">${e.t("card_fill_hint")}</p>`:d}
<p class="hint">${e.t("card_quality_hint")}</p>`}markersOutside(){let e=this.form,t=e.value.markers_outside;return l`${f(e,!!t,"card_markers_outside","card_markers_outside_hint",n=>e.set("markers_outside",n?G.filter(r=>r!=="light"):void 0))}
${t?l`<div class="sub">
${G.map(n=>l`<label class="chip">
<input
type="checkbox"
.checked=${t.includes(n)}
@change=${r=>e.set("markers_outside",r.target.checked?G.filter(o=>o===n||t.includes(o)):t.filter(o=>o!==n))}
/>
${e.t(`marker_kind_${n}`)}
</label>`)}
</div>`:d}`}showSection(){let e=this.form,t=e.value;return l`<h3>${e.t("card_section_show")}</h3>
<div class="grid">
${w(e,"markers","markers",[["none","markers_none"],["important","markers_important"],["all","markers_all"]],t.markers)}
${w(e,"heatmap","heatmap",[["none","heat_off"],["temperature","heat_temperature"],["humidity","heat_humidity"],["co2","heat_co2"],["mould","heat_mould"],["values","heat_values"],["wifi","heat_wifi"]],t.heatmap)}
${he(e,"flows","flows",t.flows)} ${he(e,"holograms","holos",t.holograms)}
</div>
${c(e,"tap_in_room","card_tap_in_room","card_tap_in_room_hint")} ${w(e,"room_double_tap","room_double_tap",[["auto","card_room_double_tap_auto"],["area","room_double_tap_area"],["plan","room_double_tap_plan"],["off","room_double_tap_off"]],t.room_double_tap)} ${this.markersOutside()} ${this.controlsSection()} ${this.floorThumbsToggle()} ${c(e,"room_names","card_room_names")} ${c(e,"energy","card_energy")}
${c(e,"room_buttons","card_room_buttons","card_room_buttons_hint")} ${c(e,"room_panel","card_room_panel","card_room_panel_hint")} ${c(e,"fullscreen_button","card_fullscreen_button","card_fullscreen_button_hint")}
${c(e,"explode","card_explode")} ${c(e,"roof_fade","card_roof_fade","card_roof_fade_hint")} ${c(e,"stats","card_stats","card_stats_hint")}`}render(){return this.hass&&Me(this.hass,this)?d:l`${this.viewSection()} ${this.showSection()} ${this.featuresSection()} ${this.kioskSection()}`}static styles=Pe};customElements.get("nextfloor-card-editor")||customElements.define("nextfloor-card-editor",ue);export{ue as NextFloorCardEditor};
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
(**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
@lit/reactive-element/reactive-element.js:
lit-html/lit-html.js:
lit-element/lit-element.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/is-server.js:
(**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
*/
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-7
View File
@@ -1,7 +0,0 @@
{
"services": {
"announce": {
"service": "mdi:bullhorn"
}
}
}
-26
View File
@@ -1,26 +0,0 @@
{
"domain": "nextfloor",
"name": "NextFloor",
"after_dependencies": [
"bluetooth",
"media_source",
"tts"
],
"codeowners": [
"@therealMRBK"
],
"config_flow": true,
"dependencies": [
"frontend",
"http",
"panel_custom",
"websocket_api"
],
"documentation": "https://github.com/therealMRBK/NextFloor#readme",
"integration_type": "service",
"iot_class": "calculated",
"issue_tracker": "https://github.com/therealMRBK/NextFloor/issues",
"requirements": [],
"single_config_entry": true,
"version": "0.26.6"
}
-87
View File
@@ -1,87 +0,0 @@
"""3D models (binary glTF) you own, kept on your Home Assistant and shown in place of a pack item's simple shape.
NextFloor ships none of them. A pack item names a model with `mesh`; when a file with that id exists in
`<config>/nextfloor_meshes/`, the 3D view draws it, otherwise the item's own parts. Admins upload them (see
docs/models.md); everyone logged in can read them.
"""
from __future__ import annotations
from http import HTTPStatus
from pathlib import Path
import re
from aiohttp import web
from homeassistant.components.http import HomeAssistantView
from homeassistant.core import HomeAssistant
from .const import DOMAIN
MESH_DIR = "nextfloor_meshes"
MAX_BYTES = 12 * 1024 * 1024
_ID = re.compile(r"^[a-z0-9_]{1,48}$")
_REGISTERED = f"{DOMAIN}_mesh_view"
def _path(hass: HomeAssistant, mesh_id: str) -> Path | None:
if not _ID.match(mesh_id):
return None
return Path(hass.config.path(MESH_DIR)) / f"{mesh_id}.glb"
class MeshView(HomeAssistantView):
"""Read, upload (admin) or remove (admin) one model."""
url = "/api/nextfloor/mesh/{mesh_id}"
name = "api:nextfloor:mesh"
requires_auth = True
async def get(self, request: web.Request, mesh_id: str) -> web.Response:
hass: HomeAssistant = request.app["hass"]
path = _path(hass, mesh_id)
if path is None:
return web.Response(status=HTTPStatus.BAD_REQUEST)
data = await hass.async_add_executor_job(lambda: path.read_bytes() if path.is_file() else None)
if data is None:
return web.Response(status=HTTPStatus.NOT_FOUND)
return web.Response(
body=data, content_type="model/gltf-binary", headers={"Cache-Control": "private, max-age=3600"}
)
async def post(self, request: web.Request, mesh_id: str) -> web.Response:
hass: HomeAssistant = request.app["hass"]
if not request["hass_user"].is_admin:
return web.Response(status=HTTPStatus.UNAUTHORIZED)
path = _path(hass, mesh_id)
if path is None:
return web.Response(status=HTTPStatus.BAD_REQUEST)
data = await request.read()
if len(data) > MAX_BYTES:
return web.Response(status=HTTPStatus.REQUEST_ENTITY_TOO_LARGE)
if data[:4] != b"glTF":
return web.Response(status=HTTPStatus.BAD_REQUEST, text="not a binary glTF (.glb) file")
def write() -> None:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(data)
await hass.async_add_executor_job(write)
return web.Response(status=HTTPStatus.CREATED)
async def delete(self, request: web.Request, mesh_id: str) -> web.Response:
hass: HomeAssistant = request.app["hass"]
if not request["hass_user"].is_admin:
return web.Response(status=HTTPStatus.UNAUTHORIZED)
path = _path(hass, mesh_id)
if path is None:
return web.Response(status=HTTPStatus.BAD_REQUEST)
await hass.async_add_executor_job(lambda: path.unlink(missing_ok=True))
return web.Response(status=HTTPStatus.NO_CONTENT)
def async_register_mesh_view(hass: HomeAssistant) -> None:
"""Register the model endpoint once."""
if hass.data.get(_REGISTERED):
return
hass.data[_REGISTERED] = True
hass.http.register_view(MeshView())
-266
View File
@@ -1,266 +0,0 @@
"""Furniture packs: JSON files with furniture models built from boxes, cylinders and lofts.
A pack is plain JSON (format, id, name, publisher, items). The packs that come with the integration
(packs/*.json) are always there, and anyone can import their own.
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import voluptuous as vol
PACK_FORMAT = "nfpack"
PACK_VERSION = 1
# largest pack file accepted (characters of JSON)
MAX_PACK_SIZE = 1_000_000
_ID = vol.All(str, vol.Match(r"^[a-z0-9][a-z0-9_.-]{0,39}$"))
_TEXT = vol.All(str, vol.Length(min=1, max=80))
# a colour: "#rrggbb" or a role of the built-in palette (so packs follow the look of the plan)
_COLOR = vol.Any(
vol.Match(r"^#[0-9a-fA-F]{6}$"),
vol.In(["body", "fabric", "cushion", "wood", "white", "metal", "dark", "glass", "plant", "pot", "accent"]),
)
_FRACTION = vol.All(vol.Coerce(float), vol.Range(min=-0.5, max=0.5))
_SPAN = vol.All(vol.Coerce(float), vol.Range(min=0.001, max=1))
_LEVEL = vol.All(vol.Coerce(float), vol.Range(min=0, max=1))
_METRES = vol.All(vol.Coerce(float), vol.Range(min=0.01, max=10))
def _station(value: Any) -> list[float]:
"""A cross section of a sweep: [z, bottom, top, width] in fractions of the item's depth, height and width."""
if not isinstance(value, (list, tuple)) or len(value) != 4:
raise vol.Invalid("a station is [z, bottom, top, width]")
z, y0, y1, w = (float(v) for v in value)
if not (-0.5 <= z <= 0.5 and 0 <= y0 <= 1 and 0 <= y1 <= 1 and 0.001 <= w <= 1):
raise vol.Invalid("station out of range")
return [z, y0, y1, w]
# Parts in fractions of the item's size: x/z centre (-0.5..0.5, front at +z), w/d extent, y/h bottom
# and height of the item height. A cylinder's diameter is the smaller of w and d.
PART_SCHEMA = vol.Schema(
{
vol.Required("shape"): vol.In(["box", "cyl", "loft", "sweep"]),
vol.Required("x"): _FRACTION,
vol.Required("z"): _FRACTION,
vol.Required("w"): _SPAN,
vol.Required("d"): _SPAN,
vol.Required("y"): _LEVEL,
vol.Required("h"): _SPAN,
vol.Required("color"): _COLOR,
vol.Optional("top"): _COLOR,
# outline: True (soft blue), "glow" (cyan like the walls) or "faint"
vol.Optional("edges", default=False): vol.Any(bool, vol.In(["glow", "faint"])),
# lamps: the part shines in the colour and brightness of the linked light
vol.Optional("glow", default=False): bool,
# a screen (TV, monitor): shows the linked media player's app colour and picture on its front (+z)
vol.Optional("screen", default=False): bool,
# a picture frame's opening: shows the item's own photo (a stored picture, a URL or an image entity)
vol.Optional("picture", default=False): bool,
# a button or socket of a switch plate (0 = the first): glows while the entity of that gang is on
vol.Optional("gang"): vol.All(vol.Coerce(int), vol.Range(min=0, max=7)),
# moves with the item's cover entity: rolls up ("down"), gathers to a side, reaches out ("out") or slides away
vol.Optional("move"): vol.In(["down", "left", "right", "out", "slide_left", "slide_right"]),
# loft: centre and extent of the top rectangle (default: the same as the bottom)
vol.Optional("tx"): _FRACTION,
vol.Optional("tz"): _FRACTION,
vol.Optional("tw"): _SPAN,
vol.Optional("td"): _SPAN,
# sweep: cross sections along z, each [z, bottom, top, width] in fractions of the item's depth, height, width
vol.Optional("stations"): vol.All([_station], vol.Length(min=2, max=48)),
# sweep: how boxy the cross section is (2 = ellipse) and how many points go round it
vol.Optional("exp"): vol.All(vol.Coerce(float), vol.Range(min=1.5, max=8)),
vol.Optional("n"): vol.All(vol.Coerce(int), vol.Range(min=6, max=32)),
# cylinder axis: upright (default) or lying along x or z (wheels, rollers)
vol.Optional("axis"): vol.In(["x", "y", "z"]),
# turn of the part around its own centre (degrees around the vertical axis): spiral steps, diagonals
vol.Optional("rot"): vol.All(vol.Coerce(float), vol.Range(min=-360, max=360)),
# a body part that takes the item's chosen colour (see "colors" of the item)
vol.Optional("paint"): bool,
}
)
# Plan symbol in the same fractions (optional: without it the parts are drawn from above).
SYMBOL_SCHEMA = vol.Any(
vol.Schema(
{
vol.Required("shape"): "rect",
"x": _FRACTION,
"z": _FRACTION,
"w": _SPAN,
"d": _SPAN,
vol.Optional("fill", default=False): bool,
}
),
vol.Schema({vol.Required("shape"): "circle", "x": _FRACTION, "z": _FRACTION, "r": _SPAN}),
vol.Schema({vol.Required("shape"): "line", "x1": _FRACTION, "z1": _FRACTION, "x2": _FRACTION, "z2": _FRACTION}),
)
# A choosable colour of an item (a car's paint): parts with "paint": true are drawn in the chosen one.
COLORWAY_SCHEMA = vol.Schema(
{
vol.Required("id"): vol.All(str, vol.Match(r"^[a-z0-9_]{1,24}$")),
vol.Required("name"): vol.All({vol.All(str, vol.Length(min=2, max=5)): _TEXT}, vol.Length(min=1, max=10)),
vol.Required("hex"): vol.Match(r"^#[0-9a-fA-F]{6}$"),
}
)
# The settings of an item built in the editor's furniture studio, kept so it can be opened there again (sizes in cm).
_COUNT = vol.All(vol.Coerce(int), vol.Range(min=0, max=12))
RECIPE_SCHEMA = vol.Schema(
{
vol.Required("kind"): vol.In(["cabinet", "shelf", "lamp", "device"]),
vol.Required("name"): vol.All(str, vol.Length(max=60)),
vol.Required("w"): vol.All(vol.Coerce(float), vol.Range(min=1, max=1000)),
vol.Required("d"): vol.All(vol.Coerce(float), vol.Range(min=1, max=1000)),
vol.Required("h"): vol.All(vol.Coerce(float), vol.Range(min=1, max=1000)),
vol.Optional("doors", default=0): _COUNT,
vol.Optional("drawers", default=0): _COUNT,
vol.Optional("shelves", default=0): _COUNT,
vol.Optional("base", default="none"): vol.In(["none", "legs", "plinth"]),
vol.Optional("handle", default="none"): vol.In(["bar", "knob", "none"]),
vol.Optional("back", default=False): bool,
vol.Optional("lamp", default="floor"): vol.In(["floor", "table", "pendant", "wall"]),
vol.Optional("display", default=False): bool,
vol.Optional("mount", default="floor"): vol.In(["floor", "surface", "wall"]),
vol.Optional("body", default="body"): _COLOR,
vol.Optional("front", default="body"): _COLOR,
}
)
ITEM_SCHEMA = vol.Schema(
{
vol.Required("id"): _ID,
# names by language ("de", "en", …); "en" or the first one is the fallback
vol.Required("name"): vol.All({vol.All(str, vol.Length(min=2, max=5)): _TEXT}, vol.Length(min=1, max=10)),
vol.Required("size"): vol.All([_METRES], vol.Length(min=3, max=3)),
vol.Optional("electric", default=False): bool,
# a thermostat / heat pump / A/C item: links to a climate entity and may also have a power sensor
vol.Optional("climate", default=False): bool,
# where it stands: on the floor, on the furniture below it, on a wall (bottom at wall_y) or
# hanging from the ceiling
vol.Optional("mount", default="floor"): vol.In(["floor", "surface", "wall", "ceiling"]),
vol.Optional("wall_y", default=1.0): vol.All(vol.Coerce(float), vol.Range(min=0, max=3)),
# its top carries other items (like a table or a worktop)
vol.Optional("surface", default=False): bool,
# a 3D model the owner has put on their Home Assistant (see meshes.py); the parts are the fallback
vol.Optional("mesh"): vol.All(str, vol.Match(r"^[a-z0-9_]{1,48}$")),
# a vehicle: offered for parking spots
vol.Optional("vehicle", default=False): bool,
# moving parts: an open cover pulls them in ("retracts") or out ("extends", an awning), and their rest
vol.Optional("cover"): vol.In(["retracts", "extends"]),
vol.Optional("cover_rest"): vol.All(vol.Coerce(float), vol.Range(min=0, max=1)),
# an animal that roams its room in 3D
vol.Optional("pet", default=False): bool,
# the household: a waste bin (pickup day), a mailbox (post) or a plant (soil moisture), shown from a sensor
vol.Optional("household"): vol.In(["bin", "mail", "plant"]),
# light switches and sockets: how many buttons (gangs) the item has, each linked to its own entity
vol.Optional("gangs"): vol.All(vol.Coerce(int), vol.Range(min=1, max=8)),
# scale every part evenly when resized, instead of keeping legs, arms and plates at their size
vol.Optional("stretch", default=False): bool,
# stairs: when it reaches the floor above, it cuts a stairwell opening into that floor
vol.Optional("hole", default=False): bool,
# a lamp: how its light spreads (like the built-in lamp of that kind)
vol.Optional("light"): vol.In(
[
"ceiling",
"downlight",
"spot",
"panel",
"pendant",
"floor",
"uplight",
"table",
"wall",
"strip",
"bollard",
"garden",
]
),
vol.Required("parts"): vol.All([PART_SCHEMA], vol.Length(min=1, max=60)),
vol.Optional("symbol"): vol.All([SYMBOL_SCHEMA], vol.Length(max=40)),
# colours to choose from; the first one is the default
vol.Optional("colors"): vol.All([COLORWAY_SCHEMA], vol.Length(min=2, max=24)),
vol.Optional("recipe"): RECIPE_SCHEMA,
}
)
PAYLOAD_SCHEMA = vol.Schema(
{
vol.Required("format"): PACK_FORMAT,
vol.Required("version"): PACK_VERSION,
vol.Required("id"): _ID,
vol.Required("name"): _TEXT,
vol.Required("publisher"): _TEXT,
# release number of the pack (a newer release of the same id replaces an installed one)
vol.Optional("release", default=1): vol.All(int, vol.Range(min=1, max=100000)),
vol.Optional("description", default=""): vol.All(str, vol.Length(max=400)),
vol.Required("items"): vol.All([ITEM_SCHEMA], vol.Length(min=1, max=200)),
}
)
class PackError(Exception):
"""A pack that cannot be imported; `code` says why."""
def __init__(self, code: str, detail: str = "") -> None:
"""Keep the reason."""
super().__init__(f"{code}: {detail}" if detail else code)
self.code = code
self.detail = detail
def _sweeps_have_stations(clean: dict[str, Any]) -> None:
for item in clean["items"]:
for part in item["parts"]:
if part["shape"] == "sweep" and not part.get("stations"):
raise PackError("invalid_content", f"{item['id']}: a sweep needs stations")
def validate_payload(payload: Any) -> dict[str, Any]:
"""Check the content of a pack; raises PackError."""
try:
clean = PAYLOAD_SCHEMA(payload)
except vol.Invalid as err:
# a value this version does not know yet (a new item kind of a newer pack release)
if "value must be one of" in str(err):
raise PackError("needs_update", str(err)) from err
raise PackError("invalid_content", str(err)) from err
ids = [item["id"] for item in clean["items"]]
if len(ids) != len(set(ids)):
raise PackError("invalid_content", "item ids must be unique")
_sweeps_have_stations(clean)
for it in clean["items"]:
colors = [c["id"] for c in it.get("colors", [])]
if len(colors) != len(set(colors)):
raise PackError("invalid_content", f"{it['id']}: colour ids must be unique")
return clean
def parse_pack(text: str) -> dict[str, Any]:
"""Parse a pack file and return its checked content."""
if len(text) > MAX_PACK_SIZE:
raise PackError("too_large")
try:
data = json.loads(text)
except ValueError as err:
raise PackError("not_a_pack", "not JSON") from err
if not isinstance(data, dict) or data.get("format") != PACK_FORMAT:
raise PackError("not_a_pack")
return validate_payload(data)
BUILTIN_DIR = Path(__file__).parent / "packs"
def load_builtin_packs() -> list[dict[str, Any]]:
"""The packs that come with the integration (blocking: run in the executor)."""
packs = []
for file in sorted(BUILTIN_DIR.glob("*.json")):
pack = parse_pack(file.read_text(encoding="utf-8"))
packs.append({**pack, "builtin": True})
return packs
File diff suppressed because it is too large. Load diff
Loaded 100 of 853 files, more files were not shown because too many files have changed in this diff. Show more