esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

UART for CO2 Senseair S8 and MH-Z19 #3008

Closed jcastro closed 2 years ago

jcastro commented 2 years ago

The problem

I'm using D1 Mini ESP32. I have 3 UARTs created, one for a SenseAir S8 CO2 sensor, another one for MH-Z19 CO2 sensor and the third one for a PMS7003 PM sensor.

If I remove in the yaml file the S8 sensor and uart configuration the MH-Z19 works fine. If I add it back the MHZ-19 reports

[18:20:42][E][uart:015]: Reading from UART timed out at byte 0!
[18:20:42][W][mhz19:034]: Reading data from MHZ19 failed!

I can reproduce this every time I try it

Which version of ESPHome has the issue?

2022.1.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

core-2021.12.10

What platform are you using?

ESP32

Board

D1 Mini ESP32

Component causing the issue

mhz19

Example YAML snippet

substitutions:
  devicename: oficinaaq
  friendly_name: Oficina

esphome:
  name: $devicename
  platform: ESP32
  board: wemos_d1_mini32

wifi:
  networks:
    - ssid: !secret ssid1
      password: !secret ssid1_password
  domain: .local
  use_address: $devicename.local
  fast_connect: True
  power_save_mode: none
  # Optional manual IP
  manual_ip:
    static_ip: 10.0.10.162
    gateway: 10.0.10.1
    subnet: 255.255.255.0

api:
  services:
    - service: mhz19_calibrate_zero
      then:
        - mhz19.calibrate_zero: my_mhz19_office_id
ota:
    password: !secret ota_password

web_server:

logger:
  #baud_rate: 0
  #hardware_uart: UART0

captive_portal:  

uart:
  - id: uart_one    
    rx_pin: 22
    tx_pin: 21
    baud_rate: 9600
  # - id: uart_two
  #   rx_pin: 18
  #   tx_pin: 19
  #   baud_rate: 9600
  - id: uart_3
    rx_pin: 17
    tx_pin: 16
    baud_rate: 9600

text_sensor:
    - platform: template
      name: $friendly_name Uptime
      id: uptime_human
      icon: mdi:clock-start

sensor:
  # - platform: senseair
  #   id: s8high
  #   co2:
  #     name: "SenseAir CO2 Value"
  #   update_interval: 30s
  #   uart_id: uart_two

  - platform: uptime
    name: $friendly_name Uptime
    id: uptime_sensor
    update_interval: 120s
    internal: true
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? String(days) + "d " : "") +
                (hours ? String(hours) + "h " : "") +
                (minutes ? String(minutes) + "m " : "") +
                (String(seconds) + "s")
              ).c_str();
  - platform: pmsx003
    type: PMSX003
    uart_id: uart_one
    pm_1_0:
      name: $friendly_name PM 1
      accuracy_decimals: 0
    pm_2_5:
      name: $friendly_name PM 2.5
      accuracy_decimals: 0
    pm_10_0:
      name: $friendly_name PM 10
      accuracy_decimals: 0

  - platform: mhz19
    id: my_mhz19_office_id
    uart_id: uart_3
    co2:
     name: $friendly_name CO2
     accuracy_decimals: 0
    update_interval: 30s
    automatic_baseline_calibration: false

Anything in the logs that might be useful for us?

No response

Additional information

No response

jcastro commented 2 years ago

Any idea around this and what could be happening? Thanks a lot!

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.