mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
176c712eeb
* Disable MQTT if not used * Lint
28 lines
1 KiB
Python
28 lines
1 KiB
Python
from esphomeyaml.components import binary_sensor
|
|
import esphomeyaml.config_validation as cv
|
|
from esphomeyaml.const import CONF_ID, CONF_NAME
|
|
from esphomeyaml.cpp_generator import Pvariable
|
|
from esphomeyaml.cpp_helpers import setup_component
|
|
from esphomeyaml.cpp_types import App, Component
|
|
|
|
StatusBinarySensor = binary_sensor.binary_sensor_ns.class_('StatusBinarySensor',
|
|
binary_sensor.BinarySensor,
|
|
Component)
|
|
|
|
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
|
|
cv.GenerateID(): cv.declare_variable_id(StatusBinarySensor),
|
|
}).extend(cv.COMPONENT_SCHEMA.schema))
|
|
|
|
|
|
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)
|
|
|
|
|
|
BUILD_FLAGS = '-DUSE_STATUS_BINARY_SENSOR'
|
|
|
|
|
|
def to_hass_config(data, config):
|
|
return binary_sensor.core_to_hass_config(data, config)
|