mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Adds ability to calibrate temperature for BME680 (#19684)
* Adds temperature calibration * Add deps. Lint fix
This commit is contained in:
parent
bba9ef7d7d
commit
688bdc6532
@ -20,7 +20,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||||
|
|
||||||
REQUIREMENTS = ['bme680==1.0.4',
|
REQUIREMENTS = ['bme680==1.0.5',
|
||||||
'smbus-cffi==0.5.1']
|
'smbus-cffi==0.5.1']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -36,6 +36,7 @@ CONF_GAS_HEATER_DURATION = 'gas_heater_duration'
|
|||||||
CONF_AQ_BURN_IN_TIME = 'aq_burn_in_time'
|
CONF_AQ_BURN_IN_TIME = 'aq_burn_in_time'
|
||||||
CONF_AQ_HUM_BASELINE = 'aq_humidity_baseline'
|
CONF_AQ_HUM_BASELINE = 'aq_humidity_baseline'
|
||||||
CONF_AQ_HUM_WEIGHTING = 'aq_humidity_bias'
|
CONF_AQ_HUM_WEIGHTING = 'aq_humidity_bias'
|
||||||
|
CONF_TEMP_OFFSET = 'temp_offset'
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_NAME = 'BME680 Sensor'
|
DEFAULT_NAME = 'BME680 Sensor'
|
||||||
@ -50,6 +51,7 @@ DEFAULT_GAS_HEATER_DURATION = 150 # Heater duration in ms 1 - 4032
|
|||||||
DEFAULT_AQ_BURN_IN_TIME = 300 # 300 second burn in time for AQ gas measurement
|
DEFAULT_AQ_BURN_IN_TIME = 300 # 300 second burn in time for AQ gas measurement
|
||||||
DEFAULT_AQ_HUM_BASELINE = 40 # 40%, an optimal indoor humidity.
|
DEFAULT_AQ_HUM_BASELINE = 40 # 40%, an optimal indoor humidity.
|
||||||
DEFAULT_AQ_HUM_WEIGHTING = 25 # 25% Weighting of humidity to gas in AQ score
|
DEFAULT_AQ_HUM_WEIGHTING = 25 # 25% Weighting of humidity to gas in AQ score
|
||||||
|
DEFAULT_TEMP_OFFSET = 0 # No calibration out of the box.
|
||||||
|
|
||||||
SENSOR_TEMP = 'temperature'
|
SENSOR_TEMP = 'temperature'
|
||||||
SENSOR_HUMID = 'humidity'
|
SENSOR_HUMID = 'humidity'
|
||||||
@ -93,6 +95,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
vol.All(vol.Coerce(int), vol.Range(1, 100)),
|
vol.All(vol.Coerce(int), vol.Range(1, 100)),
|
||||||
vol.Optional(CONF_AQ_HUM_WEIGHTING, default=DEFAULT_AQ_HUM_WEIGHTING):
|
vol.Optional(CONF_AQ_HUM_WEIGHTING, default=DEFAULT_AQ_HUM_WEIGHTING):
|
||||||
vol.All(vol.Coerce(int), vol.Range(1, 100)),
|
vol.All(vol.Coerce(int), vol.Range(1, 100)),
|
||||||
|
vol.Optional(CONF_TEMP_OFFSET, default=DEFAULT_TEMP_OFFSET):
|
||||||
|
vol.All(vol.Coerce(float), vol.Range(-100.0, 100.0)),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -140,6 +144,9 @@ def _setup_bme680(config):
|
|||||||
sensor.set_temperature_oversample(
|
sensor.set_temperature_oversample(
|
||||||
os_lookup[config.get(CONF_OVERSAMPLING_TEMP)]
|
os_lookup[config.get(CONF_OVERSAMPLING_TEMP)]
|
||||||
)
|
)
|
||||||
|
sensor.set_temp_offset(
|
||||||
|
os_lookup[config.get(CONF_TEMP_OFFSET)]
|
||||||
|
)
|
||||||
sensor.set_humidity_oversample(
|
sensor.set_humidity_oversample(
|
||||||
os_lookup[config.get(CONF_OVERSAMPLING_HUM)]
|
os_lookup[config.get(CONF_OVERSAMPLING_HUM)]
|
||||||
)
|
)
|
||||||
|
@ -211,7 +211,7 @@ blockchain==1.4.4
|
|||||||
# bluepy==1.1.4
|
# bluepy==1.1.4
|
||||||
|
|
||||||
# homeassistant.components.sensor.bme680
|
# homeassistant.components.sensor.bme680
|
||||||
# bme680==1.0.4
|
# bme680==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.route53
|
# homeassistant.components.route53
|
||||||
# homeassistant.components.notify.aws_lambda
|
# homeassistant.components.notify.aws_lambda
|
||||||
|
Loading…
x
Reference in New Issue
Block a user