Add SPI Support for BMP388 and BMP390
shingle01 opened this issue · comments
Describe the problem you have/What new integration you would like
As per feature request #1321
BMP388 and BMP390 sensors supports I2C as well as SPI but ESPHome currently supports only I2C for it. It would be great if SPI support was added for this sensor as well.
Please describe your use case for this integration and alternatives you've tried:
Same as above
Additional context
Same as above
@shingle01 do you own i2c or spi?
@shingle01
try new PR. please test both modes
esphome:
name: bmp3xx-test
esp32:
board: esp32dev
framework:
type: arduino
# esp8266:
# board: nodemcuv2
logger:
level: DEBUG
external_components:
- source: github://pr#6652
refresh: 10s
components: [bmp3xx_base, bmp3xx_i2c, bmp3xx_spi]
spi:
clk_pin: 19
mosi_pin: 20
miso_pin: 21
i2c:
sda: GPIO14
scl: GPIO26
scan: true
frequency: 5kHz
sensor:
- platform: bmp3xx_spi
cs_pin: 13
temperature:
name: "Outside Temperature"
oversampling: 16x
pressure:
name: "Outside Pressure"
update_interval: 60s
- platform: bmp3xx_i2c
address: 0x77
temperature:
name: "Outside Temperature"
oversampling: 16x
pressure:
name: "Outside Pressure"
update_interval: 60s
Sorry for the delay. Testing SPI only I get an error:
[13:30:09][C][bmp3xx.sensor:151]: BMP3XX:
[13:30:09][C][bmp3xx.sensor:152]: Type: Unknown Chip Type (0xFF)
[13:30:09][E][bmp3xx.sensor:163]: BMP3XX has wrong chip ID (reported id: 0xFF) - please check if you are really using a BMP 388 or BMP 390
[13:30:09][C][bmp3xx.sensor:172]: IIR Filter: OFF
[13:30:09][C][bmp3xx.sensor:173]: Update Interval: 60.0s
[13:30:09][C][bmp3xx.sensor:175]: Temperature 'Outside Temperature'
[13:30:09][C][bmp3xx.sensor:175]: Device Class: 'temperature'
[13:30:09][C][bmp3xx.sensor:175]: State Class: 'measurement'
[13:30:09][C][bmp3xx.sensor:175]: Unit of Measurement: '°C'
[13:30:09][C][bmp3xx.sensor:175]: Accuracy Decimals: 1
[13:30:09][C][bmp3xx.sensor:176]: Oversampling: 16x
[13:30:09][C][bmp3xx.sensor:179]: Pressure 'Outside Pressure'
[13:30:09][C][bmp3xx.sensor:179]: Device Class: 'pressure'
[13:30:09][C][bmp3xx.sensor:179]: State Class: 'measurement'
[13:30:09][C][bmp3xx.sensor:179]: Unit of Measurement: 'hPa'
[13:30:09][C][bmp3xx.sensor:179]: Accuracy Decimals: 1
[13:30:09][C][bmp3xx.sensor:180]: Oversampling: 16x
[13:30:09][E][component:082]: Component bmp3xx_base is marked FAILED
@shingle01 please test new PR for SPI
- source: github://pr#6722
@shingle01 apologies, its hard to read the log, it is deformed
would you please paste it in via ``` signs in the github ui, not via email. thanks
[09:40:41][C][bmp3xx.sensor:151]: BMP3XX:
[09:40:41][C][bmp3xx.sensor:152]: Type: BMP 388 (0x50)
[09:40:41][C][bmp3xx.sensor:172]: IIR Filter: OFF
[09:40:41][C][bmp3xx.sensor:173]: Update Interval: 60.0s
[09:40:41][C][bmp3xx.sensor:175]: Temperature 'Outside Temperature'
[09:40:41][C][bmp3xx.sensor:175]: Device Class: 'temperature'
[09:40:41][C][bmp3xx.sensor:175]: State Class: 'measurement'
[09:40:41][C][bmp3xx.sensor:175]: Unit of Measurement: '°C'
[09:40:41][C][bmp3xx.sensor:175]: Accuracy Decimals: 1
[09:40:41][C][bmp3xx.sensor:176]: Oversampling: 16x
[09:40:41][C][bmp3xx.sensor:179]: Pressure 'Outside Pressure'
[09:40:41][C][bmp3xx.sensor:179]: Device Class: 'pressure'
[09:40:41][C][bmp3xx.sensor:179]: State Class: 'measurement'
[09:40:41][C][bmp3xx.sensor:179]: Unit of Measurement: 'hPa'
[09:40:41][C][bmp3xx.sensor:179]: Accuracy Decimals: 1
[09:40:41][C][bmp3xx.sensor:180]: Oversampling: 16x
[09:41:16][VV][scheduler:226]: Running interval 'update' with interval=60000 last_execution=4294952051 (now=44761)
[09:41:16][V][bmp3xx.sensor:189]: Sending conversion request...
[09:41:16][VV][bmp3xx.sensor:202]: measurement time 67
[09:41:16][VV][scheduler:032]: set_timeout(name='data', timeout=67)
[09:41:16][VV][scheduler:226]: Running timeout 'data' with interval=67 last_execution=44776 (now=44844)
[09:41:16][VV][bmp3xx.sensor:349]: data ready status 8
[09:41:16][D][bmp3xx.sensor:212]: Got temperature=-849.3°C pressure=-19404.6hPa
[09:41:16][V][sensor:043]: 'Outside Temperature': Received new state -849.316772
[09:41:16][D][sensor:094]: 'Outside Temperature': Sending state -849.31677 °C with 1 decimals of accuracy
[09:41:16][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 2259435129
state: -849.317
missing_state: NO
}
[09:41:16][V][sensor:043]: 'Outside Pressure': Received new state -19404.640625
[09:41:16][D][sensor:094]: 'Outside Pressure': Sending state -19404.64062 hPa with 1 decimals of accuracy
[09:41:16][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 3243141300
state: -19404.6
missing_state: NO
}
[09:41:16][W][component:237]: Component bmp3xx_base took a long time for an operation (89 ms).
[09:41:16][W][component:238]: Components should block for at most 30 ms.
@shingle01 can you please test one more time with very verbose logging - i would need few readings done.
there is a chance first byte coming from the device over SPI is always 0xFF and shall be skipped. need to check that idea.
thanks