esphome / issues

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

DFRobot I2C Lightning Distance Sensor AS3935/SEN0290 not found #5581

Open aver-ua opened 4 months ago

aver-ua commented 4 months ago

The problem

Hi! DFRobot Lightning Distance Sensor AS3935 not found. But there is no problem with this board under Tasmota 13.4.0 (sensors) as3935_esphome_1 as3935_tasmota_1 as3935_tasmota_2 as3935_tasmota_3

Which version of ESPHome has the issue?

2024.2.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.3.0

What platform are you using?

ESP8266

Board

NodeMCU v3

Component causing the issue

I2C

Example YAML snippet

i2c:
  - id: bus_a # as3935
    scl: GPIO14
    sda: GPIO12
    scan: True
    frequency: 400kHz #tried different frequencies and without specifying (default)

as3935_i2c:
  irq_pin: GPIO13
  address: 0x03
  indoor: False

sensor:
  - platform: as3935
    lightning_energy:
      name: "Lightning Energy"
    distance:
      name: "Distance Storm"
binary_sensor:
  - platform: as3935
    name: "Storm Alert"

Anything in the logs that might be useful for us?

[09:07:09][C][i2c.arduino:053]: I2C Bus:
[09:07:09][C][i2c.arduino:054]:   SDA Pin: GPIO12
[09:07:09][C][i2c.arduino:055]:   SCL Pin: GPIO14
[09:07:09][C][i2c.arduino:056]:   Frequency: 400000 Hz
[09:07:09][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[09:07:09][I][i2c.arduino:069]: Results from i2c bus scan:
[09:07:09][I][i2c.arduino:071]: Found no i2c devices!

Additional information

No response

jepke commented 2 months ago

Same DFrobot i2c here and having the same issue. Tested it in arduino ide so i know the sensor works as expected.

I however can get something with testing with one of those long spark lighters. Identical config as above

[22:45:25][W][as3935_i2c:029]: Writing register failed!
[22:45:27][W][as3935_i2c:029]: Writing register failed!
[22:45:28][W][as3935_i2c:033]: Reading register failed!
[22:45:28][W][component:237]: Component as3935 took a long time for an operation (1009 ms).
[22:45:28][W][component:238]: Components should block for at most 30 ms.
illigtr commented 3 weeks ago

Just a quick comment here.... the i2c scan: starts at address 8 to 128. So if you have any i2c device using addresses below 8, like the as3935... it won't show up in the scan. I found this out when I finally looked at the C code for i2c scan. A local copy modified to start scanning at address 1 worked! Even though the scan starts at 8 and your as3935 won't show, if it is present, then the component will still use the assigned address... so more a nuisance for debugging.

aver-ua commented 3 weeks ago

@illigtr , thanks for your finding