mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Convert components to async-def syntax (#1821)
This commit is contained in:
parent
b92702a312
commit
2376a2c941
296 changed files with 1423 additions and 1424 deletions
|
@ -18,16 +18,16 @@ CONFIG_SCHEMA = stepper.STEPPER_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield stepper.register_stepper(var, config)
|
await stepper.register_stepper(var, config)
|
||||||
|
|
||||||
step_pin = yield cg.gpio_pin_expression(config[CONF_STEP_PIN])
|
step_pin = await cg.gpio_pin_expression(config[CONF_STEP_PIN])
|
||||||
cg.add(var.set_step_pin(step_pin))
|
cg.add(var.set_step_pin(step_pin))
|
||||||
dir_pin = yield cg.gpio_pin_expression(config[CONF_DIR_PIN])
|
dir_pin = await cg.gpio_pin_expression(config[CONF_DIR_PIN])
|
||||||
cg.add(var.set_dir_pin(dir_pin))
|
cg.add(var.set_dir_pin(dir_pin))
|
||||||
|
|
||||||
if CONF_SLEEP_PIN in config:
|
if CONF_SLEEP_PIN in config:
|
||||||
sleep_pin = yield cg.gpio_pin_expression(config[CONF_SLEEP_PIN])
|
sleep_pin = await cg.gpio_pin_expression(config[CONF_SLEEP_PIN])
|
||||||
cg.add(var.set_sleep_pin(sleep_pin))
|
cg.add(var.set_sleep_pin(sleep_pin))
|
||||||
|
|
|
@ -32,18 +32,18 @@ CONFIG_SCHEMA = output.FLOAT_OUTPUT_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
# override default min power to 10%
|
# override default min power to 10%
|
||||||
if CONF_MIN_POWER not in config:
|
if CONF_MIN_POWER not in config:
|
||||||
config[CONF_MIN_POWER] = 0.1
|
config[CONF_MIN_POWER] = 0.1
|
||||||
yield output.register_output(var, config)
|
await output.register_output(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_GATE_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_GATE_PIN])
|
||||||
cg.add(var.set_gate_pin(pin))
|
cg.add(var.set_gate_pin(pin))
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_ZERO_CROSS_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_ZERO_CROSS_PIN])
|
||||||
cg.add(var.set_zero_cross_pin(pin))
|
cg.add(var.set_zero_cross_pin(pin))
|
||||||
cg.add(var.set_init_with_half_cycle(config[CONF_INIT_WITH_HALF_CYCLE]))
|
cg.add(var.set_init_with_half_cycle(config[CONF_INIT_WITH_HALF_CYCLE]))
|
||||||
cg.add(var.set_method(config[CONF_METHOD]))
|
cg.add(var.set_method(config[CONF_METHOD]))
|
||||||
|
|
|
@ -49,10 +49,10 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
||||||
if config[CONF_PIN] == "VCC":
|
if config[CONF_PIN] == "VCC":
|
||||||
cg.add_define("USE_ADC_SENSOR_VCC")
|
cg.add_define("USE_ADC_SENSOR_VCC")
|
||||||
|
|
|
@ -38,18 +38,18 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
wrapped_light = yield cg.get_variable(config[CONF_ADDRESSABLE_LIGHT_ID])
|
wrapped_light = await cg.get_variable(config[CONF_ADDRESSABLE_LIGHT_ID])
|
||||||
cg.add(var.set_width(config[CONF_WIDTH]))
|
cg.add(var.set_width(config[CONF_WIDTH]))
|
||||||
cg.add(var.set_height(config[CONF_HEIGHT]))
|
cg.add(var.set_height(config[CONF_HEIGHT]))
|
||||||
cg.add(var.set_light(wrapped_light))
|
cg.add(var.set_light(wrapped_light))
|
||||||
|
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield display.register_display(var, config)
|
await display.register_display(var, config)
|
||||||
|
|
||||||
if CONF_PIXEL_MAPPER in config:
|
if CONF_PIXEL_MAPPER in config:
|
||||||
pixel_mapper_template_ = yield cg.process_lambda(
|
pixel_mapper_template_ = await cg.process_lambda(
|
||||||
config[CONF_PIXEL_MAPPER],
|
config[CONF_PIXEL_MAPPER],
|
||||||
[(int, "x"), (int, "y")],
|
[(int, "x"), (int, "y")],
|
||||||
return_type=cg.int_,
|
return_type=cg.int_,
|
||||||
|
@ -57,7 +57,7 @@ def to_code(config):
|
||||||
cg.add(var.set_pixel_mapper(pixel_mapper_template_))
|
cg.add(var.set_pixel_mapper(pixel_mapper_template_))
|
||||||
|
|
||||||
if CONF_LAMBDA in config:
|
if CONF_LAMBDA in config:
|
||||||
lambda_ = yield cg.process_lambda(
|
lambda_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA], [(display.DisplayBufferRef, "it")], return_type=cg.void
|
config[CONF_LAMBDA], [(display.DisplayBufferRef, "it")], return_type=cg.void
|
||||||
)
|
)
|
||||||
cg.add(var.set_writer(lambda_))
|
cg.add(var.set_writer(lambda_))
|
||||||
|
|
|
@ -52,10 +52,10 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_IRQ_PIN in config:
|
if CONF_IRQ_PIN in config:
|
||||||
cg.add(var.set_irq_pin(config[CONF_IRQ_PIN]))
|
cg.add(var.set_irq_pin(config[CONF_IRQ_PIN]))
|
||||||
|
@ -70,5 +70,5 @@ def to_code(config):
|
||||||
if key not in config:
|
if key not in config:
|
||||||
continue
|
continue
|
||||||
conf = config[key]
|
conf = config[key]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(getattr(var, f"set_{key}_sensor")(sens))
|
cg.add(getattr(var, f"set_{key}_sensor")(sens))
|
||||||
|
|
|
@ -23,9 +23,9 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
cg.add(var.set_continuous_mode(config[CONF_CONTINUOUS_MODE]))
|
cg.add(var.set_continuous_mode(config[CONF_CONTINUOUS_MODE]))
|
||||||
|
|
|
@ -64,11 +64,11 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
paren = yield cg.get_variable(config[CONF_ADS1115_ID])
|
paren = await cg.get_variable(config[CONF_ADS1115_ID])
|
||||||
var = cg.new_Pvariable(config[CONF_ID], paren)
|
var = cg.new_Pvariable(config[CONF_ID], paren)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
cg.add(var.set_multiplexer(config[CONF_MULTIPLEXER]))
|
cg.add(var.set_multiplexer(config[CONF_MULTIPLEXER]))
|
||||||
cg.add(var.set_gain(config[CONF_GAIN]))
|
cg.add(var.set_gain(config[CONF_GAIN]))
|
||||||
|
|
|
@ -34,15 +34,15 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
|
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity_sensor(sens))
|
cg.add(var.set_humidity_sensor(sens))
|
||||||
|
|
|
@ -36,15 +36,15 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
|
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity_sensor(sens))
|
cg.add(var.set_humidity_sensor(sens))
|
||||||
|
|
|
@ -34,7 +34,7 @@ CONFIG_SCHEMA = cv.All(font.validate_pillow_installed, ANIMATION_SCHEMA)
|
||||||
CODEOWNERS = ["@syndlex"]
|
CODEOWNERS = ["@syndlex"]
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
path = CORE.relative_config_path(config[CONF_FILE])
|
path = CORE.relative_config_path(config[CONF_FILE])
|
||||||
|
|
|
@ -23,7 +23,7 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
|
@ -24,8 +24,8 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_APDS9960_ID])
|
hub = await cg.get_variable(config[CONF_APDS9960_ID])
|
||||||
var = yield binary_sensor.new_binary_sensor(config)
|
var = await binary_sensor.new_binary_sensor(config)
|
||||||
func = getattr(hub, DIRECTIONS[config[CONF_DIRECTION]])
|
func = getattr(hub, DIRECTIONS[config[CONF_DIRECTION]])
|
||||||
cg.add(func(var))
|
cg.add(func(var))
|
||||||
|
|
|
@ -24,8 +24,8 @@ CONFIG_SCHEMA = sensor.sensor_schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_APDS9960_ID])
|
hub = await cg.get_variable(config[CONF_APDS9960_ID])
|
||||||
var = yield sensor.new_sensor(config)
|
var = await sensor.new_sensor(config)
|
||||||
func = getattr(hub, TYPES[config[CONF_TYPE]])
|
func = getattr(hub, TYPES[config[CONF_TYPE]])
|
||||||
cg.add(func(var))
|
cg.add(func(var))
|
||||||
|
|
|
@ -12,7 +12,7 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_AS3935_ID])
|
hub = await cg.get_variable(config[CONF_AS3935_ID])
|
||||||
var = yield binary_sensor.new_binary_sensor(config)
|
var = await binary_sensor.new_binary_sensor(config)
|
||||||
cg.add(hub.set_thunder_alert_binary_sensor(var))
|
cg.add(hub.set_thunder_alert_binary_sensor(var))
|
||||||
|
|
|
@ -27,15 +27,15 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_AS3935_ID])
|
hub = await cg.get_variable(config[CONF_AS3935_ID])
|
||||||
|
|
||||||
if CONF_DISTANCE in config:
|
if CONF_DISTANCE in config:
|
||||||
conf = config[CONF_DISTANCE]
|
conf = config[CONF_DISTANCE]
|
||||||
distance_sensor = yield sensor.new_sensor(conf)
|
distance_sensor = await sensor.new_sensor(conf)
|
||||||
cg.add(hub.set_distance_sensor(distance_sensor))
|
cg.add(hub.set_distance_sensor(distance_sensor))
|
||||||
|
|
||||||
if CONF_LIGHTNING_ENERGY in config:
|
if CONF_LIGHTNING_ENERGY in config:
|
||||||
conf = config[CONF_LIGHTNING_ENERGY]
|
conf = config[CONF_LIGHTNING_ENERGY]
|
||||||
lightning_energy_sensor = yield sensor.new_sensor(conf)
|
lightning_energy_sensor = await sensor.new_sensor(conf)
|
||||||
cg.add(hub.set_energy_sensor(lightning_energy_sensor))
|
cg.add(hub.set_energy_sensor(lightning_energy_sensor))
|
||||||
|
|
|
@ -20,7 +20,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield as3935.setup_as3935(var, config)
|
await as3935.setup_as3935(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
|
@ -20,7 +20,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield as3935.setup_as3935(var, config)
|
await as3935.setup_as3935(var, config)
|
||||||
yield spi.register_spi_device(var, config)
|
await spi.register_spi_device(var, config)
|
||||||
|
|
|
@ -51,22 +51,22 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield esp32_ble_tracker.register_ble_device(var, config)
|
await esp32_ble_tracker.register_ble_device(var, config)
|
||||||
|
|
||||||
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature(sens))
|
cg.add(var.set_temperature(sens))
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity(sens))
|
cg.add(var.set_humidity(sens))
|
||||||
if CONF_BATTERY_LEVEL in config:
|
if CONF_BATTERY_LEVEL in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_BATTERY_LEVEL])
|
sens = await sensor.new_sensor(config[CONF_BATTERY_LEVEL])
|
||||||
cg.add(var.set_battery_level(sens))
|
cg.add(var.set_battery_level(sens))
|
||||||
if CONF_BATTERY_VOLTAGE in config:
|
if CONF_BATTERY_VOLTAGE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_BATTERY_VOLTAGE])
|
sens = await sensor.new_sensor(config[CONF_BATTERY_VOLTAGE])
|
||||||
cg.add(var.set_battery_voltage(sens))
|
cg.add(var.set_battery_voltage(sens))
|
||||||
|
|
|
@ -113,10 +113,10 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield spi.register_spi_device(var, config)
|
await spi.register_spi_device(var, config)
|
||||||
|
|
||||||
for i, phase in enumerate([CONF_PHASE_A, CONF_PHASE_B, CONF_PHASE_C]):
|
for i, phase in enumerate([CONF_PHASE_A, CONF_PHASE_B, CONF_PHASE_C]):
|
||||||
if phase not in config:
|
if phase not in config:
|
||||||
|
@ -125,31 +125,31 @@ def to_code(config):
|
||||||
cg.add(var.set_volt_gain(i, conf[CONF_GAIN_VOLTAGE]))
|
cg.add(var.set_volt_gain(i, conf[CONF_GAIN_VOLTAGE]))
|
||||||
cg.add(var.set_ct_gain(i, conf[CONF_GAIN_CT]))
|
cg.add(var.set_ct_gain(i, conf[CONF_GAIN_CT]))
|
||||||
if CONF_VOLTAGE in conf:
|
if CONF_VOLTAGE in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_VOLTAGE])
|
sens = await sensor.new_sensor(conf[CONF_VOLTAGE])
|
||||||
cg.add(var.set_voltage_sensor(i, sens))
|
cg.add(var.set_voltage_sensor(i, sens))
|
||||||
if CONF_CURRENT in conf:
|
if CONF_CURRENT in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_CURRENT])
|
sens = await sensor.new_sensor(conf[CONF_CURRENT])
|
||||||
cg.add(var.set_current_sensor(i, sens))
|
cg.add(var.set_current_sensor(i, sens))
|
||||||
if CONF_POWER in conf:
|
if CONF_POWER in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_POWER])
|
sens = await sensor.new_sensor(conf[CONF_POWER])
|
||||||
cg.add(var.set_power_sensor(i, sens))
|
cg.add(var.set_power_sensor(i, sens))
|
||||||
if CONF_REACTIVE_POWER in conf:
|
if CONF_REACTIVE_POWER in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_REACTIVE_POWER])
|
sens = await sensor.new_sensor(conf[CONF_REACTIVE_POWER])
|
||||||
cg.add(var.set_reactive_power_sensor(i, sens))
|
cg.add(var.set_reactive_power_sensor(i, sens))
|
||||||
if CONF_POWER_FACTOR in conf:
|
if CONF_POWER_FACTOR in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_POWER_FACTOR])
|
sens = await sensor.new_sensor(conf[CONF_POWER_FACTOR])
|
||||||
cg.add(var.set_power_factor_sensor(i, sens))
|
cg.add(var.set_power_factor_sensor(i, sens))
|
||||||
if CONF_FORWARD_ACTIVE_ENERGY in conf:
|
if CONF_FORWARD_ACTIVE_ENERGY in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_FORWARD_ACTIVE_ENERGY])
|
sens = await sensor.new_sensor(conf[CONF_FORWARD_ACTIVE_ENERGY])
|
||||||
cg.add(var.set_forward_active_energy_sensor(i, sens))
|
cg.add(var.set_forward_active_energy_sensor(i, sens))
|
||||||
if CONF_REVERSE_ACTIVE_ENERGY in conf:
|
if CONF_REVERSE_ACTIVE_ENERGY in conf:
|
||||||
sens = yield sensor.new_sensor(conf[CONF_REVERSE_ACTIVE_ENERGY])
|
sens = await sensor.new_sensor(conf[CONF_REVERSE_ACTIVE_ENERGY])
|
||||||
cg.add(var.set_reverse_active_energy_sensor(i, sens))
|
cg.add(var.set_reverse_active_energy_sensor(i, sens))
|
||||||
if CONF_FREQUENCY in config:
|
if CONF_FREQUENCY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_FREQUENCY])
|
sens = await sensor.new_sensor(config[CONF_FREQUENCY])
|
||||||
cg.add(var.set_freq_sensor(sens))
|
cg.add(var.set_freq_sensor(sens))
|
||||||
if CONF_CHIP_TEMPERATURE in config:
|
if CONF_CHIP_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_CHIP_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_CHIP_TEMPERATURE])
|
||||||
cg.add(var.set_chip_temperature_sensor(sens))
|
cg.add(var.set_chip_temperature_sensor(sens))
|
||||||
cg.add(var.set_line_freq(config[CONF_LINE_FREQUENCY]))
|
cg.add(var.set_line_freq(config[CONF_LINE_FREQUENCY]))
|
||||||
cg.add(var.set_current_phases(config[CONF_CURRENT_PHASES]))
|
cg.add(var.set_current_phases(config[CONF_CURRENT_PHASES]))
|
||||||
|
|
|
@ -50,10 +50,10 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield esp32_ble_tracker.register_ble_device(var, config)
|
await esp32_ble_tracker.register_ble_device(var, config)
|
||||||
|
|
||||||
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
||||||
|
|
||||||
|
@ -64,5 +64,5 @@ def to_code(config):
|
||||||
(CONF_MOISTURE, var.set_soil_moisture),
|
(CONF_MOISTURE, var.set_soil_moisture),
|
||||||
]:
|
]:
|
||||||
if config_key in config:
|
if config_key in config:
|
||||||
sens = yield sensor.new_sensor(config[config_key])
|
sens = await sensor.new_sensor(config[config_key])
|
||||||
cg.add(setter(sens))
|
cg.add(setter(sens))
|
||||||
|
|
|
@ -39,12 +39,12 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield climate.register_climate(var, config)
|
await climate.register_climate(var, config)
|
||||||
|
|
||||||
sens = yield cg.get_variable(config[CONF_SENSOR])
|
sens = await cg.get_variable(config[CONF_SENSOR])
|
||||||
cg.add(var.set_sensor(sens))
|
cg.add(var.set_sensor(sens))
|
||||||
|
|
||||||
normal_config = BangBangClimateTargetTempConfig(
|
normal_config = BangBangClimateTargetTempConfig(
|
||||||
|
@ -53,17 +53,17 @@ def to_code(config):
|
||||||
)
|
)
|
||||||
cg.add(var.set_normal_config(normal_config))
|
cg.add(var.set_normal_config(normal_config))
|
||||||
|
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
var.get_idle_trigger(), [], config[CONF_IDLE_ACTION]
|
var.get_idle_trigger(), [], config[CONF_IDLE_ACTION]
|
||||||
)
|
)
|
||||||
|
|
||||||
if CONF_COOL_ACTION in config:
|
if CONF_COOL_ACTION in config:
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
var.get_cool_trigger(), [], config[CONF_COOL_ACTION]
|
var.get_cool_trigger(), [], config[CONF_COOL_ACTION]
|
||||||
)
|
)
|
||||||
cg.add(var.set_supports_cool(True))
|
cg.add(var.set_supports_cool(True))
|
||||||
if CONF_HEAT_ACTION in config:
|
if CONF_HEAT_ACTION in config:
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
var.get_heat_trigger(), [], config[CONF_HEAT_ACTION]
|
var.get_heat_trigger(), [], config[CONF_HEAT_ACTION]
|
||||||
)
|
)
|
||||||
cg.add(var.set_supports_heat(True))
|
cg.add(var.set_supports_heat(True))
|
||||||
|
|
|
@ -46,11 +46,11 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
cg.add(var.set_resolution(config[CONF_RESOLUTION]))
|
cg.add(var.set_resolution(config[CONF_RESOLUTION]))
|
||||||
cg.add(var.set_measurement_duration(config[CONF_MEASUREMENT_DURATION]))
|
cg.add(var.set_measurement_duration(config[CONF_MEASUREMENT_DURATION]))
|
||||||
|
|
|
@ -21,19 +21,19 @@ CONFIG_SCHEMA = fan.FAN_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
fan_ = yield fan.create_fan_state(config)
|
fan_ = await fan.create_fan_state(config)
|
||||||
cg.add(var.set_fan(fan_))
|
cg.add(var.set_fan(fan_))
|
||||||
output_ = yield cg.get_variable(config[CONF_OUTPUT])
|
output_ = await cg.get_variable(config[CONF_OUTPUT])
|
||||||
cg.add(var.set_output(output_))
|
cg.add(var.set_output(output_))
|
||||||
|
|
||||||
if CONF_OSCILLATION_OUTPUT in config:
|
if CONF_OSCILLATION_OUTPUT in config:
|
||||||
oscillation_output = yield cg.get_variable(config[CONF_OSCILLATION_OUTPUT])
|
oscillation_output = await cg.get_variable(config[CONF_OSCILLATION_OUTPUT])
|
||||||
cg.add(var.set_oscillating(oscillation_output))
|
cg.add(var.set_oscillating(oscillation_output))
|
||||||
|
|
||||||
if CONF_DIRECTION_OUTPUT in config:
|
if CONF_DIRECTION_OUTPUT in config:
|
||||||
direction_output = yield cg.get_variable(config[CONF_DIRECTION_OUTPUT])
|
direction_output = await cg.get_variable(config[CONF_DIRECTION_OUTPUT])
|
||||||
cg.add(var.set_direction(direction_output))
|
cg.add(var.set_direction(direction_output))
|
||||||
|
|
|
@ -14,9 +14,9 @@ CONFIG_SCHEMA = light.BINARY_LIGHT_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
||||||
yield light.register_light(var, config)
|
await light.register_light(var, config)
|
||||||
|
|
||||||
out = yield cg.get_variable(config[CONF_OUTPUT])
|
out = await cg.get_variable(config[CONF_OUTPUT])
|
||||||
cg.add(var.set_output(out))
|
cg.add(var.set_output(out))
|
||||||
|
|
|
@ -48,14 +48,14 @@ CONFIG_SCHEMA = cv.typed_schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
||||||
constant = SENSOR_MAP_TYPES[config[CONF_TYPE]]
|
constant = SENSOR_MAP_TYPES[config[CONF_TYPE]]
|
||||||
cg.add(var.set_sensor_type(constant))
|
cg.add(var.set_sensor_type(constant))
|
||||||
|
|
||||||
for ch in config[CONF_CHANNELS]:
|
for ch in config[CONF_CHANNELS]:
|
||||||
input_var = yield cg.get_variable(ch[CONF_BINARY_SENSOR])
|
input_var = await cg.get_variable(ch[CONF_BINARY_SENSOR])
|
||||||
cg.add(var.add_channel(input_var, ch[CONF_VALUE]))
|
cg.add(var.add_channel(input_var, ch[CONF_VALUE]))
|
||||||
|
|
|
@ -74,14 +74,14 @@ def register_ble_node(var, config):
|
||||||
cg.add(parent.register_ble_node(var))
|
cg.add(parent.register_ble_node(var))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield esp32_ble_tracker.register_client(var, config)
|
await esp32_ble_tracker.register_client(var, config)
|
||||||
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
||||||
for conf in config.get(CONF_ON_CONNECT, []):
|
for conf in config.get(CONF_ON_CONNECT, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(trigger, [], conf)
|
await automation.build_automation(trigger, [], conf)
|
||||||
for conf in config.get(CONF_ON_DISCONNECT, []):
|
for conf in config.get(CONF_ON_DISCONNECT, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(trigger, [], conf)
|
await automation.build_automation(trigger, [], conf)
|
||||||
|
|
|
@ -50,7 +50,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
if len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid16_format):
|
if len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid16_format):
|
||||||
cg.add(
|
cg.add(
|
||||||
|
@ -105,11 +105,11 @@ def to_code(config):
|
||||||
uuid128 = esp32_ble_tracker.as_hex_array(config[CONF_DESCRIPTOR_UUID])
|
uuid128 = esp32_ble_tracker.as_hex_array(config[CONF_DESCRIPTOR_UUID])
|
||||||
cg.add(var.set_descr_uuid128(uuid128))
|
cg.add(var.set_descr_uuid128(uuid128))
|
||||||
|
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield ble_client.register_ble_node(var, config)
|
await ble_client.register_ble_node(var, config)
|
||||||
cg.add(var.set_enable_notify(config[CONF_NOTIFY]))
|
cg.add(var.set_enable_notify(config[CONF_NOTIFY]))
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
for conf in config.get(CONF_ON_NOTIFY, []):
|
for conf in config.get(CONF_ON_NOTIFY, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield ble_client.register_ble_node(trigger, config)
|
await ble_client.register_ble_node(trigger, config)
|
||||||
yield automation.build_automation(trigger, [(float, "x")], conf)
|
await automation.build_automation(trigger, [(float, "x")], conf)
|
||||||
|
|
|
@ -23,8 +23,8 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield switch.register_switch(var, config)
|
await switch.register_switch(var, config)
|
||||||
yield ble_client.register_ble_node(var, config)
|
await ble_client.register_ble_node(var, config)
|
||||||
|
|
|
@ -27,11 +27,11 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield esp32_ble_tracker.register_ble_device(var, config)
|
await esp32_ble_tracker.register_ble_device(var, config)
|
||||||
yield binary_sensor.register_binary_sensor(var, config)
|
await binary_sensor.register_binary_sensor(var, config)
|
||||||
|
|
||||||
if CONF_MAC_ADDRESS in config:
|
if CONF_MAC_ADDRESS in config:
|
||||||
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
||||||
|
|
|
@ -32,11 +32,11 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield esp32_ble_tracker.register_ble_device(var, config)
|
await esp32_ble_tracker.register_ble_device(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
||||||
if CONF_MAC_ADDRESS in config:
|
if CONF_MAC_ADDRESS in config:
|
||||||
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
|
||||||
|
|
|
@ -24,8 +24,8 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield esp32_ble_tracker.register_ble_device(var, config)
|
await esp32_ble_tracker.register_ble_device(var, config)
|
||||||
yield text_sensor.register_text_sensor(var, config)
|
await text_sensor.register_text_sensor(var, config)
|
||||||
|
|
|
@ -84,26 +84,26 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
conf = config[CONF_TEMPERATURE]
|
conf = config[CONF_TEMPERATURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
cg.add(var.set_temperature_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_temperature_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
if CONF_PRESSURE in config:
|
if CONF_PRESSURE in config:
|
||||||
conf = config[CONF_PRESSURE]
|
conf = config[CONF_PRESSURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_pressure_sensor(sens))
|
cg.add(var.set_pressure_sensor(sens))
|
||||||
cg.add(var.set_pressure_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_pressure_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
conf = config[CONF_HUMIDITY]
|
conf = config[CONF_HUMIDITY]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_humidity_sensor(sens))
|
cg.add(var.set_humidity_sensor(sens))
|
||||||
cg.add(var.set_humidity_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_humidity_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
|
|
|
@ -114,32 +114,32 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
conf = config[CONF_TEMPERATURE]
|
conf = config[CONF_TEMPERATURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
cg.add(var.set_temperature_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_temperature_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
if CONF_PRESSURE in config:
|
if CONF_PRESSURE in config:
|
||||||
conf = config[CONF_PRESSURE]
|
conf = config[CONF_PRESSURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_pressure_sensor(sens))
|
cg.add(var.set_pressure_sensor(sens))
|
||||||
cg.add(var.set_pressure_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_pressure_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
conf = config[CONF_HUMIDITY]
|
conf = config[CONF_HUMIDITY]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_humidity_sensor(sens))
|
cg.add(var.set_humidity_sensor(sens))
|
||||||
cg.add(var.set_humidity_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_humidity_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
if CONF_GAS_RESISTANCE in config:
|
if CONF_GAS_RESISTANCE in config:
|
||||||
conf = config[CONF_GAS_RESISTANCE]
|
conf = config[CONF_GAS_RESISTANCE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_gas_resistance_sensor(sens))
|
cg.add(var.set_gas_resistance_sensor(sens))
|
||||||
|
|
||||||
cg.add(var.set_iir_filter(IIR_FILTER_OPTIONS[config[CONF_IIR_FILTER]]))
|
cg.add(var.set_iir_filter(IIR_FILTER_OPTIONS[config[CONF_IIR_FILTER]]))
|
||||||
|
|
|
@ -48,10 +48,10 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(i2c.i2c_device_schema(0x76))
|
).extend(i2c.i2c_device_schema(0x76))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
cg.add(var.set_temperature_offset(config[CONF_TEMPERATURE_OFFSET]))
|
cg.add(var.set_temperature_offset(config[CONF_TEMPERATURE_OFFSET]))
|
||||||
cg.add(var.set_iaq_mode(config[CONF_IAQ_MODE]))
|
cg.add(var.set_iaq_mode(config[CONF_IAQ_MODE]))
|
||||||
|
|
|
@ -97,7 +97,7 @@ def setup_conf(config, key, hub):
|
||||||
cg.add(getattr(hub, f"set_{key}_sample_rate")(conf[CONF_SAMPLE_RATE]))
|
cg.add(getattr(hub, f"set_{key}_sample_rate")(conf[CONF_SAMPLE_RATE]))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_BME680_BSEC_ID])
|
hub = await cg.get_variable(config[CONF_BME680_BSEC_ID])
|
||||||
for key in TYPES:
|
for key in TYPES:
|
||||||
yield setup_conf(config, key, hub)
|
await setup_conf(config, key, hub)
|
||||||
|
|
|
@ -34,7 +34,7 @@ def setup_conf(config, key, hub):
|
||||||
cg.add(getattr(hub, f"set_{key}_text_sensor")(sens))
|
cg.add(getattr(hub, f"set_{key}_text_sensor")(sens))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_BME680_BSEC_ID])
|
hub = await cg.get_variable(config[CONF_BME680_BSEC_ID])
|
||||||
for key in TYPES:
|
for key in TYPES:
|
||||||
yield setup_conf(config, key, hub)
|
await setup_conf(config, key, hub)
|
||||||
|
|
|
@ -36,17 +36,17 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
conf = config[CONF_TEMPERATURE]
|
conf = config[CONF_TEMPERATURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_temperature(sens))
|
cg.add(var.set_temperature(sens))
|
||||||
|
|
||||||
if CONF_PRESSURE in config:
|
if CONF_PRESSURE in config:
|
||||||
conf = config[CONF_PRESSURE]
|
conf = config[CONF_PRESSURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_pressure(sens))
|
cg.add(var.set_pressure(sens))
|
||||||
|
|
|
@ -72,19 +72,19 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
conf = config[CONF_TEMPERATURE]
|
conf = config[CONF_TEMPERATURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
cg.add(var.set_temperature_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_temperature_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
||||||
if CONF_PRESSURE in config:
|
if CONF_PRESSURE in config:
|
||||||
conf = config[CONF_PRESSURE]
|
conf = config[CONF_PRESSURE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_pressure_sensor(sens))
|
cg.add(var.set_pressure_sensor(sens))
|
||||||
cg.add(var.set_pressure_oversampling(conf[CONF_OVERSAMPLING]))
|
cg.add(var.set_pressure_oversampling(conf[CONF_OVERSAMPLING]))
|
||||||
|
|
|
@ -43,22 +43,22 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
sens = yield sensor.new_sensor(config[CONF_ECO2])
|
sens = await sensor.new_sensor(config[CONF_ECO2])
|
||||||
cg.add(var.set_co2(sens))
|
cg.add(var.set_co2(sens))
|
||||||
sens = yield sensor.new_sensor(config[CONF_TVOC])
|
sens = await sensor.new_sensor(config[CONF_TVOC])
|
||||||
cg.add(var.set_tvoc(sens))
|
cg.add(var.set_tvoc(sens))
|
||||||
|
|
||||||
if CONF_BASELINE in config:
|
if CONF_BASELINE in config:
|
||||||
cg.add(var.set_baseline(config[CONF_BASELINE]))
|
cg.add(var.set_baseline(config[CONF_BASELINE]))
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield cg.get_variable(config[CONF_TEMPERATURE])
|
sens = await cg.get_variable(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature(sens))
|
cg.add(var.set_temperature(sens))
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield cg.get_variable(config[CONF_HUMIDITY])
|
sens = await cg.get_variable(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity(sens))
|
cg.add(var.set_humidity(sens))
|
||||||
|
|
|
@ -36,9 +36,9 @@ CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield climate_ir.register_climate_ir(var, config)
|
await climate_ir.register_climate_ir(var, config)
|
||||||
|
|
||||||
cg.add(var.set_header_high(config[CONF_HEADER_HIGH]))
|
cg.add(var.set_header_high(config[CONF_HEADER_HIGH]))
|
||||||
cg.add(var.set_header_low(config[CONF_HEADER_LOW]))
|
cg.add(var.set_header_low(config[CONF_HEADER_LOW]))
|
||||||
|
|
|
@ -26,7 +26,7 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
r = 0
|
r = 0
|
||||||
if CONF_RED in config:
|
if CONF_RED in config:
|
||||||
r = int(config[CONF_RED] * 255)
|
r = int(config[CONF_RED] * 255)
|
||||||
|
|
|
@ -16,6 +16,6 @@ CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield climate_ir.register_climate_ir(var, config)
|
await climate_ir.register_climate_ir(var, config)
|
||||||
|
|
|
@ -42,20 +42,20 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield uart.register_uart_device(var, config)
|
await uart.register_uart_device(var, config)
|
||||||
|
|
||||||
if CONF_VOLTAGE in config:
|
if CONF_VOLTAGE in config:
|
||||||
conf = config[CONF_VOLTAGE]
|
conf = config[CONF_VOLTAGE]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_voltage_sensor(sens))
|
cg.add(var.set_voltage_sensor(sens))
|
||||||
if CONF_CURRENT in config:
|
if CONF_CURRENT in config:
|
||||||
conf = config[CONF_CURRENT]
|
conf = config[CONF_CURRENT]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_current_sensor(sens))
|
cg.add(var.set_current_sensor(sens))
|
||||||
if CONF_POWER in config:
|
if CONF_POWER in config:
|
||||||
conf = config[CONF_POWER]
|
conf = config[CONF_POWER]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(var.set_power_sensor(sens))
|
cg.add(var.set_power_sensor(sens))
|
||||||
|
|
|
@ -32,11 +32,11 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
||||||
sens = yield cg.get_variable(config[CONF_SENSOR])
|
sens = await cg.get_variable(config[CONF_SENSOR])
|
||||||
cg.add(var.set_source(sens))
|
cg.add(var.set_source(sens))
|
||||||
cg.add(var.set_sample_duration(config[CONF_SAMPLE_DURATION]))
|
cg.add(var.set_sample_duration(config[CONF_SAMPLE_DURATION]))
|
||||||
|
|
|
@ -17,8 +17,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA],
|
config[CONF_LAMBDA],
|
||||||
[],
|
[],
|
||||||
return_type=cg.std_vector.template(binary_sensor.BinarySensorPtr),
|
return_type=cg.std_vector.template(binary_sensor.BinarySensorPtr),
|
||||||
|
@ -28,4 +28,4 @@ def to_code(config):
|
||||||
custom = cg.variable(config[CONF_ID], rhs)
|
custom = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_BINARY_SENSORS]):
|
for i, conf in enumerate(config[CONF_BINARY_SENSORS]):
|
||||||
rhs = custom.Pget_binary_sensor(i)
|
rhs = custom.Pget_binary_sensor(i)
|
||||||
yield binary_sensor.register_binary_sensor(rhs, conf)
|
await binary_sensor.register_binary_sensor(rhs, conf)
|
||||||
|
|
|
@ -16,8 +16,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA],
|
config[CONF_LAMBDA],
|
||||||
[],
|
[],
|
||||||
return_type=cg.std_vector.template(climate.Climate.operator("ptr")),
|
return_type=cg.std_vector.template(climate.Climate.operator("ptr")),
|
||||||
|
@ -27,4 +27,4 @@ def to_code(config):
|
||||||
custom = cg.variable(config[CONF_ID], rhs)
|
custom = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_CLIMATES]):
|
for i, conf in enumerate(config[CONF_CLIMATES]):
|
||||||
rhs = custom.Pget_climate(i)
|
rhs = custom.Pget_climate(i)
|
||||||
yield climate.register_climate(rhs, conf)
|
await climate.register_climate(rhs, conf)
|
||||||
|
|
|
@ -16,8 +16,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA],
|
config[CONF_LAMBDA],
|
||||||
[],
|
[],
|
||||||
return_type=cg.std_vector.template(cover.Cover.operator("ptr")),
|
return_type=cg.std_vector.template(cover.Cover.operator("ptr")),
|
||||||
|
@ -27,4 +27,4 @@ def to_code(config):
|
||||||
custom = cg.variable(config[CONF_ID], rhs)
|
custom = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_COVERS]):
|
for i, conf in enumerate(config[CONF_COVERS]):
|
||||||
rhs = custom.Pget_cover(i)
|
rhs = custom.Pget_cover(i)
|
||||||
yield cover.register_cover(rhs, conf)
|
await cover.register_cover(rhs, conf)
|
||||||
|
|
|
@ -16,8 +16,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA],
|
config[CONF_LAMBDA],
|
||||||
[],
|
[],
|
||||||
return_type=cg.std_vector.template(light.LightOutput.operator("ptr")),
|
return_type=cg.std_vector.template(light.LightOutput.operator("ptr")),
|
||||||
|
@ -27,4 +27,4 @@ def to_code(config):
|
||||||
custom = cg.variable(config[CONF_ID], rhs)
|
custom = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_LIGHTS]):
|
for i, conf in enumerate(config[CONF_LIGHTS]):
|
||||||
rhs = custom.Pget_light(i)
|
rhs = custom.Pget_light(i)
|
||||||
yield light.register_light(rhs, conf)
|
await light.register_light(rhs, conf)
|
||||||
|
|
|
@ -42,7 +42,7 @@ CONFIG_SCHEMA = cv.typed_schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
type = config[CONF_TYPE]
|
type = config[CONF_TYPE]
|
||||||
if type == "binary":
|
if type == "binary":
|
||||||
ret_type = output.BinaryOutputPtr
|
ret_type = output.BinaryOutputPtr
|
||||||
|
@ -50,7 +50,7 @@ def to_code(config):
|
||||||
else:
|
else:
|
||||||
ret_type = output.FloatOutputPtr
|
ret_type = output.FloatOutputPtr
|
||||||
klass = CustomFloatOutputConstructor
|
klass = CustomFloatOutputConstructor
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(ret_type)
|
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(ret_type)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,4 +58,4 @@ def to_code(config):
|
||||||
custom = cg.variable(config[CONF_ID], rhs)
|
custom = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_OUTPUTS]):
|
for i, conf in enumerate(config[CONF_OUTPUTS]):
|
||||||
out = cg.Pvariable(conf[CONF_ID], custom.get_output(i))
|
out = cg.Pvariable(conf[CONF_ID], custom.get_output(i))
|
||||||
yield output.register_output(out, conf)
|
await output.register_output(out, conf)
|
||||||
|
|
|
@ -15,8 +15,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(sensor.SensorPtr)
|
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(sensor.SensorPtr)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,4 +24,4 @@ def to_code(config):
|
||||||
var = cg.variable(config[CONF_ID], rhs)
|
var = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_SENSORS]):
|
for i, conf in enumerate(config[CONF_SENSORS]):
|
||||||
sens = cg.Pvariable(conf[CONF_ID], var.get_sensor(i))
|
sens = cg.Pvariable(conf[CONF_ID], var.get_sensor(i))
|
||||||
yield sensor.register_sensor(sens, conf)
|
await sensor.register_sensor(sens, conf)
|
||||||
|
|
|
@ -21,8 +21,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(switch.SwitchPtr)
|
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(switch.SwitchPtr)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,4 +30,4 @@ def to_code(config):
|
||||||
var = cg.variable(config[CONF_ID], rhs)
|
var = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config[CONF_SWITCHES]):
|
for i, conf in enumerate(config[CONF_SWITCHES]):
|
||||||
switch_ = cg.Pvariable(conf[CONF_ID], var.get_switch(i))
|
switch_ = cg.Pvariable(conf[CONF_ID], var.get_switch(i))
|
||||||
yield switch.register_switch(switch_, conf)
|
await switch.register_switch(switch_, conf)
|
||||||
|
|
|
@ -21,8 +21,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA],
|
config[CONF_LAMBDA],
|
||||||
[],
|
[],
|
||||||
return_type=cg.std_vector.template(text_sensor.TextSensorPtr),
|
return_type=cg.std_vector.template(text_sensor.TextSensorPtr),
|
||||||
|
@ -33,4 +33,4 @@ def to_code(config):
|
||||||
|
|
||||||
for i, conf in enumerate(config[CONF_TEXT_SENSORS]):
|
for i, conf in enumerate(config[CONF_TEXT_SENSORS]):
|
||||||
text = cg.Pvariable(conf[CONF_ID], var.get_text_sensor(i))
|
text = cg.Pvariable(conf[CONF_ID], var.get_text_sensor(i))
|
||||||
yield text_sensor.register_text_sensor(text, conf)
|
await text_sensor.register_text_sensor(text, conf)
|
||||||
|
|
|
@ -19,8 +19,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
template_ = yield cg.process_lambda(
|
template_ = await cg.process_lambda(
|
||||||
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(cg.ComponentPtr)
|
config[CONF_LAMBDA], [], return_type=cg.std_vector.template(cg.ComponentPtr)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,4 +28,4 @@ def to_code(config):
|
||||||
var = cg.variable(config[CONF_ID], rhs)
|
var = cg.variable(config[CONF_ID], rhs)
|
||||||
for i, conf in enumerate(config.get(CONF_COMPONENTS, [])):
|
for i, conf in enumerate(config.get(CONF_COMPONENTS, [])):
|
||||||
comp = cg.Pvariable(conf[CONF_ID], var.get_component(i))
|
comp = cg.Pvariable(conf[CONF_ID], var.get_component(i))
|
||||||
yield cg.register_component(comp, conf)
|
await cg.register_component(comp, conf)
|
||||||
|
|
|
@ -26,14 +26,14 @@ CONFIG_SCHEMA = light.RGB_LIGHT_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
||||||
yield light.register_light(var, config)
|
await light.register_light(var, config)
|
||||||
cwhite = yield cg.get_variable(config[CONF_COLD_WHITE])
|
cwhite = await cg.get_variable(config[CONF_COLD_WHITE])
|
||||||
cg.add(var.set_cold_white(cwhite))
|
cg.add(var.set_cold_white(cwhite))
|
||||||
cg.add(var.set_cold_white_temperature(config[CONF_COLD_WHITE_COLOR_TEMPERATURE]))
|
cg.add(var.set_cold_white_temperature(config[CONF_COLD_WHITE_COLOR_TEMPERATURE]))
|
||||||
|
|
||||||
wwhite = yield cg.get_variable(config[CONF_WARM_WHITE])
|
wwhite = await cg.get_variable(config[CONF_WARM_WHITE])
|
||||||
cg.add(var.set_warm_white(wwhite))
|
cg.add(var.set_warm_white(wwhite))
|
||||||
cg.add(var.set_warm_white_temperature(config[CONF_WARM_WHITE_COLOR_TEMPERATURE]))
|
cg.add(var.set_warm_white_temperature(config[CONF_WARM_WHITE_COLOR_TEMPERATURE]))
|
||||||
cg.add(var.set_constant_brightness(config[CONF_CONSTANT_BRIGHTNESS]))
|
cg.add(var.set_constant_brightness(config[CONF_CONSTANT_BRIGHTNESS]))
|
||||||
|
|
|
@ -15,6 +15,6 @@ CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield climate_ir.register_climate_ir(var, config)
|
await climate_ir.register_climate_ir(var, config)
|
||||||
|
|
|
@ -20,8 +20,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.polling_component_schema("60s"))
|
).extend(cv.polling_component_schema("60s"))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
one_wire = cg.new_Pvariable(config[CONF_ONE_WIRE_ID], pin)
|
one_wire = cg.new_Pvariable(config[CONF_ONE_WIRE_ID], pin)
|
||||||
var = cg.new_Pvariable(config[CONF_ID], one_wire)
|
var = cg.new_Pvariable(config[CONF_ID], one_wire)
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
|
@ -29,12 +29,12 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_DALLAS_ID])
|
hub = await cg.get_variable(config[CONF_DALLAS_ID])
|
||||||
if CONF_ADDRESS in config:
|
if CONF_ADDRESS in config:
|
||||||
address = config[CONF_ADDRESS]
|
address = config[CONF_ADDRESS]
|
||||||
rhs = hub.Pget_sensor_by_address(address, config.get(CONF_RESOLUTION))
|
rhs = hub.Pget_sensor_by_address(address, config.get(CONF_RESOLUTION))
|
||||||
else:
|
else:
|
||||||
rhs = hub.Pget_sensor_by_index(config[CONF_INDEX], config.get(CONF_RESOLUTION))
|
rhs = hub.Pget_sensor_by_index(config[CONF_INDEX], config.get(CONF_RESOLUTION))
|
||||||
var = cg.Pvariable(config[CONF_ID], rhs)
|
var = cg.Pvariable(config[CONF_ID], rhs)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
|
@ -14,6 +14,6 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
|
@ -78,14 +78,14 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
if CONF_SLEEP_DURATION in config:
|
if CONF_SLEEP_DURATION in config:
|
||||||
cg.add(var.set_sleep_duration(config[CONF_SLEEP_DURATION]))
|
cg.add(var.set_sleep_duration(config[CONF_SLEEP_DURATION]))
|
||||||
if CONF_WAKEUP_PIN in config:
|
if CONF_WAKEUP_PIN in config:
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_WAKEUP_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_WAKEUP_PIN])
|
||||||
cg.add(var.set_wakeup_pin(pin))
|
cg.add(var.set_wakeup_pin(pin))
|
||||||
if CONF_WAKEUP_PIN_MODE in config:
|
if CONF_WAKEUP_PIN_MODE in config:
|
||||||
cg.add(var.set_wakeup_pin_mode(config[CONF_WAKEUP_PIN_MODE]))
|
cg.add(var.set_wakeup_pin_mode(config[CONF_WAKEUP_PIN_MODE]))
|
||||||
|
|
|
@ -68,14 +68,14 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield uart.register_uart_device(var, config)
|
await uart.register_uart_device(var, config)
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_FINISHED_PLAYBACK, []):
|
for conf in config.get(CONF_ON_FINISHED_PLAYBACK, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(trigger, [], conf)
|
await automation.build_automation(trigger, [], conf)
|
||||||
|
|
||||||
|
|
||||||
@automation.register_action(
|
@automation.register_action(
|
||||||
|
|
|
@ -47,18 +47,18 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.polling_component_schema("60s"))
|
).extend(cv.polling_component_schema("60s"))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
pin = yield gpio_pin_expression(config[CONF_PIN])
|
pin = await gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity_sensor(sens))
|
cg.add(var.set_humidity_sensor(sens))
|
||||||
|
|
||||||
cg.add(var.set_dht_model(config[CONF_MODEL]))
|
cg.add(var.set_dht_model(config[CONF_MODEL]))
|
||||||
|
|
|
@ -34,15 +34,15 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature_sensor(sens))
|
cg.add(var.set_temperature_sensor(sens))
|
||||||
|
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity_sensor(sens))
|
cg.add(var.set_humidity_sensor(sens))
|
||||||
|
|
|
@ -50,9 +50,9 @@ def ds1307_read_time_to_code(config, action_id, template_arg, args):
|
||||||
yield var
|
yield var
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
|
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
yield time.register_time(var, config)
|
await time.register_time(var, config)
|
||||||
|
|
|
@ -29,10 +29,10 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
|
@ -29,9 +29,9 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
cg.add(var.set_method(METHODS[config[CONF_METHOD]]))
|
cg.add(var.set_method(METHODS[config[CONF_METHOD]]))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,26 +32,26 @@ CONFIG_SCHEMA = cover.COVER_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield cover.register_cover(var, config)
|
await cover.register_cover(var, config)
|
||||||
|
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
var.get_stop_trigger(), [], config[CONF_STOP_ACTION]
|
var.get_stop_trigger(), [], config[CONF_STOP_ACTION]
|
||||||
)
|
)
|
||||||
|
|
||||||
bin = yield cg.get_variable(config[CONF_OPEN_ENDSTOP])
|
bin = await cg.get_variable(config[CONF_OPEN_ENDSTOP])
|
||||||
cg.add(var.set_open_endstop(bin))
|
cg.add(var.set_open_endstop(bin))
|
||||||
cg.add(var.set_open_duration(config[CONF_OPEN_DURATION]))
|
cg.add(var.set_open_duration(config[CONF_OPEN_DURATION]))
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
var.get_open_trigger(), [], config[CONF_OPEN_ACTION]
|
var.get_open_trigger(), [], config[CONF_OPEN_ACTION]
|
||||||
)
|
)
|
||||||
|
|
||||||
bin = yield cg.get_variable(config[CONF_CLOSE_ENDSTOP])
|
bin = await cg.get_variable(config[CONF_CLOSE_ENDSTOP])
|
||||||
cg.add(var.set_close_endstop(bin))
|
cg.add(var.set_close_endstop(bin))
|
||||||
cg.add(var.set_close_duration(config[CONF_CLOSE_DURATION]))
|
cg.add(var.set_close_duration(config[CONF_CLOSE_DURATION]))
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
var.get_close_trigger(), [], config[CONF_CLOSE_ACTION]
|
var.get_close_trigger(), [], config[CONF_CLOSE_ACTION]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
uuid = config[CONF_UUID].hex
|
uuid = config[CONF_UUID].hex
|
||||||
uuid_arr = [
|
uuid_arr = [
|
||||||
cg.RawExpression("0x{}".format(uuid[i : i + 2])) for i in range(0, len(uuid), 2)
|
cg.RawExpression("0x{}".format(uuid[i : i + 2])) for i in range(0, len(uuid), 2)
|
||||||
]
|
]
|
||||||
var = cg.new_Pvariable(config[CONF_ID], uuid_arr)
|
var = cg.new_Pvariable(config[CONF_ID], uuid_arr)
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
cg.add(var.set_major(config[CONF_MAJOR]))
|
cg.add(var.set_major(config[CONF_MAJOR]))
|
||||||
cg.add(var.set_minor(config[CONF_MINOR]))
|
cg.add(var.set_minor(config[CONF_MINOR]))
|
||||||
|
|
|
@ -177,9 +177,9 @@ ESP_BLE_DEVICE_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
params = config[CONF_SCAN_PARAMETERS]
|
params = config[CONF_SCAN_PARAMETERS]
|
||||||
cg.add(var.set_scan_duration(params[CONF_DURATION]))
|
cg.add(var.set_scan_duration(params[CONF_DURATION]))
|
||||||
cg.add(var.set_scan_interval(int(params[CONF_INTERVAL].total_milliseconds / 0.625)))
|
cg.add(var.set_scan_interval(int(params[CONF_INTERVAL].total_milliseconds / 0.625)))
|
||||||
|
@ -189,7 +189,7 @@ def to_code(config):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
if CONF_MAC_ADDRESS in conf:
|
if CONF_MAC_ADDRESS in conf:
|
||||||
cg.add(trigger.set_address(conf[CONF_MAC_ADDRESS].as_hex))
|
cg.add(trigger.set_address(conf[CONF_MAC_ADDRESS].as_hex))
|
||||||
yield automation.build_automation(trigger, [(ESPBTDeviceConstRef, "x")], conf)
|
await automation.build_automation(trigger, [(ESPBTDeviceConstRef, "x")], conf)
|
||||||
for conf in config.get(CONF_ON_BLE_SERVICE_DATA_ADVERTISE, []):
|
for conf in config.get(CONF_ON_BLE_SERVICE_DATA_ADVERTISE, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
if len(conf[CONF_SERVICE_UUID]) == len(bt_uuid16_format):
|
if len(conf[CONF_SERVICE_UUID]) == len(bt_uuid16_format):
|
||||||
|
@ -201,7 +201,7 @@ def to_code(config):
|
||||||
cg.add(trigger.set_service_uuid128(uuid128))
|
cg.add(trigger.set_service_uuid128(uuid128))
|
||||||
if CONF_MAC_ADDRESS in conf:
|
if CONF_MAC_ADDRESS in conf:
|
||||||
cg.add(trigger.set_address(conf[CONF_MAC_ADDRESS].as_hex))
|
cg.add(trigger.set_address(conf[CONF_MAC_ADDRESS].as_hex))
|
||||||
yield automation.build_automation(trigger, [(adv_data_t_const_ref, "x")], conf)
|
await automation.build_automation(trigger, [(adv_data_t_const_ref, "x")], conf)
|
||||||
for conf in config.get(CONF_ON_BLE_MANUFACTURER_DATA_ADVERTISE, []):
|
for conf in config.get(CONF_ON_BLE_MANUFACTURER_DATA_ADVERTISE, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
if len(conf[CONF_MANUFACTURER_ID]) == len(bt_uuid16_format):
|
if len(conf[CONF_MANUFACTURER_ID]) == len(bt_uuid16_format):
|
||||||
|
@ -213,7 +213,7 @@ def to_code(config):
|
||||||
cg.add(trigger.set_manufacturer_uuid128(uuid128))
|
cg.add(trigger.set_manufacturer_uuid128(uuid128))
|
||||||
if CONF_MAC_ADDRESS in conf:
|
if CONF_MAC_ADDRESS in conf:
|
||||||
cg.add(trigger.set_address(conf[CONF_MAC_ADDRESS].as_hex))
|
cg.add(trigger.set_address(conf[CONF_MAC_ADDRESS].as_hex))
|
||||||
yield automation.build_automation(trigger, [(adv_data_t_const_ref, "x")], conf)
|
await automation.build_automation(trigger, [(adv_data_t_const_ref, "x")], conf)
|
||||||
|
|
||||||
|
|
||||||
@coroutine
|
@coroutine
|
||||||
|
|
|
@ -124,9 +124,9 @@ SETTERS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID], config[CONF_NAME])
|
var = cg.new_Pvariable(config[CONF_ID], config[CONF_NAME])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
for key, setter in SETTERS.items():
|
for key, setter in SETTERS.items():
|
||||||
if key in config:
|
if key in config:
|
||||||
|
|
|
@ -26,10 +26,10 @@ CONFIG_SCHEMA = output.FLOAT_OUTPUT_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield output.register_output(var, config)
|
await output.register_output(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
|
@ -27,7 +27,7 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
|
@ -77,9 +77,9 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
touch = cg.new_Pvariable(config[CONF_ID])
|
touch = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(touch, config)
|
await cg.register_component(touch, config)
|
||||||
|
|
||||||
cg.add(touch.set_setup_mode(config[CONF_SETUP_MODE]))
|
cg.add(touch.set_setup_mode(config[CONF_SETUP_MODE]))
|
||||||
cg.add(touch.set_iir_filter(config[CONF_IIR_FILTER]))
|
cg.add(touch.set_iir_filter(config[CONF_IIR_FILTER]))
|
||||||
|
|
|
@ -51,13 +51,13 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_ESP32_TOUCH_ID])
|
hub = await cg.get_variable(config[CONF_ESP32_TOUCH_ID])
|
||||||
var = cg.new_Pvariable(
|
var = cg.new_Pvariable(
|
||||||
config[CONF_ID],
|
config[CONF_ID],
|
||||||
config[CONF_NAME],
|
config[CONF_NAME],
|
||||||
TOUCH_PADS[config[CONF_PIN]],
|
TOUCH_PADS[config[CONF_PIN]],
|
||||||
config[CONF_THRESHOLD],
|
config[CONF_THRESHOLD],
|
||||||
)
|
)
|
||||||
yield binary_sensor.register_binary_sensor(var, config)
|
await binary_sensor.register_binary_sensor(var, config)
|
||||||
cg.add(hub.register_touch_pad(var))
|
cg.add(hub.register_touch_pad(var))
|
||||||
|
|
|
@ -35,12 +35,12 @@ CONFIG_SCHEMA = output.FLOAT_OUTPUT_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield output.register_output(var, config)
|
await output.register_output(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
||||||
cg.add(var.set_frequency(config[CONF_FREQUENCY]))
|
cg.add(var.set_frequency(config[CONF_FREQUENCY]))
|
||||||
|
|
|
@ -106,9 +106,9 @@ def manual_ip(config):
|
||||||
|
|
||||||
|
|
||||||
@coroutine_with_priority(60.0)
|
@coroutine_with_priority(60.0)
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
cg.add(var.set_phy_addr(config[CONF_PHY_ADDR]))
|
cg.add(var.set_phy_addr(config[CONF_PHY_ADDR]))
|
||||||
cg.add(var.set_mdc_pin(config[CONF_MDC_PIN]))
|
cg.add(var.set_mdc_pin(config[CONF_MDC_PIN]))
|
||||||
|
@ -118,7 +118,7 @@ def to_code(config):
|
||||||
cg.add(var.set_use_address(config[CONF_USE_ADDRESS]))
|
cg.add(var.set_use_address(config[CONF_USE_ADDRESS]))
|
||||||
|
|
||||||
if CONF_POWER_PIN in config:
|
if CONF_POWER_PIN in config:
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_POWER_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_POWER_PIN])
|
||||||
cg.add(var.set_power_pin(pin))
|
cg.add(var.set_power_pin(pin))
|
||||||
|
|
||||||
if CONF_MANUAL_IP in config:
|
if CONF_MANUAL_IP in config:
|
||||||
|
|
|
@ -32,8 +32,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
for conf in config.get(CONF_ON_EXPOSURE_NOTIFICATION, []):
|
for conf in config.get(CONF_ON_EXPOSURE_NOTIFICATION, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
|
||||||
yield automation.build_automation(trigger, [(ExposureNotification, "x")], conf)
|
await automation.build_automation(trigger, [(ExposureNotification, "x")], conf)
|
||||||
yield esp32_ble_tracker.register_ble_device(trigger, conf)
|
await esp32_ble_tracker.register_ble_device(trigger, conf)
|
||||||
|
|
|
@ -98,7 +98,7 @@ CONFIG_SCHEMA = cv.ensure_list(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
|
@ -51,8 +51,8 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = yield fastled_base.new_fastled_light(config)
|
var = await fastled_base.new_fastled_light(config)
|
||||||
|
|
||||||
rgb_order = None
|
rgb_order = None
|
||||||
if CONF_RGB_ORDER in config:
|
if CONF_RGB_ORDER in config:
|
||||||
|
|
|
@ -34,8 +34,8 @@ CONFIG_SCHEMA = fastled_base.BASE_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = yield fastled_base.new_fastled_light(config)
|
var = await fastled_base.new_fastled_light(config)
|
||||||
|
|
||||||
rgb_order = cg.RawExpression(
|
rgb_order = cg.RawExpression(
|
||||||
config[CONF_RGB_ORDER] if CONF_RGB_ORDER in config else "RGB"
|
config[CONF_RGB_ORDER] if CONF_RGB_ORDER in config else "RGB"
|
||||||
|
|
|
@ -132,45 +132,45 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
if CONF_PASSWORD in config:
|
if CONF_PASSWORD in config:
|
||||||
password = config[CONF_PASSWORD]
|
password = config[CONF_PASSWORD]
|
||||||
cg.add(var.set_password(password))
|
cg.add(var.set_password(password))
|
||||||
yield uart.register_uart_device(var, config)
|
await uart.register_uart_device(var, config)
|
||||||
|
|
||||||
if CONF_NEW_PASSWORD in config:
|
if CONF_NEW_PASSWORD in config:
|
||||||
new_password = config[CONF_NEW_PASSWORD]
|
new_password = config[CONF_NEW_PASSWORD]
|
||||||
cg.add(var.set_new_password(new_password))
|
cg.add(var.set_new_password(new_password))
|
||||||
|
|
||||||
if CONF_SENSING_PIN in config:
|
if CONF_SENSING_PIN in config:
|
||||||
sensing_pin = yield cg.gpio_pin_expression(config[CONF_SENSING_PIN])
|
sensing_pin = await cg.gpio_pin_expression(config[CONF_SENSING_PIN])
|
||||||
cg.add(var.set_sensing_pin(sensing_pin))
|
cg.add(var.set_sensing_pin(sensing_pin))
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_FINGER_SCAN_MATCHED, []):
|
for conf in config.get(CONF_ON_FINGER_SCAN_MATCHED, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
trigger, [(cg.uint16, "finger_id"), (cg.uint16, "confidence")], conf
|
trigger, [(cg.uint16, "finger_id"), (cg.uint16, "confidence")], conf
|
||||||
)
|
)
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_FINGER_SCAN_UNMATCHED, []):
|
for conf in config.get(CONF_ON_FINGER_SCAN_UNMATCHED, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(trigger, [], conf)
|
await automation.build_automation(trigger, [], conf)
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_ENROLLMENT_SCAN, []):
|
for conf in config.get(CONF_ON_ENROLLMENT_SCAN, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(
|
await automation.build_automation(
|
||||||
trigger, [(cg.uint8, "scan_num"), (cg.uint16, "finger_id")], conf
|
trigger, [(cg.uint8, "scan_num"), (cg.uint16, "finger_id")], conf
|
||||||
)
|
)
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_ENROLLMENT_DONE, []):
|
for conf in config.get(CONF_ON_ENROLLMENT_DONE, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(trigger, [(cg.uint16, "finger_id")], conf)
|
await automation.build_automation(trigger, [(cg.uint16, "finger_id")], conf)
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_ENROLLMENT_FAILED, []):
|
for conf in config.get(CONF_ON_ENROLLMENT_FAILED, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
yield automation.build_automation(trigger, [(cg.uint16, "finger_id")], conf)
|
await automation.build_automation(trigger, [(cg.uint16, "finger_id")], conf)
|
||||||
|
|
||||||
|
|
||||||
@automation.register_action(
|
@automation.register_action(
|
||||||
|
|
|
@ -14,7 +14,7 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_FINGERPRINT_GROW_ID])
|
hub = await cg.get_variable(config[CONF_FINGERPRINT_GROW_ID])
|
||||||
var = yield binary_sensor.new_binary_sensor(config)
|
var = await binary_sensor.new_binary_sensor(config)
|
||||||
cg.add(hub.set_enrolling_binary_sensor(var))
|
cg.add(hub.set_enrolling_binary_sensor(var))
|
||||||
|
|
|
@ -46,8 +46,8 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
hub = yield cg.get_variable(config[CONF_FINGERPRINT_GROW_ID])
|
hub = await cg.get_variable(config[CONF_FINGERPRINT_GROW_ID])
|
||||||
|
|
||||||
for key in [
|
for key in [
|
||||||
CONF_FINGERPRINT_COUNT,
|
CONF_FINGERPRINT_COUNT,
|
||||||
|
@ -60,5 +60,5 @@ def to_code(config):
|
||||||
if key not in config:
|
if key not in config:
|
||||||
continue
|
continue
|
||||||
conf = config[key]
|
conf = config[key]
|
||||||
sens = yield sensor.new_sensor(conf)
|
sens = await sensor.new_sensor(conf)
|
||||||
cg.add(getattr(hub, f"set_{key}_sensor")(sens))
|
cg.add(getattr(hub, f"set_{key}_sensor")(sens))
|
||||||
|
|
|
@ -92,7 +92,7 @@ FONT_SCHEMA = cv.Schema(
|
||||||
CONFIG_SCHEMA = cv.All(validate_pillow_installed, FONT_SCHEMA)
|
CONFIG_SCHEMA = cv.All(validate_pillow_installed, FONT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
from PIL import ImageFont
|
from PIL import ImageFont
|
||||||
|
|
||||||
path = CORE.relative_config_path(config[CONF_FILE])
|
path = CORE.relative_config_path(config[CONF_FILE])
|
||||||
|
|
|
@ -17,6 +17,6 @@ CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield climate_ir.register_climate_ir(var, config)
|
await climate_ir.register_climate_ir(var, config)
|
||||||
|
|
|
@ -17,10 +17,10 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield binary_sensor.register_binary_sensor(var, config)
|
await binary_sensor.register_binary_sensor(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
|
@ -15,10 +15,10 @@ CONFIG_SCHEMA = output.BINARY_OUTPUT_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield output.register_output(var, config)
|
await output.register_output(var, config)
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
|
@ -33,12 +33,12 @@ CONFIG_SCHEMA = switch.SWITCH_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield switch.register_switch(var, config)
|
await switch.register_switch(var, config)
|
||||||
|
|
||||||
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
|
pin = await cg.gpio_pin_expression(config[CONF_PIN])
|
||||||
cg.add(var.set_pin(pin))
|
cg.add(var.set_pin(pin))
|
||||||
|
|
||||||
cg.add(var.set_restore_mode(config[CONF_RESTORE_MODE]))
|
cg.add(var.set_restore_mode(config[CONF_RESTORE_MODE]))
|
||||||
|
@ -46,7 +46,7 @@ def to_code(config):
|
||||||
if CONF_INTERLOCK in config:
|
if CONF_INTERLOCK in config:
|
||||||
interlock = []
|
interlock = []
|
||||||
for it in config[CONF_INTERLOCK]:
|
for it in config[CONF_INTERLOCK]:
|
||||||
lock = yield cg.get_variable(it)
|
lock = await cg.get_variable(it)
|
||||||
interlock.append(lock)
|
interlock.append(lock)
|
||||||
cg.add(var.set_interlock(interlock))
|
cg.add(var.set_interlock(interlock))
|
||||||
cg.add(var.set_interlock_wait_time(config[CONF_INTERLOCK_WAIT_TIME]))
|
cg.add(var.set_interlock_wait_time(config[CONF_INTERLOCK_WAIT_TIME]))
|
||||||
|
|
|
@ -58,33 +58,33 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield uart.register_uart_device(var, config)
|
await uart.register_uart_device(var, config)
|
||||||
|
|
||||||
if CONF_LATITUDE in config:
|
if CONF_LATITUDE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_LATITUDE])
|
sens = await sensor.new_sensor(config[CONF_LATITUDE])
|
||||||
cg.add(var.set_latitude_sensor(sens))
|
cg.add(var.set_latitude_sensor(sens))
|
||||||
|
|
||||||
if CONF_LONGITUDE in config:
|
if CONF_LONGITUDE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_LONGITUDE])
|
sens = await sensor.new_sensor(config[CONF_LONGITUDE])
|
||||||
cg.add(var.set_longitude_sensor(sens))
|
cg.add(var.set_longitude_sensor(sens))
|
||||||
|
|
||||||
if CONF_SPEED in config:
|
if CONF_SPEED in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_SPEED])
|
sens = await sensor.new_sensor(config[CONF_SPEED])
|
||||||
cg.add(var.set_speed_sensor(sens))
|
cg.add(var.set_speed_sensor(sens))
|
||||||
|
|
||||||
if CONF_COURSE in config:
|
if CONF_COURSE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_COURSE])
|
sens = await sensor.new_sensor(config[CONF_COURSE])
|
||||||
cg.add(var.set_course_sensor(sens))
|
cg.add(var.set_course_sensor(sens))
|
||||||
|
|
||||||
if CONF_ALTITUDE in config:
|
if CONF_ALTITUDE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_ALTITUDE])
|
sens = await sensor.new_sensor(config[CONF_ALTITUDE])
|
||||||
cg.add(var.set_altitude_sensor(sens))
|
cg.add(var.set_altitude_sensor(sens))
|
||||||
|
|
||||||
if CONF_SATELLITES in config:
|
if CONF_SATELLITES in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_SATELLITES])
|
sens = await sensor.new_sensor(config[CONF_SATELLITES])
|
||||||
cg.add(var.set_satellites_sensor(sens))
|
cg.add(var.set_satellites_sensor(sens))
|
||||||
|
|
||||||
# https://platformio.org/lib/show/1655/TinyGPSPlus
|
# https://platformio.org/lib/show/1655/TinyGPSPlus
|
||||||
|
|
|
@ -18,10 +18,10 @@ CONFIG_SCHEMA = time_.TIME_SCHEMA.extend(
|
||||||
).extend(cv.polling_component_schema("5min"))
|
).extend(cv.polling_component_schema("5min"))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield time_.register_time(var, config)
|
await time_.register_time(var, config)
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
paren = yield cg.get_variable(config[CONF_GPS_ID])
|
paren = await cg.get_variable(config[CONF_GPS_ID])
|
||||||
cg.add(paren.register_listener(var))
|
cg.add(paren.register_listener(var))
|
||||||
|
|
|
@ -17,12 +17,12 @@ CONFIG_SCHEMA = light.RGB_LIGHT_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield light.register_light(var, config)
|
await light.register_light(var, config)
|
||||||
|
|
||||||
hside = yield cg.get_variable(config[CONF_PIN_A])
|
hside = await cg.get_variable(config[CONF_PIN_A])
|
||||||
cg.add(var.set_pina_pin(hside))
|
cg.add(var.set_pina_pin(hside))
|
||||||
lside = yield cg.get_variable(config[CONF_PIN_B])
|
lside = await cg.get_variable(config[CONF_PIN_B])
|
||||||
cg.add(var.set_pinb_pin(lside))
|
cg.add(var.set_pinb_pin(lside))
|
||||||
|
|
|
@ -36,15 +36,15 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_TEMPERATURE in config:
|
if CONF_TEMPERATURE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||||
cg.add(var.set_temperature(sens))
|
cg.add(var.set_temperature(sens))
|
||||||
|
|
||||||
if CONF_HUMIDITY in config:
|
if CONF_HUMIDITY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||||
cg.add(var.set_humidity(sens))
|
cg.add(var.set_humidity(sens))
|
||||||
|
|
|
@ -15,6 +15,6 @@ CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield climate_ir.register_climate_ir(var, config)
|
await climate_ir.register_climate_ir(var, config)
|
||||||
|
|
|
@ -70,28 +70,28 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
).extend(cv.polling_component_schema("60s"))
|
).extend(cv.polling_component_schema("60s"))
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
sel = yield cg.gpio_pin_expression(config[CONF_SEL_PIN])
|
sel = await cg.gpio_pin_expression(config[CONF_SEL_PIN])
|
||||||
cg.add(var.set_sel_pin(sel))
|
cg.add(var.set_sel_pin(sel))
|
||||||
cf = yield cg.gpio_pin_expression(config[CONF_CF_PIN])
|
cf = await cg.gpio_pin_expression(config[CONF_CF_PIN])
|
||||||
cg.add(var.set_cf_pin(cf))
|
cg.add(var.set_cf_pin(cf))
|
||||||
cf1 = yield cg.gpio_pin_expression(config[CONF_CF1_PIN])
|
cf1 = await cg.gpio_pin_expression(config[CONF_CF1_PIN])
|
||||||
cg.add(var.set_cf1_pin(cf1))
|
cg.add(var.set_cf1_pin(cf1))
|
||||||
|
|
||||||
if CONF_VOLTAGE in config:
|
if CONF_VOLTAGE in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_VOLTAGE])
|
sens = await sensor.new_sensor(config[CONF_VOLTAGE])
|
||||||
cg.add(var.set_voltage_sensor(sens))
|
cg.add(var.set_voltage_sensor(sens))
|
||||||
if CONF_CURRENT in config:
|
if CONF_CURRENT in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_CURRENT])
|
sens = await sensor.new_sensor(config[CONF_CURRENT])
|
||||||
cg.add(var.set_current_sensor(sens))
|
cg.add(var.set_current_sensor(sens))
|
||||||
if CONF_POWER in config:
|
if CONF_POWER in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_POWER])
|
sens = await sensor.new_sensor(config[CONF_POWER])
|
||||||
cg.add(var.set_power_sensor(sens))
|
cg.add(var.set_power_sensor(sens))
|
||||||
if CONF_ENERGY in config:
|
if CONF_ENERGY in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_ENERGY])
|
sens = await sensor.new_sensor(config[CONF_ENERGY])
|
||||||
cg.add(var.set_energy_sensor(sens))
|
cg.add(var.set_energy_sensor(sens))
|
||||||
cg.add(var.set_current_resistor(config[CONF_CURRENT_RESISTOR]))
|
cg.add(var.set_current_resistor(config[CONF_CURRENT_RESISTOR]))
|
||||||
cg.add(var.set_voltage_divider(config[CONF_VOLTAGE_DIVIDER]))
|
cg.add(var.set_voltage_divider(config[CONF_VOLTAGE_DIVIDER]))
|
||||||
|
|
|
@ -76,25 +76,25 @@ CONFIG_SCHEMA = cv.All(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
if CONF_PM_1_0 in config:
|
if CONF_PM_1_0 in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_PM_1_0])
|
sens = await sensor.new_sensor(config[CONF_PM_1_0])
|
||||||
cg.add(var.set_pm_1_0_sensor(sens))
|
cg.add(var.set_pm_1_0_sensor(sens))
|
||||||
|
|
||||||
if CONF_PM_2_5 in config:
|
if CONF_PM_2_5 in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_PM_2_5])
|
sens = await sensor.new_sensor(config[CONF_PM_2_5])
|
||||||
cg.add(var.set_pm_2_5_sensor(sens))
|
cg.add(var.set_pm_2_5_sensor(sens))
|
||||||
|
|
||||||
if CONF_PM_10_0 in config:
|
if CONF_PM_10_0 in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_PM_10_0])
|
sens = await sensor.new_sensor(config[CONF_PM_10_0])
|
||||||
cg.add(var.set_pm_10_0_sensor(sens))
|
cg.add(var.set_pm_10_0_sensor(sens))
|
||||||
|
|
||||||
if CONF_AQI in config:
|
if CONF_AQI in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_AQI])
|
sens = await sensor.new_sensor(config[CONF_AQI])
|
||||||
cg.add(var.set_aqi_sensor(sens))
|
cg.add(var.set_aqi_sensor(sens))
|
||||||
cg.add(var.set_aqi_calculation_type(config[CONF_AQI][CONF_CALCULATION_TYPE]))
|
cg.add(var.set_aqi_calculation_type(config[CONF_AQI][CONF_CALCULATION_TYPE]))
|
||||||
|
|
||||||
|
|
|
@ -115,23 +115,23 @@ def auto_data_rate(config):
|
||||||
return HMC5883LDatarates[75]
|
return HMC5883LDatarates[75]
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
|
|
||||||
cg.add(var.set_oversampling(config[CONF_OVERSAMPLING]))
|
cg.add(var.set_oversampling(config[CONF_OVERSAMPLING]))
|
||||||
cg.add(var.set_datarate(auto_data_rate(config)))
|
cg.add(var.set_datarate(auto_data_rate(config)))
|
||||||
cg.add(var.set_range(config[CONF_RANGE]))
|
cg.add(var.set_range(config[CONF_RANGE]))
|
||||||
if CONF_FIELD_STRENGTH_X in config:
|
if CONF_FIELD_STRENGTH_X in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_FIELD_STRENGTH_X])
|
sens = await sensor.new_sensor(config[CONF_FIELD_STRENGTH_X])
|
||||||
cg.add(var.set_x_sensor(sens))
|
cg.add(var.set_x_sensor(sens))
|
||||||
if CONF_FIELD_STRENGTH_Y in config:
|
if CONF_FIELD_STRENGTH_Y in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_FIELD_STRENGTH_Y])
|
sens = await sensor.new_sensor(config[CONF_FIELD_STRENGTH_Y])
|
||||||
cg.add(var.set_y_sensor(sens))
|
cg.add(var.set_y_sensor(sens))
|
||||||
if CONF_FIELD_STRENGTH_Z in config:
|
if CONF_FIELD_STRENGTH_Z in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_FIELD_STRENGTH_Z])
|
sens = await sensor.new_sensor(config[CONF_FIELD_STRENGTH_Z])
|
||||||
cg.add(var.set_z_sensor(sens))
|
cg.add(var.set_z_sensor(sens))
|
||||||
if CONF_HEADING in config:
|
if CONF_HEADING in config:
|
||||||
sens = yield sensor.new_sensor(config[CONF_HEADING])
|
sens = await sensor.new_sensor(config[CONF_HEADING])
|
||||||
cg.add(var.set_heading_sensor(sens))
|
cg.add(var.set_heading_sensor(sens))
|
||||||
|
|
|
@ -18,10 +18,10 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield binary_sensor.register_binary_sensor(var, config)
|
await binary_sensor.register_binary_sensor(var, config)
|
||||||
|
|
||||||
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
||||||
if CONF_ATTRIBUTE in config:
|
if CONF_ATTRIBUTE in config:
|
||||||
|
|
|
@ -28,10 +28,10 @@ CONFIG_SCHEMA = sensor.sensor_schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
|
|
||||||
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
||||||
if CONF_ATTRIBUTE in config:
|
if CONF_ATTRIBUTE in config:
|
||||||
|
|
|
@ -19,10 +19,10 @@ CONFIG_SCHEMA = text_sensor.TEXT_SENSOR_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
yield text_sensor.register_text_sensor(var, config)
|
await text_sensor.register_text_sensor(var, config)
|
||||||
|
|
||||||
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
|
||||||
if CONF_ATTRIBUTE in config:
|
if CONF_ATTRIBUTE in config:
|
||||||
|
|
|
@ -15,8 +15,8 @@ CONFIG_SCHEMA = time_.TIME_SCHEMA.extend(
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
yield time_.register_time(var, config)
|
await time_.register_time(var, config)
|
||||||
yield cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
cg.add_define("USE_HOMEASSISTANT_TIME")
|
cg.add_define("USE_HOMEASSISTANT_TIME")
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue