esphome / issues

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

MHZ19 sensor on_turn_on mhz19.abc_enable causes wireless issues. #2821

Open MagieMalone opened 2 years ago

MagieMalone commented 2 years ago

The problem

When I enable the options to enable a switch to dis- or enable the abc feature the wireless connection to the home network is not functioning.

I have tried this before on older versions as well and that gave the same results.

Which version of ESPHome has the issue?

2021.12.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2021.12.1

What platform are you using?

ESP8266

Board

NodeMCU V3 Lua WIFI module integration of ESP8266 + extra memory 32M Flash, USB-serial CH340G

Component causing the issue

MHZ19

Example YAML snippet

Config before:

esphome:
  name: co2sensor
  platform: ESP8266
  board: nodemcuv2

# Enable Home Assistant API
api:

ota:
  password: !secret ota_key

wifi:
  ssid: "buurman"
  password: !secret wpa_key

    # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Co2Sensor Fallback Hotspot"
    password: !secret fallback_pw

captive_portal: 

substitutions:
  # Modify variables based on your settings
  hostname: 'esp_co2'

# Enable Web
web_server:
  port: 80

# Enable logging
logger:
  level: DEBUG

uart:
  rx_pin: D5
  tx_pin: D6
  baud_rate: 9600

sensor:
  - platform: mhz19
    co2:
      name: "MH-Z19 CO2 Value"
    temperature:
      name: "MH-Z19 Temperature"
    update_interval: 60s
    id: mhz19sensor1
binary_sensor:
  - platform: status
    name: $hostname status
switch:
  - platform: template
    name: "MH-Z19 ABC"
    optimistic: true
#    on_turn_on:
#      - mhz19.abc_enable: mhz19sensor1
#    on_turn_off:
#      - mhz19.abc_disable: mhz19sensor1
  - platform: restart
    name: $hostname restart

Enabling the  feature:
esphome:
  name: co2sensor
  platform: ESP8266
  board: nodemcuv2

# Enable Home Assistant API
api:

ota:
  password: !secret ota_key

wifi:
  ssid: "buurman"
  password: !secret wpa_key

    # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Co2Sensor Fallback Hotspot"
    password: !secret fallback_pw

captive_portal: 

substitutions:
  # Modify variables based on your settings
  hostname: 'esp_co2'

# Enable Web
web_server:
  port: 80

# Enable logging
logger:
  level: DEBUG

uart:
  rx_pin: D5
  tx_pin: D6
  baud_rate: 9600

sensor:
  - platform: mhz19
    co2:
      name: "MH-Z19 CO2 Value"
    temperature:
      name: "MH-Z19 Temperature"
    update_interval: 60s
    id: mhz19sensor1
binary_sensor:
  - platform: status
    name: $hostname status
switch:
  - platform: template
    name: "MH-Z19 ABC"
    optimistic: true
    on_turn_on:
      - mhz19.abc_enable: mhz19sensor1
    on_turn_off:
      - mhz19.abc_disable: mhz19sensor1
  - platform: restart
    name: $hostname restart

Anything in the logs that might be useful for us?

Log before:

