Remove deprecated Bosch BME280 Environmental Sensor integration (#67185)
This commit is contained in:
parent
5eec425e2c
commit
ae073d132c
7 changed files with 0 additions and 343 deletions
|
@ -116,9 +116,6 @@ omit =
|
||||||
homeassistant/components/bloomsky/*
|
homeassistant/components/bloomsky/*
|
||||||
homeassistant/components/bluesound/*
|
homeassistant/components/bluesound/*
|
||||||
homeassistant/components/bluetooth_tracker/*
|
homeassistant/components/bluetooth_tracker/*
|
||||||
homeassistant/components/bme280/__init__.py
|
|
||||||
homeassistant/components/bme280/const.py
|
|
||||||
homeassistant/components/bme280/sensor.py
|
|
||||||
homeassistant/components/bme680/sensor.py
|
homeassistant/components/bme680/sensor.py
|
||||||
homeassistant/components/bmp280/sensor.py
|
homeassistant/components/bmp280/sensor.py
|
||||||
homeassistant/components/bmw_connected_drive/__init__.py
|
homeassistant/components/bmw_connected_drive/__init__.py
|
||||||
|
|
|
@ -1,112 +0,0 @@
|
||||||
"""The bme280 component."""
|
|
||||||
import logging
|
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
|
||||||
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_SCAN_INTERVAL
|
|
||||||
from homeassistant.core import HomeAssistant
|
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
|
||||||
from homeassistant.helpers.typing import ConfigType
|
|
||||||
|
|
||||||
from .const import (
|
|
||||||
CONF_DELTA_TEMP,
|
|
||||||
CONF_FILTER_MODE,
|
|
||||||
CONF_I2C_ADDRESS,
|
|
||||||
CONF_I2C_BUS,
|
|
||||||
CONF_OPERATION_MODE,
|
|
||||||
CONF_OVERSAMPLING_HUM,
|
|
||||||
CONF_OVERSAMPLING_PRES,
|
|
||||||
CONF_OVERSAMPLING_TEMP,
|
|
||||||
CONF_SPI_BUS,
|
|
||||||
CONF_SPI_DEV,
|
|
||||||
CONF_T_STANDBY,
|
|
||||||
DEFAULT_DELTA_TEMP,
|
|
||||||
DEFAULT_FILTER_MODE,
|
|
||||||
DEFAULT_I2C_ADDRESS,
|
|
||||||
DEFAULT_I2C_BUS,
|
|
||||||
DEFAULT_MONITORED,
|
|
||||||
DEFAULT_NAME,
|
|
||||||
DEFAULT_OPERATION_MODE,
|
|
||||||
DEFAULT_OVERSAMPLING_HUM,
|
|
||||||
DEFAULT_OVERSAMPLING_PRES,
|
|
||||||
DEFAULT_OVERSAMPLING_TEMP,
|
|
||||||
DEFAULT_SCAN_INTERVAL,
|
|
||||||
DEFAULT_T_STANDBY,
|
|
||||||
DOMAIN,
|
|
||||||
SENSOR_KEYS,
|
|
||||||
)
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
|
||||||
{
|
|
||||||
DOMAIN: vol.All(
|
|
||||||
cv.ensure_list,
|
|
||||||
[
|
|
||||||
vol.Schema(
|
|
||||||
{
|
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
|
||||||
vol.Optional(CONF_SPI_BUS): vol.Coerce(int),
|
|
||||||
vol.Optional(CONF_SPI_DEV): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_I2C_ADDRESS, default=DEFAULT_I2C_ADDRESS
|
|
||||||
): cv.string,
|
|
||||||
vol.Optional(CONF_I2C_BUS, default=DEFAULT_I2C_BUS): vol.Coerce(
|
|
||||||
int
|
|
||||||
),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_DELTA_TEMP, default=DEFAULT_DELTA_TEMP
|
|
||||||
): vol.Coerce(float),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_MONITORED_CONDITIONS, default=DEFAULT_MONITORED
|
|
||||||
): vol.All(cv.ensure_list, [vol.In(SENSOR_KEYS)]),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_OVERSAMPLING_TEMP, default=DEFAULT_OVERSAMPLING_TEMP
|
|
||||||
): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_OVERSAMPLING_PRES, default=DEFAULT_OVERSAMPLING_PRES
|
|
||||||
): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_OVERSAMPLING_HUM, default=DEFAULT_OVERSAMPLING_HUM
|
|
||||||
): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_OPERATION_MODE, default=DEFAULT_OPERATION_MODE
|
|
||||||
): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_T_STANDBY, default=DEFAULT_T_STANDBY
|
|
||||||
): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_FILTER_MODE, default=DEFAULT_FILTER_MODE
|
|
||||||
): vol.Coerce(int),
|
|
||||||
vol.Optional(
|
|
||||||
CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL
|
|
||||||
): cv.time_period,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
},
|
|
||||||
extra=vol.ALLOW_EXTRA,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|
||||||
"""Set up BME280 component."""
|
|
||||||
_LOGGER.warning(
|
|
||||||
"The Bosch BME280 Environmental Sensor integration is deprecated and "
|
|
||||||
"will be removed in Home Assistant Core 2022.4; "
|
|
||||||
"this integration is removed under Architectural Decision Record 0019, "
|
|
||||||
"more information can be found here: "
|
|
||||||
"https://github.com/home-assistant/architecture/blob/master/adr/0019-GPIO.md"
|
|
||||||
)
|
|
||||||
|
|
||||||
bme280_config = config[DOMAIN]
|
|
||||||
for bme280_conf in bme280_config:
|
|
||||||
discovery_info = {SENSOR_DOMAIN: bme280_conf}
|
|
||||||
hass.async_create_task(
|
|
||||||
discovery.async_load_platform(
|
|
||||||
hass, SENSOR_DOMAIN, DOMAIN, discovery_info, config
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return True
|
|
|
@ -1,60 +0,0 @@
|
||||||
"""Constants for the BME280 component."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
|
|
||||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
|
|
||||||
|
|
||||||
# Common
|
|
||||||
DOMAIN = "bme280"
|
|
||||||
CONF_OVERSAMPLING_TEMP = "oversampling_temperature"
|
|
||||||
CONF_OVERSAMPLING_PRES = "oversampling_pressure"
|
|
||||||
CONF_OVERSAMPLING_HUM = "oversampling_humidity"
|
|
||||||
CONF_T_STANDBY = "time_standby"
|
|
||||||
CONF_FILTER_MODE = "filter_mode"
|
|
||||||
DEFAULT_NAME = "BME280 Sensor"
|
|
||||||
DEFAULT_OVERSAMPLING_TEMP = 1
|
|
||||||
DEFAULT_OVERSAMPLING_PRES = 1
|
|
||||||
DEFAULT_OVERSAMPLING_HUM = 1
|
|
||||||
DEFAULT_T_STANDBY = 5
|
|
||||||
DEFAULT_FILTER_MODE = 0
|
|
||||||
DEFAULT_SCAN_INTERVAL = 300
|
|
||||||
SENSOR_TEMP = "temperature"
|
|
||||||
SENSOR_HUMID = "humidity"
|
|
||||||
SENSOR_PRESS = "pressure"
|
|
||||||
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|
||||||
SensorEntityDescription(
|
|
||||||
key=SENSOR_TEMP,
|
|
||||||
name="Temperature",
|
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key=SENSOR_HUMID,
|
|
||||||
name="Humidity",
|
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
|
||||||
device_class=SensorDeviceClass.HUMIDITY,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key=SENSOR_PRESS,
|
|
||||||
name="Pressure",
|
|
||||||
native_unit_of_measurement="mb",
|
|
||||||
device_class=SensorDeviceClass.PRESSURE,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
SENSOR_KEYS: list[str] = [desc.key for desc in SENSOR_TYPES]
|
|
||||||
DEFAULT_MONITORED = [SENSOR_TEMP, SENSOR_HUMID, SENSOR_PRESS]
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=3)
|
|
||||||
# SPI
|
|
||||||
CONF_SPI_DEV = "spi_dev"
|
|
||||||
CONF_SPI_BUS = "spi_bus"
|
|
||||||
# I2C
|
|
||||||
CONF_I2C_ADDRESS = "i2c_address"
|
|
||||||
CONF_I2C_BUS = "i2c_bus"
|
|
||||||
CONF_DELTA_TEMP = "delta_temperature"
|
|
||||||
CONF_OPERATION_MODE = "operation_mode"
|
|
||||||
DEFAULT_OPERATION_MODE = 3 # Normal mode (forced mode: 2)
|
|
||||||
DEFAULT_I2C_ADDRESS = "0x76"
|
|
||||||
DEFAULT_I2C_BUS = 1
|
|
||||||
DEFAULT_DELTA_TEMP = 0.0
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"domain": "bme280",
|
|
||||||
"name": "Bosch BME280 Environmental Sensor",
|
|
||||||
"documentation": "https://www.home-assistant.io/integrations/bme280",
|
|
||||||
"requirements": [
|
|
||||||
"i2csense==0.0.4",
|
|
||||||
"smbus-cffi==0.5.1",
|
|
||||||
"bme280spi==0.2.0"
|
|
||||||
],
|
|
||||||
"codeowners": [],
|
|
||||||
"iot_class": "local_push",
|
|
||||||
"loggers": ["bme280spi", "i2csense", "smbus"]
|
|
||||||
}
|
|
|
@ -1,149 +0,0 @@
|
||||||
"""Support for BME280 temperature, humidity and pressure sensor."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from functools import partial
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from bme280spi import BME280 as BME280_spi # pylint: disable=import-error
|
|
||||||
from i2csense.bme280 import BME280 as BME280_i2c # pylint: disable=import-error
|
|
||||||
import smbus
|
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
|
||||||
DOMAIN as SENSOR_DOMAIN,
|
|
||||||
SensorEntity,
|
|
||||||
SensorEntityDescription,
|
|
||||||
)
|
|
||||||
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_SCAN_INTERVAL
|
|
||||||
from homeassistant.core import HomeAssistant
|
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
|
||||||
from homeassistant.helpers.update_coordinator import (
|
|
||||||
CoordinatorEntity,
|
|
||||||
DataUpdateCoordinator,
|
|
||||||
UpdateFailed,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .const import (
|
|
||||||
CONF_DELTA_TEMP,
|
|
||||||
CONF_FILTER_MODE,
|
|
||||||
CONF_I2C_ADDRESS,
|
|
||||||
CONF_I2C_BUS,
|
|
||||||
CONF_OPERATION_MODE,
|
|
||||||
CONF_OVERSAMPLING_HUM,
|
|
||||||
CONF_OVERSAMPLING_PRES,
|
|
||||||
CONF_OVERSAMPLING_TEMP,
|
|
||||||
CONF_SPI_BUS,
|
|
||||||
CONF_SPI_DEV,
|
|
||||||
CONF_T_STANDBY,
|
|
||||||
DOMAIN,
|
|
||||||
MIN_TIME_BETWEEN_UPDATES,
|
|
||||||
SENSOR_HUMID,
|
|
||||||
SENSOR_PRESS,
|
|
||||||
SENSOR_TEMP,
|
|
||||||
SENSOR_TYPES,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
|
||||||
hass: HomeAssistant,
|
|
||||||
config: ConfigType,
|
|
||||||
async_add_entities: AddEntitiesCallback,
|
|
||||||
discovery_info: DiscoveryInfoType | None = None,
|
|
||||||
) -> None:
|
|
||||||
"""Set up the BME280 sensor."""
|
|
||||||
if discovery_info is None:
|
|
||||||
return
|
|
||||||
sensor_conf = discovery_info[SENSOR_DOMAIN]
|
|
||||||
name = sensor_conf[CONF_NAME]
|
|
||||||
scan_interval = max(sensor_conf[CONF_SCAN_INTERVAL], MIN_TIME_BETWEEN_UPDATES)
|
|
||||||
if CONF_SPI_BUS in sensor_conf and CONF_SPI_DEV in sensor_conf:
|
|
||||||
spi_dev = sensor_conf[CONF_SPI_DEV]
|
|
||||||
spi_bus = sensor_conf[CONF_SPI_BUS]
|
|
||||||
_LOGGER.debug("BME280 sensor initialize at %s.%s", spi_bus, spi_dev)
|
|
||||||
sensor = await hass.async_add_executor_job(
|
|
||||||
partial(
|
|
||||||
BME280_spi,
|
|
||||||
t_mode=sensor_conf[CONF_OVERSAMPLING_TEMP],
|
|
||||||
p_mode=sensor_conf[CONF_OVERSAMPLING_PRES],
|
|
||||||
h_mode=sensor_conf[CONF_OVERSAMPLING_HUM],
|
|
||||||
standby=sensor_conf[CONF_T_STANDBY],
|
|
||||||
filter=sensor_conf[CONF_FILTER_MODE],
|
|
||||||
spi_bus=sensor_conf[CONF_SPI_BUS],
|
|
||||||
spi_dev=sensor_conf[CONF_SPI_DEV],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if not sensor.sample_ok:
|
|
||||||
_LOGGER.error("BME280 sensor not detected at %s.%s", spi_bus, spi_dev)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
i2c_address = sensor_conf[CONF_I2C_ADDRESS]
|
|
||||||
bus = smbus.SMBus(sensor_conf[CONF_I2C_BUS])
|
|
||||||
sensor = await hass.async_add_executor_job(
|
|
||||||
partial(
|
|
||||||
BME280_i2c,
|
|
||||||
bus,
|
|
||||||
i2c_address,
|
|
||||||
osrs_t=sensor_conf[CONF_OVERSAMPLING_TEMP],
|
|
||||||
osrs_p=sensor_conf[CONF_OVERSAMPLING_PRES],
|
|
||||||
osrs_h=sensor_conf[CONF_OVERSAMPLING_HUM],
|
|
||||||
mode=sensor_conf[CONF_OPERATION_MODE],
|
|
||||||
t_sb=sensor_conf[CONF_T_STANDBY],
|
|
||||||
filter_mode=sensor_conf[CONF_FILTER_MODE],
|
|
||||||
delta_temp=sensor_conf[CONF_DELTA_TEMP],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if not sensor.sample_ok:
|
|
||||||
_LOGGER.error("BME280 sensor not detected at %s", i2c_address)
|
|
||||||
return
|
|
||||||
|
|
||||||
async def async_update_data():
|
|
||||||
await hass.async_add_executor_job(sensor.update)
|
|
||||||
if not sensor.sample_ok:
|
|
||||||
raise UpdateFailed(f"Bad update of sensor {name}")
|
|
||||||
return sensor
|
|
||||||
|
|
||||||
coordinator = DataUpdateCoordinator(
|
|
||||||
hass,
|
|
||||||
_LOGGER,
|
|
||||||
name=DOMAIN,
|
|
||||||
update_method=async_update_data,
|
|
||||||
update_interval=scan_interval,
|
|
||||||
)
|
|
||||||
await coordinator.async_refresh()
|
|
||||||
monitored_conditions = sensor_conf[CONF_MONITORED_CONDITIONS]
|
|
||||||
entities = [
|
|
||||||
BME280Sensor(name, coordinator, description)
|
|
||||||
for description in SENSOR_TYPES
|
|
||||||
if description.key in monitored_conditions
|
|
||||||
]
|
|
||||||
async_add_entities(entities, True)
|
|
||||||
|
|
||||||
|
|
||||||
class BME280Sensor(CoordinatorEntity, SensorEntity):
|
|
||||||
"""Implementation of the BME280 sensor."""
|
|
||||||
|
|
||||||
def __init__(self, name, coordinator, description: SensorEntityDescription):
|
|
||||||
"""Initialize the sensor."""
|
|
||||||
super().__init__(coordinator)
|
|
||||||
self.entity_description = description
|
|
||||||
self._attr_name = f"{name} {description.name}"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def native_value(self):
|
|
||||||
"""Return the state of the sensor."""
|
|
||||||
sensor_type = self.entity_description.key
|
|
||||||
if sensor_type == SENSOR_TEMP:
|
|
||||||
temperature = round(self.coordinator.data.temperature, 1)
|
|
||||||
state = temperature
|
|
||||||
elif sensor_type == SENSOR_HUMID:
|
|
||||||
state = round(self.coordinator.data.humidity, 1)
|
|
||||||
elif sensor_type == SENSOR_PRESS:
|
|
||||||
state = round(self.coordinator.data.pressure, 1)
|
|
||||||
return state
|
|
||||||
|
|
||||||
@property
|
|
||||||
def should_poll(self) -> bool:
|
|
||||||
"""Return False if entity should not poll."""
|
|
||||||
return False
|
|
|
@ -417,9 +417,6 @@ blockchain==1.4.4
|
||||||
# homeassistant.components.miflora
|
# homeassistant.components.miflora
|
||||||
# bluepy==1.3.0
|
# bluepy==1.3.0
|
||||||
|
|
||||||
# homeassistant.components.bme280
|
|
||||||
# bme280spi==0.2.0
|
|
||||||
|
|
||||||
# homeassistant.components.bme680
|
# homeassistant.components.bme680
|
||||||
# bme680==1.0.5
|
# bme680==1.0.5
|
||||||
|
|
||||||
|
@ -861,7 +858,6 @@ hydrawiser==0.2
|
||||||
# homeassistant.components.hyperion
|
# homeassistant.components.hyperion
|
||||||
hyperion-py==0.7.4
|
hyperion-py==0.7.4
|
||||||
|
|
||||||
# homeassistant.components.bme280
|
|
||||||
# homeassistant.components.htu21d
|
# homeassistant.components.htu21d
|
||||||
# i2csense==0.0.4
|
# i2csense==0.0.4
|
||||||
|
|
||||||
|
@ -2206,7 +2202,6 @@ smart-meter-texas==0.4.7
|
||||||
# homeassistant.components.smarthab
|
# homeassistant.components.smarthab
|
||||||
smarthab==0.21
|
smarthab==0.21
|
||||||
|
|
||||||
# homeassistant.components.bme280
|
|
||||||
# homeassistant.components.bme680
|
# homeassistant.components.bme680
|
||||||
# homeassistant.components.envirophat
|
# homeassistant.components.envirophat
|
||||||
# homeassistant.components.htu21d
|
# homeassistant.components.htu21d
|
||||||
|
|
|
@ -19,7 +19,6 @@ COMMENT_REQUIREMENTS = (
|
||||||
"beacontools",
|
"beacontools",
|
||||||
"beewi_smartclim", # depends on bluepy
|
"beewi_smartclim", # depends on bluepy
|
||||||
"bluepy",
|
"bluepy",
|
||||||
"bme280spi",
|
|
||||||
"bme680",
|
"bme680",
|
||||||
"decora",
|
"decora",
|
||||||
"decora_wifi",
|
"decora_wifi",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue