Hi community,
My first post, so, pls be patient, Im familiar with arduinos, esp8266, etc on IDE, but yaml is a shot in my foot.
so far Im spent more than two weeks with home Assistant, currently runing on Raspi 4 and micro sd (today I will install an external ssd 128gb)
My first project is an wemos D1 mini Pro with an DHT11, relay 5v, and one lcd ssd1306 using I2C
The overall idea is a box wich controls an exaust fan over the shower, once the humidity reach certain value the relay goes on and of course turn on the fan, humidity goes down and the fan goes off with an hysteresis of 2 degrees,
So far I was succed creating T & H entities and one relay entity wich doesnt work, I coudnât control the relay at all, this is the first issue******* SOLVED ⌠the problem was the 3.3v from wemos, Ive put one led in series with the relay command and it works ************
The second problem is to establish a global variable capable to be modified via HA, for instance, default setpoint for relay ON is 60% humidity, but if you want you can change it to 50%
Here part of the code
globals:
- id: "SetPointHumedad"
type: int
restore_value: no
initial_value: '58'
switch:
- platform: gpio
pin: GPIO12
id: "relay"
name: "ducha_extractor"
sensor:
- platform: dht
model: "DHT11"
pin: D3
temperature:
id: "temperatura"
name: "ducha_temperature"
humidity:
id: "humedad"
name: "ducha_humidity"
on_value_range:
- above: 60.0
then:
- switch.turn_on: "relay"
- below: 58.0
then:
- switch.turn_off: "relay"
update_interval: 10s
i2c:
sda: D2
scl: D1
font:
- file: 'NunitoSans-Regular.ttf'
id: font1
size: 17
- file: 'NunitoSans-Regular.ttf'
id: font2
size: 22
- file: 'NunitoSans-Regular.ttf'
id: font3
size: 40
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.printf(0, 0, id(font2), "%.1f°C %.f%%", id(temperatura).state, id(humedad).state);
it.printf(0, 25, id(font1), "Setpoint");
it.printf(0, 42, id(font1), "Humedad");
it.printf(80, 20, id(font3), "60"); ### harcoded just to see how it looks ###
INFO Reading configuration /config/esphome/ducha-suite.yaml...
INFO Starting log output from 192.168.68.110 using esphome API
INFO Successfully connected to 192.168.68.110
[13:58:14][I][app:102]: ESPHome version 2022.5.1 compiled on Jun 14 2022, 12:07:24
[13:58:14][C][wifi:491]: WiFi:
[13:58:14][C][wifi:353]: Local MAC: CC:50:E3:63:70:48
[13:58:14][C][wifi:354]: SSID: [redacted]
[13:58:14][C][wifi:355]: IP Address: 192.168.68.110
[13:58:14][C][wifi:356]: BSSID: [redacted]
[13:58:14][C][wifi:358]: Hostname: 'ducha-suite'
[13:58:14][C][wifi:360]: Signal strength: -70 dB ââââ
[13:58:14][C][wifi:364]: Channel: 8
[13:58:14][C][wifi:365]: Subnet: 255.255.255.0
[13:58:14][C][wifi:366]: Gateway: 192.168.68.1
[13:58:14][C][wifi:367]: DNS1: 0.0.0.0
[13:58:14][C][wifi:368]: DNS2: 0.0.0.0
[13:58:14][C][logger:274]: Logger:
[13:58:14][C][logger:275]: Level: DEBUG
[13:58:14][C][logger:276]: Log Baud Rate: 115200
[13:58:14][C][logger:277]: Hardware UART: UART0
[13:58:14][C][i2c.arduino:038]: I2C Bus:
[13:58:14][C][i2c.arduino:039]: SDA Pin: GPIO4
[13:58:14][C][i2c.arduino:040]: SCL Pin: GPIO5
[13:58:14][C][i2c.arduino:041]: Frequency: 50000 Hz
[13:58:14][C][i2c.arduino:044]: Recovery: bus successfully recovered
[13:58:14][I][i2c.arduino:054]: Results from i2c bus scan:
[13:58:14][I][i2c.arduino:060]: Found i2c device at address 0x3C
[13:58:14][C][switch.gpio:050]: GPIO Switch 'ducha_extractor'
[13:58:14][C][switch.gpio:051]: Pin: GPIO12
[13:58:14][C][switch.gpio:073]: Restore Mode: Restore (Defaults to OFF)
[13:58:14][C][dht:017]: DHT:
[13:58:14][C][dht:018]: Pin: GPIO0
[13:58:14][C][dht:022]: Model: DHT11
[13:58:14][C][dht:027]: Update Interval: 10.0s
[13:58:14][C][dht:029]: Temperature 'ducha_temperature'
[13:58:14][C][dht:029]: Device Class: 'temperature'
[13:58:14][C][dht:029]: State Class: 'measurement'
[13:58:14][C][dht:029]: Unit of Measurement: '°C'
[13:58:14][C][dht:029]: Accuracy Decimals: 1
[13:58:14][C][dht:030]: Humidity 'ducha_humidity'
[13:58:14][C][dht:030]: Device Class: 'humidity'
[13:58:14][C][dht:030]: State Class: 'measurement'
[13:58:14][C][dht:030]: Unit of Measurement: '%'
[13:58:14][C][dht:030]: Accuracy Decimals: 0
[13:58:14][C][ssd1306_i2c:023]: I2C SSD1306
[13:58:14][C][ssd1306_i2c:023]: Rotations: 0 °
[13:58:14][C][ssd1306_i2c:023]: Dimensions: 128px x 64px
[13:58:14][C][ssd1306_i2c:024]: Address: 0x3C
[13:58:14][C][ssd1306_i2c:025]: Model: SSD1306 128x64
[13:58:14][C][ssd1306_i2c:027]: External VCC: NO
[13:58:14][C][ssd1306_i2c:028]: Flip X: YES
[13:58:14][C][ssd1306_i2c:029]: Flip Y: YES
[13:58:14][C][ssd1306_i2c:030]: Offset X: 0
[13:58:14][C][ssd1306_i2c:031]: Offset Y: 0
[13:58:14][C][ssd1306_i2c:032]: Inverted Color: NO
[13:58:14][C][ssd1306_i2c:033]: Update Interval: 1.0s
[13:58:14][C][captive_portal:088]: Captive Portal:
[13:58:14][C][mdns:084]: mDNS:
[13:58:14][C][mdns:085]: Hostname: ducha-suite
[13:58:15][C][ota:085]: Over-The-Air Updates:
[13:58:15][C][ota:086]: Address: 192.168.68.110:8266
[13:58:15][C][ota:089]: Using Password.
[13:58:15][C][api:138]: API Server:
[13:58:15][C][api:139]: Address: 192.168.68.110:6053
[13:58:15][C][api:141]: Using noise encryption: YES
[13:58:21][D][dht:048]: Got Temperature=25.9°C Humidity=42.0%
[13:58:21][D][sensor:124]: 'ducha_temperature': Sending state 25.90000 °C with 1 decimals of accuracy
[13:58:21][D][sensor:124]: 'ducha_humidity': Sending state 42.00000 % with 0 decimals of accuracy
[13:58:28][D][switch:013]: 'ducha_extractor' Turning ON.
[13:58:28][D][switch:037]: 'ducha_extractor': Sending state ON
[13:58:29][D][switch:017]: 'ducha_extractor' Turning OFF.
[13:58:29][D][switch:037]: 'ducha_extractor': Sending state OFF
[13:58:29][D][switch:013]: 'ducha_extractor' Turning ON.
[13:58:29][D][switch:037]: 'ducha_extractor': Sending state ON
[13:58:30][D][esp8266.preferences:236]: Saving preferences to flash...
[13:58:30][D][switch:017]: 'ducha_extractor' Turning OFF.
[13:58:30][D][switch:037]: 'ducha_extractor': Sending state OFF
[13:58:30][D][switch:013]: 'ducha_extractor' Turning ON.
[13:58:30][D][switch:037]: 'ducha_extractor': Sending state ON
[13:58:31][D][dht:048]: Got Temperature=25.9°C Humidity=42.0%
[13:58:31][D][sensor:124]: 'ducha_temperature': Sending state 25.90000 °C with 1 decimals of accuracy
[13:58:31][D][sensor:124]: 'ducha_humidity': Sending state 42.00000 % with 0 decimals of accuracy
[13:58:31][D][switch:017]: 'ducha_extractor' Turning OFF.
[13:58:31][D][switch:037]: 'ducha_extractor': Sending state OFF
[13:58:31][D][switch:013]: 'ducha_extractor' Turning ON.
[13:58:31][D][switch:037]: 'ducha_extractor': Sending state ON
[13:58:32][D][switch:017]: 'ducha_extractor' Turning OFF.
[13:58:32][D][switch:037]: 'ducha_extractor': Sending state OFF
[13:58:41][D][dht:048]: Got Temperature=25.8°C Humidity=42.0%
[13:58:41][D][sensor:124]: 'ducha_temperature': Sending state 25.80000 °C with 1 decimals of accuracy
[13:58:41][D][sensor:124]: 'ducha_humidity': Sending state 42.00000 % with 0 decimals of accuracy
Thanks in advance
Gus