MHZ19B-Sensor

Juergen

Member
esphome code :
Code:
esphome:
  name: co2
  friendly_name: co2

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "IXoOrIjRym20fGcCdRc8DcFoVSh7l9w153K342GoCUw="
# Service für  HA
  services:
    - service: mhz19_calibrate_zero
      then:
        - mhz19.calibrate_zero: sens1
ota:
  password: "a9d4ce0a8a39f23e6fd44dc1f788afaf"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: "fKoFQJB7jYMe"

captive_portal:

# serielle Schnittstelle
uart:
  rx_pin: GPIO4
  tx_pin: GPIO5
  baud_rate: 9600


sensor:
  - platform: mhz19
    co2:
      name: "MH-Z19 CO2 Value"
      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: 30s
    automatic_baseline_calibration: False
    id: sens1

# Switch Plattform und GPIOs fuer LEDs definieren
switch:      
  - platform: gpio
    pin: GPIO12
    id: red_pin
    name: "CO2 rot"
  - platform: gpio
    pin: GPIO14
    id: yellow_pin
    name: "CO2 gelb"
  - platform: gpio
    pin: GPIO16
    id: green_pin
    name: "CO2 grün"

Log:
Code:
INFO ESPHome 2023.12.2
INFO Reading configuration /config/esphome/test.yaml...
INFO Starting log output from 192.168.1.165 using esphome API
INFO Successfully connected to co2 @ 192.168.1.165 in 0.003s
INFO Successful handshake with co2 @ 192.168.1.165 in 2.650s
[10:42:56][I][app:102]: ESPHome version 2023.12.2 compiled on Dec 22 2023, 07:33:01
[10:42:56][C][wifi:573]: WiFi:
[10:42:56][C][wifi:405]:   Local MAC: C8:C9:A3:14:5E:D6
[10:42:56][C][wifi:410]:   SSID: [redacted]
[10:42:56][C][wifi:411]:   IP Address: 192.168.1.165
[10:42:56][C][wifi:412]:   BSSID: [redacted]
[10:42:56][C][wifi:414]:   Hostname: 'co2'
[10:42:56][C][wifi:416]:   Signal strength: -52 dB ▂▄▆█
[10:42:56][C][wifi:420]:   Channel: 13
[10:42:56][C][wifi:421]:   Subnet: 255.255.255.0
[10:42:56][C][wifi:422]:   Gateway: 192.168.1.1
[10:42:56][C][wifi:423]:   DNS1: 192.168.1.1
[10:42:56][C][wifi:424]:   DNS2: 0.0.0.0
[10:42:56][C][logger:443]: Logger:
[10:42:56][C][logger:444]:   Level: DEBUG
[10:42:56][C][logger:445]:   Log Baud Rate: 115200
[10:42:56][C][logger:447]:   Hardware UART: UART0
[10:42:56][C][uart.arduino_esp8266:102]: UART Bus:
[10:42:56][C][uart.arduino_esp8266:103]:   TX Pin: GPIO5
[10:42:56][C][uart.arduino_esp8266:104]:   RX Pin: GPIO4
[10:42:56][C][uart.arduino_esp8266:106]:   RX Buffer Size: 256
[10:42:56][C][uart.arduino_esp8266:108]:   Baud Rate: 9600 baud
[10:42:56][C][uart.arduino_esp8266:109]:   Data Bits: 8
[10:42:56][C][uart.arduino_esp8266:110]:   Parity: NONE
[10:42:56][C][uart.arduino_esp8266:111]:   Stop bits: 1
[10:42:56][C][uart.arduino_esp8266:115]:   Using software serial
[10:42:56][C][switch.gpio:068]: GPIO Switch 'CO2 rot'
[10:42:56][C][switch.gpio:090]:   Restore Mode: always OFF
[10:42:56][C][switch.gpio:031]:   Pin: GPIO12
[10:42:56][C][switch.gpio:068]: GPIO Switch 'CO2 gelb'
[10:42:56][C][switch.gpio:090]:   Restore Mode: always OFF
[10:42:56][C][switch.gpio:031]:   Pin: GPIO14
[10:42:56][C][switch.gpio:068]: GPIO Switch 'CO2 grün'
[10:42:56][C][switch.gpio:090]:   Restore Mode: always OFF
[10:42:56][C][switch.gpio:031]:   Pin: GPIO16
[10:42:56][C][mhz19:094]: MH-Z19:
[10:42:56][C][mhz19:095]:   CO2 'MH-Z19 CO2 Value'
[10:42:56][C][mhz19:095]:     Device Class: 'carbon_dioxide'
[10:42:56][C][mhz19:095]:     State Class: 'measurement'
[10:42:56][C][mhz19:095]:     Unit of Measurement: 'ppm'
[10:42:56][C][mhz19:095]:     Accuracy Decimals: 0
[10:42:56][C][mhz19:095]:     Icon: 'mdi:molecule-co2'
[10:42:56][C][mhz19:096]:   Temperature 'MH-Z19 Temperature'
[10:42:56][C][mhz19:096]:     Device Class: 'temperature'
[10:42:56][C][mhz19:096]:     State Class: 'measurement'
[10:42:56][C][mhz19:096]:     Unit of Measurement: '°C'
[10:42:56][C][mhz19:096]:     Accuracy Decimals: 0
[10:42:56][C][mhz19:102]:   Automatic baseline calibration disabled on boot
[10:42:56][C][captive_portal:088]: Captive Portal:
[10:42:56][C][mdns:115]: mDNS:
[10:42:56][C][mdns:116]:   Hostname: co2
[10:42:56][C][ota:097]: Over-The-Air Updates:
[10:42:56][C][ota:098]:   Address: co2.local:8266
[10:42:56][C][ota:101]:   Using Password.
[10:42:56][C][api:139]: API Server:
[10:42:56][C][api:140]:   Address: co2.local:6053
[10:42:56][C][api:142]:   Using noise encryption: YES
[10:43:01][D][mhz19:057]: MHZ19 Received CO₂=400ppm Temperature=20°C Status=0x00
[10:43:01][D][sensor:093]: 'MH-Z19 CO2 Value': Sending state 400.00000 ppm with 0 decimals of accuracy
[10:43:01][D][sensor:093]: 'MH-Z19 Temperature': Sending state 20.00000 °C with 0 decimals of accuracy
[10:43:01][W][component:214]: Component mhz19.sensor took a long time for an operation (0.06 s).
[10:43:01][W][component:215]: Components should block for at most 20-30ms.
der Sensor meldet seid ca. 8h eines konstanten Wert vom 400ppm ( sehr unwarhseinlich) bei Anhauchen geht der auf 900 hoch aber nur kurzzeitig. ist der sensor event. Schadhaft ??

das board ist ein D1 mini Pro von Az-Delivery
 

Zurzeit aktive Besucher

Letzte Anleitungen

Statistik des Forums

Themen
6.150
Beiträge
59.782
Mitglieder
6.216
Neuestes Mitglied
ALF1986
Zurück
Oben