Building a multisensor using WeMos D1 Mini.
Parts:
- ArtMinds Treasure chest - Michaels.com $1
- ESP8266 D1 Mini NodeMCU (WeMos D1 mini clone) - eBay.com $2.20
- AM213 Mini PIR Sensor - eBay.com $1.30
- BH1750 Ambient Light Sensor - eBay.com $1.20
- BME280 Temperature, Pressure, Humidity Sensor - eBay.com $1.30
- Rust-Oleum Chalked Linen White - leftovers
- Miniwax Water Based Polycrylic Protective Finish - leftovers
Software:
- ESPHome - version 1.14.3
- Home Assistant - version 0.103.3
Here are the pictures showing the build.
ESPHome - wemos.yaml
esphome:
name: wemos
platform: ESP8266
board: d1_mini
wifi:
ssid: your_wifi_ssid
password: your_wifi_password
mqtt:
broker: your_mqtt_broker
# Enable logging
logger:
# Enable Home Assistant API
# api:
ota:
# define i2c pins
i2c:
sda: D2
scl: D1
scan: False
sensor:
- platform: bh1750
name: "BH1750 Illuminance"
address: 0x23
update_interval: 1s
- platform: bme280
temperature:
name: "BME280 Temperature"
oversampling: 16x
pressure:
name: "BME280 Pressure"
humidity:
name: "BME280 Humidity"
address: 0x76
update_interval: 60s
binary_sensor:
- platform: gpio
pin: D0
name: "PIR Sensor"
device_class: motionHome Assistant - sensors.yaml
- platform: mqtt
name: "Office Luminance wemos"
state_topic: "wemos/sensor/bh1750_illuminance/state"
unit_of_measurement: "lux"
qos: 0
scan_interval: 60
force_update: true
- platform: mqtt
name: "Office Temperature wemos"
state_topic: "wemos/sensor/bme280_temperature/state"
unit_of_measurement: "°C"
qos: 0
scan_interval: 60
force_update: true
- platform: mqtt
name: "Office Humidity wemos"
state_topic: "wemos/sensor/bme280_humidity/state"
unit_of_measurement: "%"
qos: 0
scan_interval: 60
force_update: true
- platform: mqtt
name: "Office Pressure wemos"
state_topic: "wemos/sensor/bme280_pressure/state"
unit_of_measurement: "hPa"
qos: 0
scan_interval: 60
force_update: trueHome Assistant - binary_sensors.yaml
- platform: mqtt
name: "Office Motion wemos"
state_topic: "wemos/binary_sensor/pir_sensor/state"
qos: 1
payload_on: "ON"
payload_off: "OFF"
device_class: motion
- platform: threshold
name: "Office Luminance Wemos Low Lux"
lower: 25
entity_id: sensor.office_luminance_wemos
- platform: threshold
name: "Office Luminance Wemos High Lux"
upper: 50
entity_id: sensor.office_luminance_wemosHome Assistant - groups.yaml
office:
name: Office
control: hidden
entities:
- sensor.office_luminance_wemos
- sensor.office_temperature_wemos
- sensor.office_humidity_wemos
- sensor.office_pressure_wemos
- binary_sensor.office_motion_wemosHome Assistant - customize.yaml
sensor.office_luminance_wemos:
icon: mdi:weather-sunny
friendly_name: Office Luminance wemos
sensor.office_temperature_wemos:
friendly_name: Office Temperature wemos
sensor.office_humidity_wemos:
icon: mdi:water-percent
friendly_name: Office Humidity wemos
sensor.office_pressure_wemos:
icon: mdi:weight
friendly_name: Office Pressure wemos
binary_sensor.office_motion_wemos:
icon: mdi:run-fast
friendly_name: Office Motion wemosHome Assistant - automations.yaml
- id: office_lamp_on_when_motion_in_office
alias: Office lamp on when motion in office
initial_state: 'on'
trigger:
platform: state
entity_id: binary_sensor.office_motion_wemos
from: 'off'
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.office_automation
state: 'on'
- condition: state
entity_id: binary_sensor.office_luminance_wemos_low_lux
state: 'on'
- condition: state
entity_id: group.household
state: 'home'
action:
service: light.turn_on
entity_id:
- light.office_lamp
- id: office_lamp_off_when_no_motion_in_office
alias: Office lamp off when no motion in office
initial_state: 'on'
trigger:
platform: state
entity_id: binary_sensor.office_motion_wemos
from: 'on'
to: 'off'
for:
minutes: 6
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.office_automation
state: 'on'
- condition: state
entity_id: sensor.office_computer_screen
state: 'off'
action:
service: light.turn_off
entity_id:
- light.office_lampSources:






























