示例#1
0
def to_code(config):
    hub = None
    for hub in get_variable(config[CONF_ESP32_BLE_ID]):
        yield
    rhs = hub.make_presence_sensor(
        config[CONF_NAME], make_address_array(config[CONF_MAC_ADDRESS]))
    binary_sensor.register_binary_sensor(rhs, config)
示例#2
0
def to_code(config):
    hub = None
    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)
示例#3
0
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)
示例#4
0
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)
示例#5
0
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],
                       ArrayInitializer(*addr, multiline=False))
    binary_sensor.register_binary_sensor(rhs, config)
def to_code(config):
    hub = None
    for hub in get_variable(config[CONF_ESP32_BLE_ID]):
        yield
    addr = [HexInt(i) for i in config[CONF_MAC_ADDRESS].parts]
    rhs = hub.make_device(config[CONF_NAME],
                          ArrayInitializer(*addr, multiline=False))
    binary_sensor.register_binary_sensor(rhs, config)
示例#7
0
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, sens in enumerate(config[CONF_BINARY_SENSORS]):
        binary_sensor.register_binary_sensor(custom.get_binary_sensor(i), sens)
示例#8
0
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)
示例#9
0
def to_code(config):
    hub = get_variable(None, type=ESP32TouchComponent)
    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)
示例#10
0
def to_code(config):
    hub = get_variable(None, type=ESP32BLETracker)
    addr = [HexInt(i) for i in config[CONF_MAC_ADDRESS].parts]
    rhs = hub.make_device(config[CONF_NAME],
                          ArrayInitializer(*addr, multiline=False))
    binary_sensor.register_binary_sensor(rhs, config)
示例#11
0
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)