def to_code(config): for remote in get_variable(config[CONF_REMOTE_RECEIVER_ID]): yield rhs = receiver_base(config) receiver = Pvariable(config[CONF_RECEIVER_ID], rhs) binary_sensor.register_binary_sensor(remote.add_decoder(receiver), config)
def to_code(config): hub = None for hub in get_variable(config[CONF_ESP32_TOUCH_ID]): yield touch_pad = TOUCH_PADS[config[CONF_PIN]] rhs = hub.make_touch_pad(config[CONF_NAME], touch_pad, config[CONF_THRESHOLD]) binary_sensor.register_binary_sensor(rhs, config)
def to_code(config): for template_ in process_lambda(config[CONF_LAMBDA], [], return_type=std_vector.template(binary_sensor.BinarySensorPtr)): yield rhs = CustomBinarySensorConstructor(template_) custom = variable(config[CONF_ID], rhs) for i, conf in enumerate(config[CONF_BINARY_SENSORS]): rhs = custom.Pget_binary_sensor(i) add(rhs.set_name(conf[CONF_NAME])) binary_sensor.register_binary_sensor(rhs, conf)
def to_code(config): paren = yield cg.get_variable(config[CONF_SERIAL_SERVER_ID]) var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) cg.add(paren.register_connection_sensor(var))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield binary_sensor.register_binary_sensor(var, config) pin = yield cg.gpio_pin_expression(config[CONF_PIN]) cg.add(var.set_pin(pin))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) hub = yield cg.get_variable(config[CONF_RDM6300_ID]) cg.add(hub.register_card(var)) cg.add(var.set_id(config[CONF_UID]))
def to_code(config): paren = yield cg.get_variable(config[CONF_HUB_ID]) var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) cg.add(paren.register_binary_sensor(var))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) hub = yield cg.get_variable(config[CONF_SX1509_ID]) cg.add(var.set_row_col(config[CONF_ROW], config[CONF_COL])) cg.add(hub.register_keypad_binary_sensor(var))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) cg.add(var.set_channel(config[CONF_CHANNEL])) hub = yield cg.get_variable(config[CONF_TTP229_ID]) cg.add(hub.register_channel(var))
def to_code(config): hub = yield cg.get_variable(config[CONF_ESP32_TOUCH_ID]) var = cg.new_Pvariable(config[CONF_ID], config[CONF_NAME], TOUCH_PADS[config[CONF_PIN]], config[CONF_THRESHOLD]) yield binary_sensor.register_binary_sensor(var, config) cg.add(hub.register_touch_pad(var))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield esp32_ble_tracker.register_ble_device(var, config) yield binary_sensor.register_binary_sensor(var, config) cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex)) cg.add(var.set_time(config[CONF_TIMEOUT]))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) cg.add(var.set_key_id(config[CONF_KEY_ID])) hub = yield cg.get_variable(config[CONF_QMK_ID]) cg.add(hub.register_receiver(var))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) hub = yield cg.get_variable(config[CONF_PN532_ID]) cg.add(hub.register_tag(var)) addr = [HexInt(int(x, 16)) for x in config[CONF_UID].split("-")] cg.add(var.set_uid(addr))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield binary_sensor.register_binary_sensor(var, config) front_panel_hal_var = yield cg.get_variable( config[CONF_FRONT_PANEL_HAL_ID]) cg.add(var.set_parent(front_panel_hal_var)) cg.add(var.set_for(config[CONF_FOR]))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) hub = yield cg.get_variable(config[CONF_NEXTION_ID]) cg.add(hub.register_touch_component(var)) cg.add(var.set_component_id(config[CONF_COMPONENT_ID])) cg.add(var.set_page_id(config[CONF_PAGE_ID]))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield binary_sensor.register_binary_sensor(var, config) if CONF_LAMBDA in config: template_ = yield cg.process_lambda( config[CONF_LAMBDA], [], return_type=cg.optional.template(bool)) cg.add(var.set_template(template_))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield binary_sensor.register_binary_sensor(var, config) paren = yield cg.get_variable(config[CONF_TUYA_ID]) cg.add(var.set_tuya_parent(paren)) cg.add(var.set_sensor_id(config[CONF_SENSOR_DATAPOINT]))
def to_code(config): if CONF_KEY in config: var = cg.new_Pvariable(config[CONF_ID], config[CONF_KEY][0]) else: var = cg.new_Pvariable(config[CONF_ID], config[CONF_ROW], config[CONF_COL]) yield binary_sensor.register_binary_sensor(var, config) keypad = yield cg.get_variable(config[CONF_KEYPAD_ID]) cg.add(keypad.register_listener(var))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield binary_sensor.register_binary_sensor(var, config) hub = yield cg.get_variable(config[CONF_MPR121_ID]) cg.add(var.set_channel(config[CONF_CHANNEL])) if CONF_TOUCH_THRESHOLD in config: cg.add(var.set_touch_threshold(config[CONF_TOUCH_THRESHOLD])) if CONF_RELEASE_THRESHOLD in config: cg.add(var.set_release_threshold(config[CONF_RELEASE_THRESHOLD])) cg.add(hub.register_channel(var))
def to_code(config): template_ = yield cg.process_lambda( config[CONF_LAMBDA], [], return_type=cg.std_vector.template(binary_sensor.BinarySensorPtr), ) rhs = CustomBinarySensorConstructor(template_) custom = cg.variable(config[CONF_ID], rhs) for i, conf in enumerate(config[CONF_BINARY_SENSORS]): rhs = custom.Pget_binary_sensor(i) yield binary_sensor.register_binary_sensor(rhs, conf)
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield esp32_ble_tracker.register_ble_device(var, config) yield binary_sensor.register_binary_sensor(var, config) cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex)) if CONF_TABLET in config: sens = yield sensor.new_sensor(config[CONF_TABLET]) cg.add(var.set_tablet(sens)) if CONF_BATTERY_LEVEL in config: sens = yield sensor.new_sensor(config[CONF_BATTERY_LEVEL]) cg.add(var.set_battery_level(sens))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield esp32_ble_tracker.register_ble_device(var, config) yield binary_sensor.register_binary_sensor(var, config) if CONF_MAC_ADDRESS in config: cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex)) if CONF_SERVICE_UUID in config: if len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid16_format): cg.add(var.set_service_uuid16(esp32_ble_tracker.as_hex(config[CONF_SERVICE_UUID]))) elif len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid32_format): cg.add(var.set_service_uuid32(esp32_ble_tracker.as_hex(config[CONF_SERVICE_UUID]))) elif len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid128_format): uuid128 = esp32_ble_tracker.as_hex_array(config[CONF_SERVICE_UUID]) cg.add(var.set_service_uuid128(uuid128))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield esp32_ble_tracker.register_ble_device(var, config) yield binary_sensor.register_binary_sensor(var, config) cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex)) cg.add(var.set_bindkey(config[CONF_BINDKEY])) if CONF_IDLE_TIME in config: sens = yield sensor.new_sensor(config[CONF_IDLE_TIME]) cg.add(var.set_idle_time(sens)) if CONF_BATTERY_LEVEL in config: sens = yield sensor.new_sensor(config[CONF_BATTERY_LEVEL]) cg.add(var.set_battery_level(sens)) if CONF_LIGHT in config: sens = yield binary_sensor.new_binary_sensor(config[CONF_LIGHT]) cg.add(var.set_light(sens))
def to_code(config): for hub in get_variable(config[CONF_RDM6300_ID]): yield rhs = hub.make_card(config[CONF_NAME], config[CONF_UID]) binary_sensor.register_binary_sensor(rhs, config)
def to_code(config): var = yield remote_base.build_binary_sensor(config) cg.add(var.set_name(config[CONF_NAME])) yield binary_sensor.register_binary_sensor(var, config)
def to_code(config): for hub in get_variable(config[CONF_APDS9960_ID]): yield func = getattr(hub, DIRECTIONS[config[CONF_DIRECTION]]) rhs = func(config[CONF_NAME]) binary_sensor.register_binary_sensor(rhs, config)
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield binary_sensor.register_binary_sensor(var, config) cg.add(var.set_entity_id(config[CONF_ENTITY_ID]))
def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) yield cg.register_component(var, config) yield binary_sensor.register_binary_sensor(var, config)
def to_code(config): for hub in get_variable(config[CONF_NEXTION_ID]): yield rhs = hub.make_touch_component(config[CONF_NAME], config[CONF_PAGE_ID], config[CONF_COMPONENT_ID]) binary_sensor.register_binary_sensor(rhs, config)
def to_code(config): for hub in get_variable(config[CONF_PN532_ID]): yield addr = [HexInt(int(x, 16)) for x in config[CONF_UID].split('-')] rhs = hub.make_tag(config[CONF_NAME], addr) binary_sensor.register_binary_sensor(rhs, config)