コード例 #1
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)
コード例 #2
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)
コード例 #3
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, 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)
コード例 #4
0
ファイル: esp32_ble_tracker.py プロジェクト: khzd/pi4home
def to_code(config):
    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)
コード例 #5
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)
コード例 #6
0
ファイル: pn532.py プロジェクト: khzd/pi4home
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)
コード例 #7
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)
コード例 #8
0
def to_code(config):
    for hub in get_variable(config[CONF_MPR121_ID]):
        yield
    rhs = MPR121Channel.new(config[CONF_NAME], config[CONF_CHANNEL])
    binary_sensor.register_binary_sensor(hub.add_channel(rhs), config)