Skip to content

Commit caef467

Browse files
committed
add floorplan project
1 parent 3b0ad31 commit caef467

8 files changed

+111
-7
lines changed

docs/travel/2025/03 japan.md

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ Some of the things I'm hoping to pickup while we are in Japan:
3232

3333
# Planning
3434

35+
## TODOs
36+
37+
- [x] Purchase flights
38+
- [x] Decide which cities we will be on which days
39+
- [x] Book hotels
40+
- [ ] Buy train tickets
41+
- [ ] Make reservations
42+
3543
## JR Travel
3644

3745
With the changes to JR Pass in 2023, buying the full JR Pass is no longer the best option for flexibility and budget when travelling within Japan. Luckily there are new passes introduced that still meet our use-case (roughly the golden path). During our time in Japan this year, we will be visiting Tokyo, Osaka and Kyoto. The Hokuriku Arch Pass covers all these stops for about half the price of the full JR Pass. Another benefit of getting one of these rail passes is that it covers travel along the Yamanote line.

docs/work/alb_controller_pod_rollout.md

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ date: 2024-07-22
77
title: Zero-downtime deployments behind AWS ALB Controller
88
---
99

10-
1110
This post dives into the initial setup for k8s releases as well as finally solving a long-present issue that has been present when rolling out changes.
1211

