Hello,
I want to make my bathroom ventilator smarter. I want to read the humidity level and switch the ventilator on when humidity is high. Simple, right? So I’m wondering if I can buy some relay on aliexpress (like sonoff basic), solder humidity sensor on it? If it is based on ESP I will be able to read humidity levels and make automations in HA. The size of the final thing should be as small as possible because I want to install it directly into the fan. Any recommendations are welcome.
You can add an i2c sensor to either Sonoff Basic and Sonoff Mini (and maybe Mini Extreme, but I haven’t tested those) by using the RX test point (GPIO03). I actually use a Basic and DHT22 to run my refrigerator.
Can you please post a couple of pictures of your project and settings?
I can share the ESPHome config, but I don’t think I have any pictures of the project. There are a few versions of the Basic with slightly different layouts so you will need to find a picture of whichever version you have for the pin out. I soldered all connections and used CAT3 telephone wire to connect the sensor to the board.
substitutions:
esphome_name: fridge-controller-diy
project: Fridge Thermostatic Relay
button1_gpio: GPIO0
relay1_gpio: GPIO12
device_ip: 10.0.0.8
gateway_ip: 10.0.0.1
subnet_ip: 255.255.255.0
esphome:
name: ${esphome_name}
esp8266:
board: esp01_1m
# Enable logging
logger:
level: debug
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxx"
ota:
password: !secret ha_ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${esphome_name}
password: !secret ap_password
captive_portal:
sensor:
- platform: dht
pin: GPIO3
temperature:
filters:
- lambda: return x - 1.7;
id: my_temperature_sensor
unit_of_measurement: "°C"
name: "${esphome_name} Temperature"
on_value_range:
- above: 5.8
then:
- switch.turn_on: relay_1
- below: 2
then:
- switch.turn_off: relay_1
- above: 6.8
then:
- switch.turn_on: relay_1
- below: 1.5
then:
- switch.turn_off: relay_1
humidity:
name: "${esphome_name} Humidity"
model: AM2302
switch:
- platform: gpio
name: ${esphome_name}_relay
icon: "mdi:power-socket-us"
pin: $relay1_gpio
restore_mode: RESTORE_DEFAULT_ON
id: relay_1
- platform: restart
name: 'Restart ${esphome_name}'
id: restart_switch
climate:
- platform: bang_bang
name: "Refrigerator Thermostat"
sensor: my_temperature_sensor
visual:
min_temperature: 0 °C
max_temperature: 7 °C
temperature_step: 0.1 °C
default_target_temperature_low: 3.1
default_target_temperature_high: 5.1
cool_action:
- switch.turn_on: relay_1
idle_action:
- switch.turn_off: relay_1
away_config:
default_target_temperature_low: 3.4
default_target_temperature_high: 5.4
time:
- platform: homeassistant
id: homeassistant_time
I use my esphome based wall switch (sonoff m5) together with cheap(est?) wireless ble hygrometer from xiaomi.
Thanks to esphome the setup works independently from HA but is completly controlable at the same time.
If you buy a wifi relay with esp32 you can make use of wireless ble hygrometer without soldering and wires.
Before I tried a setup with zigbee but it was so poorly updating that it easily took 10 minutes or more that the extractor started - with esphome and ble it starts within the first minute of showering.