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 = Pvariable(config[CONF_ID], rhs) binary_sensor.setup_binary_sensor(gpio, config) setup_component(gpio, config)
def to_code(config): rhs = App.make_template_binary_sensor(config[CONF_NAME]) var = Pvariable(config[CONF_ID], rhs) binary_sensor.setup_binary_sensor(var, config) setup_component(var, config) if CONF_LAMBDA in config: for template_ in process_lambda(config[CONF_LAMBDA], [], return_type=optional.template(bool_)): yield add(var.set_template(template_))
def to_code(config): rhs = App.make_status_binary_sensor(config[CONF_NAME]) status = Pvariable(config[CONF_ID], rhs) binary_sensor.setup_binary_sensor(status, config) setup_component(status, config)
def to_code(config): rhs = App.make_homeassistant_binary_sensor(config[CONF_NAME], config[CONF_ENTITY_ID]) subs = Pvariable(config[CONF_ID], rhs) binary_sensor.setup_binary_sensor(subs, config)