mpg28
Published © GPL3+

Model House (Home Assistant)

Create a model smart home in preparation for a real house.

IntermediateFull instructions provided869
Model House (Home Assistant)

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
I2C 16x2 Arduino LCD Display Module
DFRobot I2C 16x2 Arduino LCD Display Module
×1
LED (generic)
LED (generic)
×3
Resistor 330 ohm
Resistor 330 ohm
×3
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×2

Software apps and online services

Home Assistant
Home Assistant
ESP Home Flasher

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

house_model_bb_HKbSezOr9c.jpg

Code

Wemos board YAML example

YAML
################### Display
i2c:
  sda: 4
  scl: 5

display:
    platform: lcd_pcf8574
    dimensions: 16x2
    address: 0x27
    id : mydisplay
    lambda: |-

      it.printf(0, 0, "$ %.0f", id(btc).state);
      it.printf(0, 1, "%.1f'C", id(inside_temperature).state);
      it.printf(10, 1, "%.1f'C", id(outside_temperature).state);
      it.print(8, 0, "BTC =)");

########################### Temperature and Humidity sensor
sensor:
  - platform: dht
    pin: D0
    temperature:
      name: "Bedroom Temperature"
    humidity:
      name: "Bedroom Humidity"
    update_interval: 30s

######################### Voltage sensor on default A0 
  - platform: adc
    pin: VCC
    name: "VCC Voltage"

 ######################################## Information feed for the display
  - platform: homeassistant
    id: inside_temperature
    entity_id: sensor.bedroom_temperature
    internal: true  

  - platform: homeassistant
    id: outside_temperature
    entity_id: sensor.bme280_temperature
    internal: true      

  - platform: homeassistant
    id: btc
    entity_id: sensor.xbt_usd_ask
    internal: true     
   
############################################ LED lights 
switch:
  - platform: gpio
    pin: D5
    name: "LED Blue"
  - platform: gpio
    pin: D8
    name: "LED Red"
  - platform: gpio
    pin: D3
    name: "LED Yellow "
 
############################### Motion sensor that will turn on the display backlight for 90s when motion detected.
 
binary_sensor:
  - platform: gpio
    pin: D6
    name: "eyeball"
    device_class: motion
    on_press:
      then:
        - binary_sensor.template.publish:
            id: backlight
            state: ON
        - binary_sensor.template.publish:
            id: backlight
            state: OFF
  - platform: template
    id: backlight
    filters:
      - delayed_off: 90s
    on_press:
      then:
        - lambda: |-
            id(mydisplay).backlight();
    on_release:
      then:
        - lambda: |-
            id(mydisplay).no_backlight();
    
########################################## D4 has internal pullup for Switch 1
  - platform: gpio
    pin:
      number: D4
      mode: INPUT_PULLUP
      inverted: True
    name: "Switch 1"
    device_class: light
    filters:
      - delayed_on: 50ms   
      
############################################ D7 has internal pullup for Switch 2 
  - platform: gpio
    pin:
      number: D7
      mode: INPUT_PULLUP
      inverted: True
    name: "Switch 2"
    device_class: light
    filters:
      - delayed_on: 50ms

Credits

mpg28

mpg28

7 projects • 2 followers

Comments