esphome/esphome/components/atc_mithermometer/sensor.py

101 lines
3.7 KiB
Python
Raw Normal View History

Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor, esp32_ble_tracker
from esphome.const import (
CONF_BATTERY_LEVEL,
CONF_BATTERY_VOLTAGE,
CONF_MAC_ADDRESS,
CONF_HUMIDITY,
CONF_SIGNAL_STRENGTH,
CONF_TEMPERATURE,
CONF_ID,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_SIGNAL_STRENGTH,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_VOLTAGE,
ENTITY_CATEGORY_DIAGNOSTIC,
STATE_CLASS_MEASUREMENT,
UNIT_CELSIUS,
UNIT_DECIBEL_MILLIWATT,
UNIT_PERCENT,
UNIT_VOLT,
)
CODEOWNERS = ["@ahpohl"]
DEPENDENCIES = ["esp32_ble_tracker"]
atc_mithermometer_ns = cg.esphome_ns.namespace("atc_mithermometer")
ATCMiThermometer = atc_mithermometer_ns.class_(
"ATCMiThermometer", esp32_ble_tracker.ESPBTDeviceListener, cg.Component
)
CONFIG_SCHEMA = (
cv.Schema(
{
cv.GenerateID(): cv.declare_id(ATCMiThermometer),
cv.Required(CONF_MAC_ADDRESS): cv.mac_address,
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS,
accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_HUMIDITY): sensor.sensor_schema(
unit_of_measurement=UNIT_PERCENT,
accuracy_decimals=0,
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_BATTERY_LEVEL): sensor.sensor_schema(
unit_of_measurement=UNIT_PERCENT,
accuracy_decimals=0,
device_class=DEVICE_CLASS_BATTERY,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
cv.Optional(CONF_BATTERY_VOLTAGE): sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT,
accuracy_decimals=3,
device_class=DEVICE_CLASS_VOLTAGE,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
cv.Optional(CONF_SIGNAL_STRENGTH): sensor.sensor_schema(
unit_of_measurement=UNIT_DECIBEL_MILLIWATT,
accuracy_decimals=0,
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
}
)
.extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
.extend(cv.COMPONENT_SCHEMA)
)
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
async def to_code(config):
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
await esp32_ble_tracker.register_ble_device(var, config)
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
if temperature_config := config.get(CONF_TEMPERATURE):
sens = await sensor.new_sensor(temperature_config)
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
cg.add(var.set_temperature(sens))
if humidity_config := config.get(CONF_HUMIDITY):
sens = await sensor.new_sensor(humidity_config)
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
cg.add(var.set_humidity(sens))
if battery_level_config := config.get(CONF_BATTERY_LEVEL):
sens = await sensor.new_sensor(battery_level_config)
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
cg.add(var.set_battery_level(sens))
if battery_voltage_config := config.get(CONF_BATTERY_VOLTAGE):
sens = await sensor.new_sensor(battery_voltage_config)
Add support for ATC_MiThermometer (#1291) * Add support for additional Xiaomi BLE sensors (#1027) * Revert "Add support for additional Xiaomi BLE sensors (#1027)" This reverts commit b2723830f4ed1e29611e3688a2c9323c1071bc23. * initial ATC Mithermometer component * removed references to xiaomi_ble * temp, humi and batt in % working, todo: battery in mV * report battery level in volt * report battery level again in percent * Add files via upload * add ATC Mithermometer component * remove some comments * fix travis ci build issues * mark codeowner, make functions protected * add newlines, remove spaces * two lines after function or class definition * update codeowners * Bump flake8 from 3.8.3 to 3.8.4 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot[bot] <support@github.com> * Add files via upload * Bump pytest from 6.0.2 to 6.1.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.0.2 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.0.2...6.1.1) Signed-off-by: dependabot[bot] <support@github.com> * add ATC battery voltage to test2.yaml * fix lint-python * Bump colorlog from 4.2.1 to 4.4.0 Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 4.2.1 to 4.4.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v4.2.1...v4.4.0) Signed-off-by: dependabot[bot] <support@github.com> * Bump voluptuous from 0.11.7 to 0.12.0 Bumps [voluptuous](https://github.com/alecthomas/voluptuous) from 0.11.7 to 0.12.0. - [Release notes](https://github.com/alecthomas/voluptuous/releases) - [Changelog](https://github.com/alecthomas/voluptuous/blob/master/CHANGELOG.md) - [Commits](https://github.com/alecthomas/voluptuous/commits/v0.12.0) Signed-off-by: dependabot[bot] <support@github.com> * restore requirements * move codeowner above dependencies * Revert "restore requirements" This reverts commit 3c9fd8b42183ff251c68404ae5e75d72ded00006. * Revert "Bump voluptuous from 0.11.7 to 0.12.0" This reverts commit 8eb0dba1c3f2fdcad28f6970381021a04a4051e7. * Revert "Bump flake8 from 3.8.3 to 3.8.4" This reverts commit 20952632dba032f70b97c86cac5daa84521c1840. * Revert "Bump colorlog from 4.2.1 to 4.4.0" This reverts commit 87bbf95d860a3213e5c9a909cbf6325f00e9094e. * Revert "Bump pytest from 6.0.2 to 6.1.1" This reverts commit 1b6ed8043137d8e8f38de32824cfa113dbc5a0ec. Co-authored-by: vevsvevs <v-v@mail.ru> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-03 18:36:11 +01:00
cg.add(var.set_battery_voltage(sens))
if signal_strength_config := config.get(CONF_SIGNAL_STRENGTH):
sens = await sensor.new_sensor(signal_strength_config)
cg.add(var.set_signal_strength(sens))