Ejemplo n.º 1
0
def to_code(config):
    pin = None
    for pin in gpio_input_pin_expression(config[CONF_PIN]):
        yield
    rhs = App.make_gpio_binary_sensor(config[CONF_NAME], pin)
    gpio = variable(config[CONF_MAKE_ID], rhs)
    binary_sensor.setup_binary_sensor(gpio.Pgpio, gpio.Pmqtt, config)
Ejemplo n.º 2
0
def to_code(config):
    template_ = None
    for template_ in process_lambda(config[CONF_LAMBDA], [],
                                    return_type=optional.template(bool_)):
        yield
    rhs = App.make_template_binary_sensor(config[CONF_NAME], template_)
    make = variable(config[CONF_MAKE_ID], rhs)
    binary_sensor.setup_binary_sensor(make.Ptemplate_, make.Pmqtt, config)
Ejemplo n.º 3
0
def to_code(config):
    rhs = App.make_gpio_binary_sensor(config[CONF_NAME],
                                      exp_gpio_input_pin(config[CONF_PIN]))
    gpio = variable('Application::MakeGPIOBinarySensor', config[CONF_ID], rhs)
    if CONF_INVERTED in config:
        add(gpio.Pgpio.set_inverted(config[CONF_INVERTED]))
    binary_sensor.setup_binary_sensor(gpio.Pgpio, config)
    binary_sensor.setup_mqtt_binary_sensor(gpio.Pmqtt, config)
Ejemplo n.º 4
0
def to_code(config):
    rhs = App.make_status_binary_sensor(config[CONF_NAME])
    status = variable(config[CONF_MAKE_ID], rhs)
    binary_sensor.setup_binary_sensor(status.Pstatus, status.Pmqtt, config)
Ejemplo n.º 5
0
def to_code(config):
    template_ = process_lambda(config[CONF_LAMBDA], [])
    rhs = App.make_template_binary_sensor(config[CONF_NAME], template_)
    make = variable(MakeTemplateBinarySensor, config[CONF_MAKE_ID], rhs)
    binary_sensor.setup_binary_sensor(make.Ptemplate_, make.Pmqtt, config)
Ejemplo n.º 6
0
def to_code(config):
    rhs = App.make_status_binary_sensor(config[CONF_NAME])
    status = variable('Application::MakeStatusBinarySensor', config[CONF_ID],
                      rhs)
    binary_sensor.setup_binary_sensor(status.Pstatus, config)
    binary_sensor.setup_mqtt_binary_sensor(status.Pmqtt, config)
Ejemplo n.º 7
0
def to_code(config):
    rhs = App.make_gpio_binary_sensor(
        config[CONF_NAME], gpio_input_pin_expression(config[CONF_PIN]))
    gpio = variable(MakeGPIOBinarySensor, config[CONF_MAKE_ID], rhs)
    binary_sensor.setup_binary_sensor(gpio.Pgpio, gpio.Pmqtt, config)