esphome / issues

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

Pico W RP2040 > I2C bus: Can not output two devices #4301

Closed Jeeekkkk closed 1 year ago

Jeeekkkk commented 1 year ago

The problem

While attempting to get the output for two identical Adafruit SCD-30 sensors, I am only able to get the output of one sensor and it is always the first of the two in the series (initial sensor in daisy chain or bus_a when not daisy chained). I have tried with them daisy chained and without them daisy chained and see the same result.

I will note that the variables are detected for the second sensor but the values are unknown.

Which version of ESPHome has the issue?

2023.2.4

What type of installation are you using?

Home Assistant Add-on via RPi 3b+ with Home Assistant OS

Which version of Home Assistant has the issue?

2023.3.1

What platform are you using?

RP2040

Board

RPi Pico W

Component causing the issue

Adafruit SCD-30

Example YAML snippet

Daisy chained

i2c:
  - id: bus_a
    sda: 20
    scl: 21
    scan: True

sensor:
  - platform: scd30
    co2:
      name: "CO2_Upper"
    temperature:
      name: "Temperature_Upper"
    humidity:
      name: "Humidity_Upper"
    address: 0x61
    i2c_id: bus_a
  - platform: scd30
    co2:
      name: "CO2_Lower"
    temperature:
      name: "Temperature_Lower"
    humidity:
      name: "Humidity_Lower"
    address: 0x62
    i2c_id: bus_a

Non-daisy chained

i2c:
  - id: bus_a
    sda: 20
    scl: 21
    scan: True
  - id: bus_b
    sda: 14
    scl: 15
    scan: True

sensor:
  - platform: scd30
    co2:
      name: "CO2_Upper"
    temperature:
      name: "Temperature_Upper"
    humidity:
      name: "Humidity_Upper"
    address: 0x61
    i2c_id: bus_a
  - platform: scd30
    co2:
      name: "CO2_Lower"
    temperature:
      name: "Temperature_Lower"
    humidity:
      name: "Humidity_Lower"
    address: 0x62
    i2c_id: bus_b

Anything in the logs that might be useful for us?

