Create physical home model with status display with LED single diodes - ESPhome?

Tags: #<Tag:0x00007f3270e705f0>

I’ve got an idea to create a physical home model of our floorplan with LED colour diodes in each room to reflect current status (clean / dirty). I’d like to also put in some physical switches to switch on / off based on status. For my 5 year old and me. Mostly just because the journey of making it will be fun. I’m not yet versed in arduino etc. I am decent at home assistant. don’t have any experience with esphome. happy to learn.

Understand that i could do this completely ‘offline’ i.e. as just a standard electronics setup; but would like some ideas to integrate it into smart home as i could also include lights for lights on / off and all sorts of other things…

Just for FUN!

I’d love to do something like this, just need the time to sit down and plan it.

Here is a good example of someone else doing it:

I’ll give answering a shot. I think the reason why you haven’t gotten any responses just yet is because there’s a lot of different ways you could go about this (and figuring it out is half the fun). But, in any case, here’s my suggestions (2 ideas).

First, I would suggest picking up a few esp8266 devices. You can buy sets of 3-5 of these on Amazon for <20$. There are two main flavors that would be reasonable to pursue, a device called a NodeMCU, and a device called a WEMOS D1 Mini. I think the NodeMCU route is probably going to be easier, unless you’re extremely comfortable with soldering (as the WEMOS D1 typically doesn’t have header pins attached).

With your microcontroller in hand, you can go the route of installing esphome on it. The first time you set it up, you will hook it directly to your PC and flash it with the esphome firmware. I would recommend you try the excellent esphome home assistant add-on, which will help you easily compile esphome with settings to (for instance) connect to your wifi network. Once you’ve got the device setup to connect to your wifi, you can then later rely on “over the air” capabilities and disconnect from your PC. Once you have esphome installed, you can try out the light component (https://esphome.io/index.html#light-components). Depending on the number of rooms you have, and the number of lights you want to have, you may need something like this (to increase the number of GPIO pins you can have available): https://www.adafruit.com/product/815. Or, you could just use another device. BTW, one of the issues in using many small single LED lights is you’ll probably need to use resistors (not necessarily a challenge but just one more thing to buy and solder). This should be enough info to get you started with my first suggested approach.

The second approach is similar but uses a different tool. Again, start with an esp8266 microcontroller, such as the NodeMCU or WEMOS D1 Mini device, but this time install something called WLED firmware (https://github.com/Aircoookie/WLED). Using this firmware, which is built for controlling LED lights, you can essentially buy standard LED strips (a common useful individually addressable LED strip would be ws2812b). If you use a ws2812b strip (which runs at 5v), you can then power the microcontroller off of the same power supply (specifically, with a WEMOS D1 Mini). Caution, again, this will take soldering. Another benefit of going with a standard strip like ws2812b is you can literally cut the strip where you want and then use lead wires to the next LED. With WLED installed, setup segments for each room in your home, and those segments (I think) will show up and be individually controllable in home assistant (so, each room has a segment).

So, the above are examples of two potential routes you could take. If you go with esphome you can also likely build in other cool things. I’ve used it to control servo motors, like the really cheap sg90, or you can build in reed switches (basically open/closed sensors which can be used to show door/window open status, etc.). The world is your oyster if you’re willing to spend the time and are willing to solder, etc.

Here’s a sample bill of materials:

  • Microcontrollers (esp8266 - either a NodeMCU or WEMOS D1 Mini)
  • A power supply (both microcontrollers power off a standard micro USB plug, but if you want to drive a lot of lights you’ll need another power source).
  • Resistors (you can buy a kit of 600+ for sub 20$)
  • A soldering iron
  • The lights (either a strip, or loose LEDs, depending on your approach).
  • Wires
  • Lots and lots of patience and time, depending on the quality you want to achieve. I’m not sure I’d take this project on with a 5 year old…
1 Like

I put this together for a friend of mine a little while ago - he was doing something similar, floorplan of his house with addressable LEDs placed at various locations behind the image.

ESPHome config (paste at the bottom of a basic config file):

binary_sensor:
  - platform: homeassistant
    name: "Front Door"
    entity_id: binary_sensor.front_door
    id: L1

  - platform: homeassistant
    name: "Kitchen Door"
    entity_id: binary_sensor.kitchen_back_door
    id: L2
    
  - platform: homeassistant
    name: "Bedroom Light"
    entity_id: light.master_bedroom_light
    id: L3

light:
  - platform: neopixelbus
    pin: GPIO3
    method: ESP8266_DMA
    num_leds: 23
    name: "Sensor Leds"
    effects:
      - addressable_lambda:
          name: "Sensor States"
          update_interval: 20ms
          lambda: |-
            if (initial_run == true) {
              it.all().fade_to_black(10);
            }
            esphome::homeassistant::HomeassistantBinarySensor* sensors [] = {id(L1), id(L2), id(L3)};
            int i = 0;
            for (esphome::homeassistant::HomeassistantBinarySensor* val : sensors) {
                    if ((val->state)==0) {
                        it[i] = ESPColor(255, 0, 0);
                    }
                    else {
                        it[i] = ESPColor(0, 255, 0);
                    }
                i++;
            }

Basically, define a binary sensor for each item you wish to monitor (in the example there are 3 items), then add the ID’s into the ‘esphome::homeassistant’ line of the effect.
For the config above, a LED is assigned for each sensor, and will toggle to red or green depending on the sensor state.
To use it simply turn on the light entity from home assistant, and set it to the ‘Sensor States’ effect.