The idea

I wanted a dashboard in Home Assistant that shows the temperature of each room on the flat’s floor plan, coloured like a heat map. For the floor plan I started drawing the flat in the online editor of Sweet Home 3D. Before going further, I wanted to see what it would look like in HA. So the first question was: how do you get a 2D SVG out of an .sh3d file?

As in the previous part, I had Claude at my side, this time Claude Code in the terminal. It wrote the converter; I drew, soldered and checked the screenshots.

What’s inside an .sh3d file

An .sh3d file is a ZIP archive, and among other things it holds a Home.xml with the whole plan in readable form:

  • <wall>: start and end point, thickness, and which walls it is joined to at either end (wallAtStart, wallAtEnd),
  • <room>: the corners of the floor polygon and the room’s name,
  • <doorOrWindow>: position, angle, width, depth, whether the model is mirrored, and one <sash> element per opening leaf.

All lengths are in centimetres, so the SVG can use them directly as user units. The converter is about 200 lines of Python, using only the standard library (zipfile, xml.etree).

Walls, doors, rooms

A wall in the file is just a centre line with a thickness. Offset by half the thickness to each side, it gives two side lines. Where two walls are joined, the corner point is the intersection of the matching side lines, so the corners meet mitred, as in the editor. The only catch is that the neighbour may run in the opposite direction, and then its left side is our right:

# Same orientation if the other wall's opposite end joins us; otherwise sides swap.
same = other and other["at_" + ("start" if at_end else "end")] == w["id"]
for name, mine, theirs in (("l", left, ol if same else or_), ("r", right, or_ if same else ol)):
    p = intersect(mine, theirs) if other else None
    pts[name + key] = p or along(mine, w, at_end)

Doors and windows cut a rectangle out of the nearest wall. The swing arcs took the most care. The <sash> element stores its axis and width as fractions of the door’s size, and its angles in Sweet Home 3D’s own convention. I followed the code that draws the plan in the editor: a mirrored model flips the sign of the x axis and of the sweep, and the angles are Java Arc2D angles, which run counter-clockwise on screen. Hence the minus sign on y:

on_arc = lambda deg: to_plan(cx + r * math.cos(math.radians(deg)),
                             cy - r * math.sin(math.radians(deg)))

Every room becomes a <path> whose id is the room’s name from the editor (lobby, kitchen, bathroom…). Later the colouring hooks onto these ids, so it pays to name the rooms in ASCII.

Two lessons from the first renders:

  • ImageMagick’s built-in SVG renderer lies. It didn’t draw the arcs at all, and it didn’t show the thin seams between the wall polygons either. From then on I checked every version in headless Chromium, which renders the way the HA frontend does.
  • The seams came from anti-aliasing. When adjacent wall polygons are separate shapes, a faint line shows where they meet. Merged into a single <path>, the browser rasterises them together, and the seams vanish.

The online editor doesn’t snap the room rectangle to the wall faces, so a 0.5–1.2 cm gap stayed between the floor and the walls. Double clicking inside a closed set of walls with the room tool fixes this: the editor then traces the room along the inner faces by itself.

Into Home Assistant

The SVG went to /config/www with the File editor add-on, and showed up under /local/floorplan.svg in a picture card. It worked, but I had to scroll: the flat is almost square (11.2 × 12.1 m), so at full width on a landscape screen it’s always taller than the screen. The image has to be fitted to the height, which the picture card can’t do.

The ha-floorplan card can, and it is needed for the colouring anyway. I wanted to install it through HACS, but it turned out that since Home Assistant 2026.11 HACS has been built in as the Marketplace (Settings → Marketplace). With the card’s full_height: true option in a panel view there’s no more scrolling, on the computer or on the phone.

Thermometers on the meter readers

Then came the surprise: there wasn’t a single temperature sensor in HA. I did, however, have a handful of DS18B20s, and in three rooms an ESP-12E was already sitting on the meters (see the previous part). The DS18B20 needs only one GPIO and a 4.7 kΩ pull-up resistor:

Wiring of the DS18B20 to the ESP-12E

The DS18B20 on GPIO14 of the ESP-12E, with a 4.7 kΩ pull-up between DQ and 3.3 V. The TO-92 package is shown with its flat side towards you; the waterproof probe’s wires are usually red (VDD), black (GND, grey in the drawing) and yellow (DQ), but check yours. Photos: ESP-12E by Jlaks and DS18B20 probe by Leonardo Postay, both CC BY-SA 4.0, via Wikimedia Commons; the drawing is CC BY-SA 4.0 as well.