[D][wifi:385]: Found networks:
[I][wifi:429]: - 'XXXXXXX' (XX:XX:XX:XX:XX:XX) [redacted]▂▄▆█
[D][wifi:430]:     Channel: 11
[D][wifi:431]:     RSSI: -54 dB
[D][wifi:434]: - 'DIRECT-8SLAPTOPmsRd'[redacted] (26:0A:64:4F:7F:F2) [redacted]▂▄▆█
[D][wifi:434]: - 'H368N78FA44'[redacted] (14:60:80:78:FA:44) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo'[redacted] (2A:35:D1:F4:3B:B9) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo7228303'[redacted] (18:35:D1:F4:3B:B9) [redacted]▂▄▆█
[D][wifi:434]: - 'DIRECT-09-HP M181 LaserJet'[redacted] (92:32:4B:3A:0D:09) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo'[redacted] (AE:22:15:8B:11:F0) [redacted]▂▄▆█
[D][wifi:434]: - 'ZiggoD8272A6'[redacted] (AC:22:05:8B:11:F0) [redacted]▂▄▆█
[D][wifi:434]: - 'TMNL-7B67BF'[redacted] (54:25:EA:7B:67:C8) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo'[redacted] (5E:38:D8:38:F1:F1) [redacted]▂▄▆█
[D][wifi:434]: - 'ZiggoC152A92-5G_RPT'[redacted] (70:8B:CD:E4:C4:30) [redacted]▂▄▆█
[D][wifi:434]: - 'Ed en Yvonne'[redacted] (AC:22:05:89:4F:3A) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo'[redacted] (AE:22:15:89:4F:3A) [redacted]▂▄▆█
[D][wifi:434]: - 'Hotel California 2.4'[redacted] (60:A4:4C:A1:6F:08) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo'[redacted] (AE:22:15:1A:25:5F) [redacted]▂▄▆█
[D][wifi:434]: - 'kees en natasja'[redacted] (48:D3:43:A8:F2:C1) [redacted]▂▄▆█
[D][wifi:434]: - 'ziggo-ap-7062701'[redacted] (C8:D1:2A:FB:C2:A0) [redacted]▂▄▆█
[D][wifi:434]: - 'ZiggoC152A92'[redacted] (AC:22:05:1A:25:5F) [redacted]▂▄▆█
[D][wifi:434]: - 'TP-Link_2BBC'[redacted] (00:5F:67:AF:2B:BC) [redacted]▂▄▆█
[D][wifi:434]: - 'Ziggo'[redacted] (5A:D3:43:A8:F2:C1) [redacted]▂▄▆█
[I][wifi:245]: WiFi Connecting to 'XXXXX'...
[I][wifi:502]: WiFi Connected!
[C][wifi:350]:   Local MAC: 30:83:98:94:A5:D3
[C][wifi:351]:   SSID: 'XXXXXX'[redacted]
[C][wifi:352]:   IP Address: 192.168.3.228
[C][wifi:354]:   BSSID: 18:A6:F7:DA:DC:8F[redacted]
[C][wifi:355]:   Hostname: 'co2sensor'
[C][wifi:357]:   Signal strength: -54 dB ▂▄▆█
[C][wifi:361]:   Channel: 11
[C][wifi:362]:   Subnet: 255.255.255.0
[C][wifi:363]:   Gateway: 192.168.3.1
[C][wifi:364]:   DNS1: 192.168.3.1
[C][wifi:365]:   DNS2: 0.0.0.0
[D][wifi:511]: Disabling AP...
[C][web_server:085]: Setting up web server...
[C][ota:082]: Over-The-Air Updates:
[C][ota:083]:   Address: co2sensor.local:8266
[C][ota:086]:   Using Password.
[W][ota:092]: Last Boot was an unhandled reset, will proceed to safe mode in 5 restarts
[C][api:025]: Setting up Home Assistant API server...
[I][app:062]: setup() finished successfully!
[I][app:102]: ESPHome version 2021.12.0 compiled on Dec 14 2021, 10:47:48
[C][wifi:488]: WiFi:
[C][wifi:350]:   Local MAC: 30:83:98:94:A5:D3
[C][wifi:351]:   SSID: 'XXXXXX'[redacted]
[C][wifi:352]:   IP Address: 192.168.3.228
[C][wifi:354]:   BSSID: 18:A6:F7:DA:DC:8F[redacted]
[C][wifi:355]:   Hostname: 'co2sensor'
[C][wifi:357]:   Signal strength: -54 dB ▂▄▆█
[C][wifi:361]:   Channel: 11
[C][wifi:362]:   Subnet: 255.255.255.0
[C][wifi:363]:   Gateway: 192.168.3.1
[C][wifi:364]:   DNS1: 192.168.3.1
[C][wifi:365]:   DNS2: 0.0.0.0
[C][logger:233]: Logger:
[C][logger:234]:   Level: DEBUG
[C][logger:235]:   Log Baud Rate: 115200
[C][logger:236]:   Hardware UART: UART0
[C][uart.arduino_esp8266:100]: UART Bus:
[C][uart.arduino_esp8266:101]:   TX Pin: GPIO12
[C][uart.arduino_esp8266:102]:   RX Pin: GPIO14
[C][uart.arduino_esp8266:104]:   RX Buffer Size: 256
[C][uart.arduino_esp8266:106]:   Baud Rate: 9600 baud
[C][uart.arduino_esp8266:107]:   Data Bits: 8
[C][uart.arduino_esp8266:108]:   Parity: NONE
[C][uart.arduino_esp8266:109]:   Stop bits: 1
[C][uart.arduino_esp8266:113]:   Using software serial
[C][template.switch:058]: Template Switch 'MH-Z19 ABC'
[C][template.switch:059]:   Restore State: NO
[C][template.switch:060]:   Optimistic: YES
[C][mhz19:094]: MH-Z19:
[C][mhz19:095]:   CO2 'MH-Z19 CO2 Value'
[C][mhz19:095]:     Device Class: 'carbon_dioxide'
[C][mhz19:095]:     State Class: 'measurement'
[C][mhz19:095]:     Unit of Measurement: 'ppm'
[C][mhz19:095]:     Accuracy Decimals: 0
[C][mhz19:095]:     Icon: 'mdi:molecule-co2'
[C][mhz19:096]:   Temperature 'MH-Z19 Temperature'
[C][mhz19:096]:     Device Class: 'temperature'
[C][mhz19:096]:     State Class: 'measurement'
[C][mhz19:096]:     Unit of Measurement: '°C'
[C][mhz19:096]:     Accuracy Decimals: 0
[C][status:034]: Status Binary Sensor 'esp_co2 status'
[C][status:034]:   Device Class: 'connectivity'
[C][restart:022]: Restart Switch 'esp_co2 restart'
[C][restart:022]:   Icon: 'mdi:restart'
[C][captive_portal:144]: Captive Portal:
[C][web_server:162]: Web Server:
[C][web_server:163]:   Address: co2sensor.local:80
[C][ota:082]: Over-The-Air Updates:
[C][ota:083]:   Address: co2sensor.local:8266
[C][ota:086]:   Using Password.
[W][ota:092]: Last Boot was an unhandled reset, will proceed to safe mode in 5 restarts
[C][api:134]: API Server:
[C][api:135]:   Address: co2sensor.local:6053
[C][api:139]:   Using noise encryption: NO
[C][mdns:084]: mDNS:
[C][mdns:085]:   Hostname: co2sensor
[D][mhz19:057]: MHZ19 Received CO₂=825ppm Temperature=18°C Status=0x00
[D][sensor:113]: 'MH-Z19 CO2 Value': Sending state 825.00000 ppm with 0 decimals of accuracy
[D][sensor:113]: 'MH-Z19 Temperature': Sending state 18.00000 °C with 0 decimals of accuracy
[D][api:098]: Accepted 192.168.3.9
[D][binary_sensor:036]: 'esp_co2 status': Sending state ON
[D][api.connection:771]: Home Assistant 2021.12.1 (192.168.3.9): Connected successfully

