hallo habe obiges Board lt. den Pinout kann ich nur bestimmte Pins nutzen daher die Frage ob folgender Code so funtionieren Würde ?
oder passen die Pins so nicht ?
Code:
esphome:
name: co2-schlaf
friendly_name: Co2-Schlaf
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "******"
services:
- service: mhz19_calibrate_zero
then:
- mhz19.calibrate_zero: sens1
ota:
password: "*******"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Co2-Schlaf Fallback Hotspot"
password: "qdcwm8axXnEj"
captive_portal:
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
# Serielle Schnittstelle definieren
uart:
rx_pin: GPIO5 # D5
tx_pin: GPIO18 # D18
baud_rate: 9600
# Sensor konfigurieren
sensor:
- platform: mhz19
co2:
name: "MH-Z19 CO2 Value" #Entity-ID in HA
id: co2val
on_value_range: # Schwellwerte für die Ampel
- below: 1200
then:
- switch.turn_on: green_pin
- switch.turn_off: yellow_pin
- switch.turn_off: red_pin
- above: 1200
then:
- switch.turn_off: green_pin
- switch.turn_off: red_pin
- switch.turn_on: yellow_pin
- above: 1800
then:
- switch.turn_off: green_pin
- switch.turn_off: yellow_pin
- switch.turn_on: red_pin
temperature:
name: "MH-Z19 Temperature"
update_interval: 60s
automatic_baseline_calibration: false
id: sens1
# Switch Plattform und GPIOs fuer LEDs definieren
switch:
- platform: gpio
pin: GPIO25 # D25
id: red_pin
name: "CO2 rot"
- platform: gpio
pin: GPIO26 # D26
id: yellow_pin
name: "CO2 gelb"
- platform: gpio
pin: GPIO27 # D27
id: green_pin
name: "CO2 grün"
i2c:
sda: GPI21 # D21
scl: GPI19 # D19
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
lambda: |-
it.printf(0, 0, id(roboto), "Co2: %.0f ppm" id(co2val).state)
oder passen die Pins so nicht ?