INFO Reading configuration /config/esphome/pico-grow.yaml...
INFO Starting log output from pico-grow.local using esphome API
INFO Successfully connected to pico-grow.local
[15:23:59][I][app:102]: ESPHome version 2023.2.4 compiled on Mar 10 2023, 15:08:47
[15:23:59][C][wifi:504]: WiFi:
[15:23:59][C][wifi:362]:   Local MAC: 28:CD:C1:06:29:90
[15:23:59][C][wifi:363]:   SSID: [redacted]
[15:23:59][C][wifi:364]:   IP Address: 192.168.4.78
[15:23:59][C][wifi:365]:   BSSID: [redacted]
[15:23:59][C][wifi:367]:   Hostname: 'pico-grow'
[15:23:59][C][wifi:369]:   Signal strength: -40 dB ▂▄▆█
[15:23:59][C][wifi:373]:   Channel: 2
[15:23:59][C][wifi:374]:   Subnet: 255.255.252.0
[15:23:59][C][wifi:375]:   Gateway: 192.168.4.1
[15:23:59][C][wifi:376]:   DNS1: 50.0.1.1
[15:23:59][C][wifi:377]:   DNS2: 50.0.2.2
[15:23:59][C][logger:293]: Logger:
[15:23:59][C][logger:294]:   Level: DEBUG
[15:23:59][C][logger:295]:   Log Baud Rate: 115200
[15:23:59][C][logger:296]:   Hardware UART: USB_CDC
[15:23:59][C][i2c.arduino:052]: I2C Bus:
[15:23:59][C][i2c.arduino:053]:   SDA Pin: GPIO20
[15:23:59][C][i2c.arduino:054]:   SCL Pin: GPIO21
[15:23:59][C][i2c.arduino:055]:   Frequency: 50000 Hz
[15:23:59][C][i2c.arduino:064]:   Recovery: failed, SDA is held low on the bus
[15:23:59][I][i2c.arduino:068]: Results from i2c bus scan:
[15:23:59][I][i2c.arduino:074]: Found i2c device at address 0x61
[15:23:59][C][scd30:115]: scd30:
[15:23:59][C][scd30:116]:   Address: 0x61
[15:23:59][C][scd30:134]:   Altitude compensation: OFF
[15:23:59][C][scd30:138]:   Automatic self calibration: ON
[15:23:59][C][scd30:139]:   Ambient pressure compensation: 0mBar
[15:23:59][C][scd30:140]:   Temperature offset: 0.00 °C
[15:23:59][C][scd30:141]:   Update interval: 60s
[15:23:59][C][scd30:142]:   CO2 'CO2_Upper'
[15:23:59][C][scd30:142]:     State Class: 'measurement'
[15:23:59][C][scd30:142]:     Unit of Measurement: 'ppm'
[15:23:59][C][scd30:142]:     Accuracy Decimals: 0
[15:23:59][C][scd30:142]:     Icon: 'mdi:molecule-co2'
[15:23:59][C][scd30:143]:   Temperature 'Temperature_Upper'
[15:23:59][C][scd30:143]:     Device Class: 'temperature'
[15:23:59][C][scd30:143]:     State Class: 'measurement'
[15:23:59][C][scd30:143]:     Unit of Measurement: '°C'
[15:23:59][C][scd30:143]:     Accuracy Decimals: 1
[15:23:59][C][scd30:144]:   Humidity 'Humidity_Upper'
[15:23:59][C][scd30:144]:     Device Class: 'humidity'
[15:23:59][C][scd30:144]:     State Class: 'measurement'
[15:23:59][C][scd30:144]:     Unit of Measurement: '%'
[15:23:59][C][scd30:144]:     Accuracy Decimals: 1
[15:23:59][C][scd30:115]: scd30:
[15:23:59][C][scd30:116]:   Address: 0x62
[15:23:59][W][scd30:126]: Unable to read sensor firmware version
[15:23:59][C][scd30:134]:   Altitude compensation: OFF
[15:23:59][C][scd30:138]:   Automatic self calibration: ON
[15:23:59][C][scd30:139]:   Ambient pressure compensation: 0mBar
[15:23:59][C][scd30:140]:   Temperature offset: 0.00 °C
[15:23:59][C][scd30:141]:   Update interval: 60s
[15:23:59][C][scd30:142]:   CO2 'CO2_Lower'
[15:23:59][C][scd30:142]:     State Class: 'measurement'
[15:23:59][C][scd30:142]:     Unit of Measurement: 'ppm'
[15:23:59][C][scd30:142]:     Accuracy Decimals: 0
[15:23:59][C][scd30:142]:     Icon: 'mdi:molecule-co2'
[15:23:59][C][scd30:143]:   Temperature 'Temperature_Lower'
[15:23:59][C][scd30:143]:     Device Class: 'temperature'
[15:23:59][C][scd30:143]:     State Class: 'measurement'
[15:23:59][C][scd30:143]:     Unit of Measurement: '°C'
[15:23:59][C][scd30:143]:     Accuracy Decimals: 1
[15:23:59][C][scd30:144]:   Humidity 'Humidity_Lower'
[15:23:59][C][scd30:144]:     Device Class: 'humidity'
[15:23:59][C][scd30:144]:     State Class: 'measurement'
[15:23:59][C][scd30:144]:     Unit of Measurement: '%'
[15:23:59][C][scd30:144]:     Accuracy Decimals: 1
[15:23:59][C][mdns:108]: mDNS:
[15:23:59][C][mdns:109]:   Hostname: pico-grow
[15:23:59][C][ota:093]: Over-The-Air Updates:
[15:23:59][C][ota:094]:   Address: pico-grow.local:2040
[15:23:59][C][ota:097]:   Using Password.
[15:23:59][C][api:138]: API Server:
[15:23:59][C][api:139]:   Address: pico-grow.local:6053
[15:23:59][C][api:141]:   Using noise encryption: YES
[15:24:27][D][scd30:181]: Got CO2=757.13ppm temperature=22.66°C humidity=56.23%
[15:24:27][D][sensor:126]: 'CO2_Upper': Sending state 757.12994 ppm with 0 decimals of accuracy
[15:24:27][D][sensor:126]: 'Temperature_Upper': Sending state 22.65545 °C with 1 decimals of accuracy
[15:24:27][D][sensor:126]: 'Humidity_Upper': Sending state 56.23474 % with 1 decimals of accuracy

Additional information

Perhaps this is not supported yet with the Pico W?

Sensor docs:https://esphome.io/components/sensor/scd30.html?highlight=scd30 I2C bus docs: https://esphome.io/components/i2c.html#i2c

I would like to also note that as others have discovered, it appears that the I2C bus does not support all I2C pins...When I tried using GPIO27 and GPIO26 they never worked at all. However using GPIO21 and GPIO20, GPIO19 and GPIO18, GPIO14 and GPIO15 on the Pi Pico W did work. I have not tried additional pins. I hope this is being addressed! More on this can be found lower in the comments of Issue 3838

github-actions[bot] commented 1 year 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.