Log after:

[C][ota:458]: There have been 1 suspected unsuccessful boot attempts.
[I][app:029]: Running through setup()...
[C][uart.arduino_esp8266:057]: Setting up UART bus...
[D][binary_sensor:034]: 'esp_co2 status': Sending initial state OFF
[C][wifi:037]: Setting up WiFi...
[D][wifi:370]: Starting scan...
[D][mhz19:057]: MHZ19 Received CO₂=500ppm Temperature=18°C Status=0x00
[D][sensor:113]: 'MH-Z19 CO2 Value': Sending state 500.00000 ppm with 0 decimals of accuracy
[D][sensor:113]: 'MH-Z19 Temperature': Sending state 18.00000 °C with 0 decimals of accuracy
[D][wifi:385]: Found networks:
[D][wifi:434]: - 'Ziggo'[redacted] (2A:35:D1:F4:3B:B9) [redacted]▂▄▆█
[D][wifi:434]: - 'ZiggoC152A92-5G_RPT'[redacted] (70:8B:CD:E4:C4:30) [redacted]▂▄▆█
[W][wifi:439]: No matching network found!
[D][wifi:370]: Starting scan...
[D][wifi:385]: Found networks:
[D][wifi:387]:   No network found!
[D][wifi:370]: Starting scan...

Additional information

No response

MagieMalone commented 2 years ago

does mhz19 not have a maintainer?

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.