Saturday, 24 August 2019

Home Automation - Project: Black Box

Problem: Have a visual indication from a couple of sensors always visible

Sure, I have them on a Lovelace panel but, I'd like them to be visible without opening a browser or turning on a tablet/phone etc.


Solution: D1 mini with a couple of RGB LEDs attached! 


In this first integration, the two RGB LED's are mounted in a project box under the IR receiver of my 'Media Centre PC'.
It was powered by a separate 5v USB Phone charger but, as my Media PC only goes to sleep (the IR receiver is USB powered all the time) - let's use that instead.

Here's a brief guide to making your own Home Assistant "Black Box". I've also included the ESPHome yaml at the end.


1. Time to get the Soldering Iron out and package the whole thing on some VERO (Strip-board)


2. Re-Build on VERO-board and test. 

3. Trim VERO board to be as small as possible to fit the inside the case.

4. Using the incoming USB connector, solder the 5V & GND to the back of the cable socket. 

5. Hot Glue some foam and secure the D1 Mini to the host board.

6. Drill out and mount the LEDs in some plastic and hot glue to host board.

7. Test again, put everything back together and put back on the shelf... 


Now that everything is setup, tested and working you can make your own automation(s) for colour, brightness, etc...
My LEDs switch between Red & Green. Left indicates my home alarm status and the right one shows another binary sensor. However, you can have them show any colour for different states, controlled by your own automations. 


----------------------------------------------------------------------------------------------



ESPHome Code:



esphome:
  name: black_box1
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret ssid
  password: !secret wifi_password

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

light:
  - platform: rgb
    name: "Left LED"
    id: left_led
    red: left_red
    green: left_green
    blue: left_blue
    restore_mode: ALWAYS_OFF
    
  - platform: rgb
    name: "Right LED"
    id: right_led
    red: right_red
    green: right_green
    blue: right_blue
    restore_mode: ALWAYS_OFF

output:
  - platform: esp8266_pwm
    id: left_red
    pin: D1
    inverted: true
  - platform: esp8266_pwm
    id: left_green
    pin: D2
    inverted: true
  - platform: esp8266_pwm
    id: left_blue
    pin: D3
    inverted: true
    
  - platform: esp8266_pwm
    id: right_red
    pin: D5
    inverted: true 
    # frequency: 1hz  # -- *** Use to make 'RED' flash when on ***
  - platform: esp8266_pwm
    id: right_green
    pin: D6
    inverted: true    
  - platform: esp8266_pwm
    id: right_blue
    pin: D7
    inverted: true

Like my content, found it helpful or just want to support??

Click here: Buy me a Coffee

Or Click here: Stuff we use from Amazon