esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
294 stars 38 forks source link

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

Open aver-ua opened 8 months ago

aver-ua commented 8 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 7 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 5 months 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 5 months ago

@illigtr , thanks for your finding

stefankleff commented 3 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.

Same here, with Wemos D1 mini, ESPhome 2024.7.2 and DFRobot: I get [22:45:25][W][as3935_i2c:029]: Writing register failed!

Tasmota works fine :/

BliXem1 commented 2 months ago

Hi,

Here also, same problem.

`[13:53:19][C][i2c.arduino:071]: I2C Bus: [13:53:19][C][i2c.arduino:072]: SDA Pin: GPIO21 [13:53:19][C][i2c.arduino:073]: SCL Pin: GPIO22 [13:53:19][C][i2c.arduino:074]: Frequency: 500000 Hz [13:53:19][C][i2c.arduino:086]: Recovery: bus successfully recovered [13:53:19][I][i2c.arduino:096]: Results from i2c bus scan: [13:53:19][I][i2c.arduino:098]: Found no i2c devices!

[13:53:19][C][as3935:036]: Interrupt Pin: GPIO2 [13:53:19][C][as3935:038]: Thunder alert 'Storm Alert'

[13:53:19][C][as3935:041]: State Class: '' [13:53:19][C][as3935:041]: Unit of Measurement: 'km' [13:53:19][C][as3935:041]: Accuracy Decimals: 1

[13:53:19][C][as3935:042]: Lightning energy 'Lightning Energy' [13:53:19][C][as3935:042]: State Class: '' [13:53:19][C][as3935:042]: Unit of Measurement: '' [13:53:19][C][as3935:042]: Accuracy Decimals: 1

[13:53:19][C][as3935_i2c:040]: Address: 0x03`

When I test it with a lighter I get:

[13:53:21][W][as3935_i2c:029]: Writing register failed! [13:53:22][W][as3935_i2c:029]: Writing register failed! [13:53:22][W][as3935_i2c:029]: Writing register failed!

So the question is, does it work? With Tasmota it work fine indeed.