On the ESP-12E, GPIO14 is the safe choice. GPIO15 has to be low at boot, GPIO0 and GPIO2 high, and GPIO4/5 are the usual I²C pins of a magnetometer. In ESPHome it takes a few lines:

one_wire:
  - platform: gpio
    pin: GPIO14

sensor:
  - platform: dallas_temp
    name: Temperature
    update_interval: 60s

Things to watch:

  • Self-heating. An ESP8266 on Wi-Fi warms its surroundings by several degrees, so the sensor shouldn’t be soldered onto the board, but hang on a 10–20 cm lead. The first bathroom reading was 25.4 °C; later it settled at 19–20 °C.
  • Placement. The meters sit where the pipes are, not where the room’s air is. The kitchen meter is in the cabinet under the sink, on the cold water pipe, so I fitted a waterproof probe there and led it out of the cabinet. It now peeks out at the top corner of the dishwasher, roughly level with the cabinet fronts, clamped between the dishwasher and the cabinet. I haven’t used that dishwasher in three years; if I ever start, I’ll think of something else.
  • Fakes. Many cheap DS18B20s are clones. It’s worth putting them side by side for an hour before fitting them and comparing the readings.

Colouring

ha-floorplan sets the style and text of SVG elements through rules. It can only write text into an existing <text> element, so the converter puts an empty <room>-temp label in every room. Then each sensor gets a rule like this:

- entity: sensor.esphome_web_13f1ba_temperature
  element: bathroom
  state_action:
    - action: call-service
      service: floorplan.style_set
      service_data:
        style: |
          >
          const h = Math.max(0, Math.min(240, 240 - (parseFloat(entity.state) - 16) * 24));
          return isNaN(h) ? '' : `fill: hsl(${h}, 70%, 65%)`;
    - action: call-service
      service: floorplan.text_set
      service_data:
        element: bathroom-temp
        text: |
          >
          const t = parseFloat(entity.state);
          return isNaN(t) ? '' : `${t.toFixed(1)} °C`;

The hue runs from blue at 16 °C through green at 21 °C to red at 26 °C and above. If the sensor is unavailable, the room stays grey and the label empty.

Polishing

The first live screenshot was in dark mode, and the dark grey walls hardly showed on the dark background. Since ha-floorplan inlines the SVG into the page, it can use the theme’s CSS variables, with the old colours as fallback for viewing it outside HA:

fill: var(--primary-text-color, #333)

The room fill went into a stylesheet rule instead of an inline style. When a sensor goes unavailable, ha-floorplan clears the room’s inline style; an inline default would vanish with it, and the room would turn black.

After that, a few smaller things:

  • Hatched walls. In the editor the walls have a 45° hatch (hatchUp in the file), so they got one here too. The outline is drawn under the hatch: the hatch covers the inner half of the stroke, so between overlapping walls the line disappears, and it only remains on the outer edges.
  • Door arcs on coloured rooms. The arcs are drawn in the theme’s text colour, which got lost on the green rooms. A wider stroke in the background colour underneath fixed it.
  • Labels and arcs. The bathroom’s label sat on the door arc. Now each label goes to the spot nearest the room’s centroid where it fits inside the room and clears every swing arc.

The floor plan in Home Assistant, dark theme

The floor plan in Home Assistant, light theme

Wall precision

The online editor isn’t precise enough with the mouse, however far you zoom in. A check on the export showed that only two walls are slightly skewed, by 3 and 6 mm, which isn’t visible. For precise values, double clicking a wall opens the “Modify walls” dialog, where the coordinates and the thickness can be typed in. Walls drawn in one continuous run are joined, so their corners meet exactly.

Lessons

  • The file format is friendly. A ZIP and an XML: no need for Sweet Home 3D’s own export to get a plan usable for automation.
  • Check the picture, not just the tests. The tests caught the logic, but the seams, the invisible walls in dark mode and the label on the arc only showed up in a real render.
  • The sensors decide. A heat map is only as good as the thermometers behind it; the meter readers’ spots needed some thought to measure the room and not the cabinet.

For now three of the seven rooms have a thermometer: the lobby, the kitchen and the bathroom. The living room, the bedroom, the kids’ room and the toilet are still waiting.