mirror of
https://github.com/esphome/esphome.git
synced 2025-09-21 12:42:21 +01:00
@@ -1,7 +1,9 @@
|
||||
import esphomeyaml.config_validation as cv
|
||||
from esphomeyaml.components import binary_sensor
|
||||
from esphomeyaml.const import CONF_ID, CONF_NAME
|
||||
from esphomeyaml.helpers import App, Pvariable
|
||||
from esphomeyaml.helpers import App, variable
|
||||
|
||||
DEPENDENCIES = ['mqtt']
|
||||
|
||||
PLATFORM_SCHEMA = binary_sensor.PLATFORM_SCHEMA.extend({
|
||||
cv.GenerateID('status_binary_sensor'): cv.register_variable_id,
|
||||
@@ -10,5 +12,10 @@ PLATFORM_SCHEMA = binary_sensor.PLATFORM_SCHEMA.extend({
|
||||
|
||||
def to_code(config):
|
||||
rhs = App.make_status_binary_sensor(config[CONF_NAME])
|
||||
gpio = Pvariable('binary_sensor::MQTTBinarySensorComponent', config[CONF_ID], rhs)
|
||||
binary_sensor.setup_mqtt_binary_sensor(gpio.Pmqtt, config)
|
||||
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)
|
||||
|
||||
|
||||
def build_flags(config):
|
||||
return '-DUSE_STATUS_BINARY_SENSOR'
|
||||
|
Reference in New Issue
Block a user