1
0
mirror of https://github.com/esphome/esphome.git synced 2024-10-07 03:11:00 +01:00
esphome/esphomeyaml/components/rdm6300.py

29 lines
835 B
Python
Raw Normal View History

2018-08-13 18:11:33 +01:00
import voluptuous as vol
import esphomeyaml.config_validation as cv
from esphomeyaml.components import binary_sensor
from esphomeyaml.components.uart import UARTComponent
from esphomeyaml.const import CONF_ID, CONF_UART_ID
from esphomeyaml.helpers import App, Pvariable, get_variable
DEPENDENCIES = ['uart']
RDM6300Component = binary_sensor.binary_sensor_ns.RDM6300Component
2018-08-22 21:04:56 +01:00
CONFIG_SCHEMA = vol.All(cv.ensure_list_not_empty, [vol.Schema({
2018-08-13 18:11:33 +01:00
cv.GenerateID(): cv.declare_variable_id(RDM6300Component),
cv.GenerateID(CONF_UART_ID): cv.use_variable_id(UARTComponent),
})])
def to_code(config):
for conf in config:
uart = None
for uart in get_variable(conf[CONF_UART_ID]):
yield
rhs = App.make_rdm6300_component(uart)
Pvariable(conf[CONF_ID], rhs)
BUILD_FLAGS = '-DUSE_RDM6300'