Fix platform restriction for bme680_bsec (#4616)

* Fix platform restriction for bme680_bsec

* Fix

* revert spi change

* Add comment back

* Dont crash on rp2040 platform
This commit is contained in:
Jesse Hills 2023-03-27 11:50:33 +13:00 committed by GitHub
parent c2756d57d8
commit 06f83bf1c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c
from esphome.components import i2c, esp32
from esphome.const import CONF_ID
CODEOWNERS = ["@trvrnrth"]
@ -32,7 +32,8 @@ BME680BSECComponent = bme680_bsec_ns.class_(
"BME680BSECComponent", cg.Component, i2c.I2CDevice
)
CONFIG_SCHEMA = cv.Schema(
CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.GenerateID(): cv.declare_id(BME680BSECComponent),
cv.Optional(CONF_TEMPERATURE_OFFSET, default=0): cv.temperature,
@ -45,9 +46,17 @@ CONFIG_SCHEMA = cv.Schema(
cv.Optional(
CONF_STATE_SAVE_INTERVAL, default="6hours"
): cv.positive_time_period_minutes,
},
}
).extend(i2c.i2c_device_schema(0x76)),
cv.only_with_arduino,
).extend(i2c.i2c_device_schema(0x76))
cv.Any(
cv.only_on_esp8266,
cv.All(
cv.only_on_esp32,
esp32.only_on_variant(supported=[esp32.const.VARIANT_ESP32]),
),
),
)
async def to_code(config):