1312
## The setup
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
tags:
3+
- WIP
4+
- smarthome
5+
date: "2025-02-27"
6+
title: Building An Interactive Floorplan in Home Assistant
7+
---
8+
9+
# Background
10+
11+
I've recently decided to take a stab at setting up and improving some home automations via [Home Assistant](https://www.home-assistant.io/). After quickly setting up integration with a few smart lights around my unit, I found myself browsing Youtube for some inspiration. That was when I stumbled upon these fancy floorplan dashboards which allowed users to control lights while also updating a small 3d representation of the space. Immediately I knew I had
12+
to create something like that for my own place!
13+
14+
# Process
15+
16+
Luckily I was able to find quite a few tutorials around to get a good sense of how to accomplish something like this.
17+
18+
## Home, SweetHome3D
19+
20+
It all starts with a lovely piece of software called [SweetHome3D](https://www.sweethome3d.com/). SweetHome3D (I will refer to this as SH3D going forward) is an open source project focused on modelling homes, and comes with a plethora of 3D models out of the box. Additionally, more 3D asset libraries can be found [here](https://www.sweethome3d.com/importModels.jsp#ModelsLibraries). I really enjoyed the time spent in this software as it was fairly straight-forward to use, and came fairly feature packed.
21+
22+
I started out with an extremely blurry and distorted image of my floorplan which I imported to SH3D and set a reference scale to based on the known dimensions of the unit (for me, I didn't care for the measurements to be extremely exact and so this helped me get up-and-running much faster).
23+
24+
![Base plan](https://res.cloudinary.com/drwjkxxud/image/upload/v1740634902/unit_glghrv.png)
25+
26+
I traced the outlines to create the walls of the apartment and then marked each room area. From there I start adding in furniture and adjusting things as they go. I would avoid adding anything under the `Lights` tab for now as those will have an impact on the lighting in the render.
27+
28+
![Early model iteration](https://res.cloudinary.com/drwjkxxud/image/upload/v1740634444/Screenshot_2025-02-17_201455_jzj85o.png)
29+
30+
Some notes I had during this process was that I noticed when I tried to get too detailed with textures on furniture, floors and walls, that the end product started looking sloppy and tacky, to avoid this, I leveraged mostly out-of-box models without applied textures, and went in to modify any models that did have textures to just a basic colour scheme. This made it so renders came out (IMO) a lot smoother and pleasing to the eye.
31+
32+
Once you've modelled out something you are happy with, it's time to add some lighting, here I go with primarily with the `Halogen light` sources and a coloured source for the bedroom. I chose to avoid adding physical models for the lighting fixtures entirely as they introduce an additional source of light, however, if you want to do that without impacting your renders, you can set their light power to 0% and then add a light source in its place to have full control over it. Additionally I noted that there didn't seem to be any easy way to have custom light colours outside of the stock colour offerings. If that is desired I would suggest layering different colour light sources on top of each other and tweaking their strengths to achieve your desired lighting colour (i.e RGB-style).
33+
34+
Once you've added your lights in, it is time to start rendering. You want to pan around the model until you find an angle that you are happy with. Once you find that, right click on the 3D view and select `Store point of view`. We do this so that we can get back to that exact angle reference whenever we want which will be important for the renders as it is going to be a still frame where we overlay the light layers onto. Once you're ready, we can right click and enter the `Create a photo` menu. The following is the settings I used but these can be tweaked to your liking.
35+
36+
```
37+
- Quality: best
38+
- Add ceiling lights: false
39+
- Renderer: Sunflow
40+
- Date: 05/22
41+
- Time: 8:22 PM
42+
```
43+
44+
I would create the first render with all lights turned off (you can toggle their visibility in the furniture sidebar). For subsequent renders, I would toggle one light source on (or one group, depending on how you want to manage your smart lights) and toggle everything else off and create another render.
45+
46+
Another thing to note is when creating the renders, the time of day plays a big role in the outcome of the render (assuming you are including lighting into the renders). I found that sunset was the ideal time of day to set the render to (this will vary depending on the date you've selected as well). Rendering at night time made the lighting contrast too much with the interior. I also tried renders in the morning and those came out nicely as well - I just went with sunset for personal preference.
47+
48+
![First render](https://res.cloudinary.com/drwjkxxud/image/upload/v1740634575/home-bedroom_uxmydy.png)
49+
50+
## Cropping the Light Layers
51+
52+
Next I loaded up the light layer renders into GIMP (you can use any photo editor of your choosing that supports transparency) and started cropping out each room/section illuminated by light. By the end of this you should have a working prototype of the floorplan that you can toggle the lights on based on their layer visibility. For my example, this took a lot more time and effort since there were a lot of areas that overlapped (den, foyer, living room, kitchen). This is a bit more tricky as light bleeds out in various areas that we need to crop and account for as well, if you have doors properly segmenting all these areas, this should be no issue at all.
53+
54+
## Configuration Home Assitant
55+
56+
Once all the images are rendered and cropped, we are ready to put it all together in Home Assistant.
57+
58+
```
59+
type: picture-elements
60+
# Base image layer, all lights off
61+
image: local/images/floorplan/home.png
62+
elements:
63+
# Kitchen lights image layer
64+
  - type: image
65+
    entity: light.kitchen
66+
    state_image:
67+
      "on": local/images/floorplan/kitchen_on.png
68+
      "off": local/images/floorplan/transparent.png
69+
    style:
70+
      left: 50%
71+
      top: 50%
72+
      width: 100%
73+
  # Icon to allow us to toggle state from image card
74+
  # Ensure these are added at the bottom (top-most layer), otherwise other layers may cover it
75+
  - type: state-icon
76+
    entity: light.kitchen
77+
    style:
78+
      left: 35%
79+
      top: 50%
80+
    tap_action:
81+
      action: toggle
82+
```
83+
84+
## Results
85+
86+
Anddd... voila! After adding a few more lights to the configuration, I ended up with something like this:
87+
88+
![Floorplan](https://res.cloudinary.com/drwjkxxud/image/upload/v1740634360/2025-02-2700-29-24-ezgif.com-crop_dwyora.gif)
89+
90+
# References
91+
92+
- [A handy video guide that encapsulates everything covered here](https://www.youtube.com/watch?v=9p9PBtM0O8Q)

docs/work/building_ephemeral_environments.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ date: 2024-07-30
66
title: Building Ephemeral Environments
77
---
88

9-
> [!faq]- Disclaimer:
9+
> [!faq] Disclaimer:
1010
> This isn't a guide, this post just outlines my approach at achieving a solution.
1111
1212
# Background

docs/work/enable_metrics_vpc_cni.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2024-10-31
55
title: Enabling metrics for VPC CNI
66
---
77

8-
> [!faq]- Disclaimer:
8+
> [!faq] Disclaimer:
99
> This isn't a guide, this post just outlines my approach at achieving a solution.
1010
1111
## Background

docs/work/metadata_labeling.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ tags:
33
- kubernetes
44
- kustomize
55
- WIP
6+
- work
67
date: 2024-07-30
78
title: Metadata Labeling
89
---

docs/work/observability_stack_on_kubernetes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2024-08-08
55
title: Observability Stack on K8s
66
---
77

8-
> [!faq]- Disclaimer:
8+
> [!faq] Disclaimer:
99
> This isn't a guide, this post just outlines my approach at achieving a solution.
1010
1111
Our observability stack currently runs on a series of EC2 nodes. In an effort to improve scalability and management of the various components for Grafana we are moving to deploy this via Kubernetes

docs/work/structuring_team_repo.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
---
22
tags:
33
- WIP
4+
- work
5+
- terraform
6+
- cicd
7+
- gitops
48
date: 2025-01-13
59
title: Structuring Team Repo
610
---
711

8-
> [!faq]- Disclaimer:
12+
> [!faq] Disclaimer:
913
> This isn't a guide, this post just outlines my thought process and resulting approach.
1014
1115
# Background
@@ -49,11 +53,11 @@ After jotting out some of the big ideas we wanted for this repo, it was time to
4953
1. There was also an idea to version modules using git refs but a good point was raised where multiple terraform modules within one git repo along with code that consumes it doesn't really work and presents a chicken vs egg situation when trying to pull said versioned modules.
5054
2. Another approach was more focused on keeping environments in-line with each other, using `.tfvars` files to layer environmental changes.
5155
1. The benefit of this is also its drawback - that is flexibility within the environment. If additional resources needed to be deployed to staging - this would add a layer of complexity to this approach.
52-
2. Additionally, there was no solid way to manage backend using this approach as variables are not permitted in the backend block and having to introduce a parameter to set the correct state everytime terraform is run against it can be cumbersome in addition to error-prone (I've done something similar in the past working with [[building_ephemeral_environments]] and it was a painpoint then, the only consolidation being those were with ephemeral environments where a mistake could just be wiped and recreated, I would definitely not want to introduce this pattern into a staging -> production scenario.
56+
2. Additionally, there was no solid way to manage backend using this approach as variables are not permitted in the backend block and having to introduce a parameter to set the correct state everytime terraform is run against it can be cumbersome in addition to error-prone (I've done something similar in the [[building_ephemeral_environments | past ]] and it was a painpoint then, the only consolidation being those were with ephemeral environments where a mistake could just be wiped and recreated, I would definitely not want to introduce this pattern into a staging -> production scenario.
5357

5458
Both approaches had the benefit of keeping things DRY. Both also contradict our goal of keeping main a representation of live state in production.
5559

56-
In the end, we settled on a simple, WYSIWYG approach for the structure. Landing on a commonly used structure following a `account/env > region > component` pattern for organizing terraform configuration.
60+
In the end, we settled on a simple, WYSIWYG approach for the structure. Landing on a commonly used structure following a `account/env > region > component` pattern for organizing terraform configuration. Each directory has its own state - and changes are applied on merge.
5761

5862
```
5963
terraform

0 commit comments

Comments
 (0)