1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 03:42:20 +01:00

Anova fahrenheit support (#2126)

Co-authored-by: Ben Buxton <bb@cactii.net>
This commit is contained in:
buxtronix
2021-08-09 06:05:36 +10:00
committed by GitHub
parent 29f72037fe
commit fe7af21c91
6 changed files with 50 additions and 8 deletions

View File

@@ -1,7 +1,12 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import climate, ble_client
from esphome.const import CONF_ID
from esphome.const import CONF_ID, CONF_UNIT_OF_MEASUREMENT
UNITS = {
"f": "f",
"c": "c",
}
CODEOWNERS = ["@buxtronix"]
DEPENDENCIES = ["ble_client"]
@@ -12,7 +17,12 @@ Anova = anova_ns.class_(
)
CONFIG_SCHEMA = (
climate.CLIMATE_SCHEMA.extend({cv.GenerateID(): cv.declare_id(Anova)})
climate.CLIMATE_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(Anova),
cv.Required(CONF_UNIT_OF_MEASUREMENT): cv.enum(UNITS),
}
)
.extend(ble_client.BLE_CLIENT_SCHEMA)
.extend(cv.polling_component_schema("60s"))
)
@@ -23,3 +33,4 @@ async def to_code(config):
await cg.register_component(var, config)
await climate.register_climate(var, config)
await ble_client.register_ble_node(var, config)
cg.add(var.set_unit_of_measurement(config[CONF_UNIT_OF_MEASUREMENT]))