Better typing to components (#225)

* Add better typing

* Fix
This commit is contained in:
Otto Winter 2018-11-08 16:01:07 +01:00 committed by GitHub
parent 94978d0063
commit 3594779401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 79 additions and 7 deletions

View file

@ -1,15 +1,17 @@
import voluptuous as vol import voluptuous as vol
import esphomeyaml.config_validation as cv
from esphomeyaml.components import binary_sensor from esphomeyaml.components import binary_sensor
from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \
make_address_array make_address_array
import esphomeyaml.config_validation as cv
from esphomeyaml.const import CONF_MAC_ADDRESS, CONF_NAME from esphomeyaml.const import CONF_MAC_ADDRESS, CONF_NAME
from esphomeyaml.helpers import get_variable from esphomeyaml.helpers import esphomelib_ns, get_variable
DEPENDENCIES = ['esp32_ble_tracker'] DEPENDENCIES = ['esp32_ble_tracker']
ESP32BLEPresenceDevice = esphomelib_ns.ESP32BLEPresenceDevice
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ESP32BLEPresenceDevice),
vol.Required(CONF_MAC_ADDRESS): cv.mac_address, vol.Required(CONF_MAC_ADDRESS): cv.mac_address,
cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_variable_id(ESP32BLETracker) cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_variable_id(ESP32BLETracker)
})) }))

View file

@ -34,7 +34,10 @@ def validate_touch_pad(value):
return value return value
ESP32TouchBinarySensor = binary_sensor.binary_sensor_ns.ESP32TouchBinarySensor
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ESP32TouchBinarySensor),
vol.Required(CONF_PIN): validate_touch_pad, vol.Required(CONF_PIN): validate_touch_pad,
vol.Required(CONF_THRESHOLD): cv.uint16_t, vol.Required(CONF_THRESHOLD): cv.uint16_t,
cv.GenerateID(CONF_ESP32_TOUCH_ID): cv.use_variable_id(ESP32TouchComponent), cv.GenerateID(CONF_ESP32_TOUCH_ID): cv.use_variable_id(ESP32TouchComponent),

View file

@ -7,8 +7,10 @@ from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_PIN
from esphomeyaml.helpers import App, gpio_input_pin_expression, variable, Application from esphomeyaml.helpers import App, gpio_input_pin_expression, variable, Application
MakeGPIOBinarySensor = Application.MakeGPIOBinarySensor MakeGPIOBinarySensor = Application.MakeGPIOBinarySensor
GPIOBinarySensorComponent = binary_sensor.binary_sensor_ns.GPIOBinarySensorComponent
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(GPIOBinarySensorComponent),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeGPIOBinarySensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeGPIOBinarySensor),
vol.Required(CONF_PIN): pins.gpio_input_pin_schema vol.Required(CONF_PIN): pins.gpio_input_pin_schema
})) }))

View file

@ -1,8 +1,8 @@
import voluptuous as vol import voluptuous as vol
import esphomeyaml.config_validation as cv from esphomeyaml.components import binary_sensor, display
from esphomeyaml.components import binary_sensor
from esphomeyaml.components.display.nextion import Nextion from esphomeyaml.components.display.nextion import Nextion
import esphomeyaml.config_validation as cv
from esphomeyaml.const import CONF_COMPONENT_ID, CONF_NAME, CONF_PAGE_ID from esphomeyaml.const import CONF_COMPONENT_ID, CONF_NAME, CONF_PAGE_ID
from esphomeyaml.helpers import get_variable from esphomeyaml.helpers import get_variable
@ -10,7 +10,10 @@ DEPENDENCIES = ['display']
CONF_NEXTION_ID = 'nextion_id' CONF_NEXTION_ID = 'nextion_id'
NextionTouchComponent = display.display_ns.NextionTouchComponent
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(NextionTouchComponent),
vol.Required(CONF_PAGE_ID): cv.uint8_t, vol.Required(CONF_PAGE_ID): cv.uint8_t,
vol.Required(CONF_COMPONENT_ID): cv.uint8_t, vol.Required(CONF_COMPONENT_ID): cv.uint8_t,
cv.GenerateID(CONF_NEXTION_ID): cv.use_variable_id(Nextion) cv.GenerateID(CONF_NEXTION_ID): cv.use_variable_id(Nextion)

View file

@ -27,7 +27,10 @@ def validate_uid(value):
return value return value
PN532BinarySensor = binary_sensor.binary_sensor_ns.PN532BinarySensor
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(PN532BinarySensor),
vol.Required(CONF_UID): validate_uid, vol.Required(CONF_UID): validate_uid,
cv.GenerateID(CONF_PN532_ID): cv.use_variable_id(PN532Component) cv.GenerateID(CONF_PN532_ID): cv.use_variable_id(PN532Component)
})) }))

View file

@ -9,7 +9,10 @@ DEPENDENCIES = ['rdm6300']
CONF_RDM6300_ID = 'rdm6300_id' CONF_RDM6300_ID = 'rdm6300_id'
RDM6300BinarySensor = binary_sensor.binary_sensor_ns.RDM6300BinarySensor
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(RDM6300BinarySensor),
vol.Required(CONF_UID): cv.uint32_t, vol.Required(CONF_UID): cv.uint32_t,
cv.GenerateID(CONF_RDM6300_ID): cv.use_variable_id(rdm6300.RDM6300Component) cv.GenerateID(CONF_RDM6300_ID): cv.use_variable_id(rdm6300.RDM6300Component)
})) }))

View file

@ -36,6 +36,7 @@ RCSwitchTypeCReceiver = remote_ns.RCSwitchTypeCReceiver
RCSwitchTypeDReceiver = remote_ns.RCSwitchTypeDReceiver RCSwitchTypeDReceiver = remote_ns.RCSwitchTypeDReceiver
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(RemoteReceiver),
vol.Optional(CONF_LG): vol.Schema({ vol.Optional(CONF_LG): vol.Schema({
vol.Required(CONF_DATA): cv.hex_uint32_t, vol.Required(CONF_DATA): cv.hex_uint32_t,
vol.Optional(CONF_NBITS, default=28): vol.All(vol.Coerce(int), cv.one_of(28, 32)), vol.Optional(CONF_NBITS, default=28): vol.All(vol.Coerce(int), cv.one_of(28, 32)),

View file

@ -6,9 +6,11 @@ from esphomeyaml.helpers import App, Application, variable
DEPENDENCIES = ['mqtt'] DEPENDENCIES = ['mqtt']
MakeStatusBinarySensor = Application.MakeStatusBinarySensor MakeStatusBinarySensor = Application.MakeStatusBinarySensor
StatusBinarySensor = binary_sensor.binary_sensor_ns.StatusBinarySensor
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeStatusBinarySensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeStatusBinarySensor),
cv.GenerateID(): cv.declare_variable_id(StatusBinarySensor),
})) }))

View file

@ -1,13 +1,15 @@
import voluptuous as vol import voluptuous as vol
import esphomeyaml.config_validation as cv
from esphomeyaml.components import binary_sensor from esphomeyaml.components import binary_sensor
import esphomeyaml.config_validation as cv
from esphomeyaml.const import CONF_LAMBDA, CONF_MAKE_ID, CONF_NAME from esphomeyaml.const import CONF_LAMBDA, CONF_MAKE_ID, CONF_NAME
from esphomeyaml.helpers import App, Application, process_lambda, variable, optional, bool_, add from esphomeyaml.helpers import App, Application, add, bool_, optional, process_lambda, variable
MakeTemplateBinarySensor = Application.MakeTemplateBinarySensor MakeTemplateBinarySensor = Application.MakeTemplateBinarySensor
TemplateBinarySensor = binary_sensor.binary_sensor_ns.TemplateBinarySensor
PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(TemplateBinarySensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTemplateBinarySensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTemplateBinarySensor),
vol.Required(CONF_LAMBDA): cv.lambda_, vol.Required(CONF_LAMBDA): cv.lambda_,
})) }))

View file

@ -23,8 +23,10 @@ def validate_adc_pin(value):
MakeADCSensor = Application.MakeADCSensor MakeADCSensor = Application.MakeADCSensor
ADCSensorComponent = sensor.sensor_ns.ADCSensorComponent
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ADCSensorComponent),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeADCSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeADCSensor),
vol.Required(CONF_PIN): validate_adc_pin, vol.Required(CONF_PIN): validate_adc_pin,
vol.Optional(CONF_ATTENUATION): vol.All(cv.only_on_esp32, cv.one_of(*ATTENUATION_MODES)), vol.Optional(CONF_ATTENUATION): vol.All(cv.only_on_esp32, cv.one_of(*ATTENUATION_MODES)),

View file

@ -45,7 +45,10 @@ def validate_mux(value):
return cv.one_of(*MUX)(value) return cv.one_of(*MUX)(value)
ADS1115Sensor = sensor.sensor_ns.ADS1115Sensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ADS1115Sensor),
vol.Required(CONF_MULTIPLEXER): validate_mux, vol.Required(CONF_MULTIPLEXER): validate_mux,
vol.Required(CONF_GAIN): validate_gain, vol.Required(CONF_GAIN): validate_gain,
cv.GenerateID(CONF_ADS1115_ID): cv.use_variable_id(ADS1115Component), cv.GenerateID(CONF_ADS1115_ID): cv.use_variable_id(ADS1115Component),

View file

@ -15,8 +15,10 @@ BH1750_RESOLUTIONS = {
} }
MakeBH1750Sensor = Application.MakeBH1750Sensor MakeBH1750Sensor = Application.MakeBH1750Sensor
BH1750Sensor = sensor.sensor_ns.BH1750Sensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(BH1750Sensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeBH1750Sensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeBH1750Sensor),
vol.Optional(CONF_ADDRESS, default=0x23): cv.i2c_address, vol.Optional(CONF_ADDRESS, default=0x23): cv.i2c_address,
vol.Optional(CONF_RESOLUTION): vol.All(cv.positive_float, cv.one_of(*BH1750_RESOLUTIONS)), vol.Optional(CONF_RESOLUTION): vol.All(cv.positive_float, cv.one_of(*BH1750_RESOLUTIONS)),

View file

@ -5,11 +5,14 @@ from esphomeyaml.components import sensor
from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \
make_address_array make_address_array
from esphomeyaml.const import CONF_MAC_ADDRESS, CONF_NAME from esphomeyaml.const import CONF_MAC_ADDRESS, CONF_NAME
from esphomeyaml.helpers import get_variable from esphomeyaml.helpers import get_variable, esphomelib_ns
DEPENDENCIES = ['esp32_ble_tracker'] DEPENDENCIES = ['esp32_ble_tracker']
ESP32BLERSSISensor = esphomelib_ns.ESP32BLERSSISensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ESP32BLERSSISensor),
vol.Required(CONF_MAC_ADDRESS): cv.mac_address, vol.Required(CONF_MAC_ADDRESS): cv.mac_address,
cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_variable_id(ESP32BLETracker) cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_variable_id(ESP32BLETracker)
})) }))

View file

@ -7,7 +7,10 @@ from esphomeyaml.const import CONF_ADDRESS, CONF_DALLAS_ID, CONF_INDEX, CONF_NAM
CONF_RESOLUTION CONF_RESOLUTION
from esphomeyaml.helpers import HexIntLiteral, get_variable from esphomeyaml.helpers import HexIntLiteral, get_variable
DallasTemperatureSensor = sensor.sensor_ns.DallasTemperatureSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(DallasTemperatureSensor),
vol.Exclusive(CONF_ADDRESS, 'dallas'): cv.hex_int, vol.Exclusive(CONF_ADDRESS, 'dallas'): cv.hex_int,
vol.Exclusive(CONF_INDEX, 'dallas'): cv.positive_int, vol.Exclusive(CONF_INDEX, 'dallas'): cv.positive_int,
cv.GenerateID(CONF_DALLAS_ID): cv.use_variable_id(DallasComponent), cv.GenerateID(CONF_DALLAS_ID): cv.use_variable_id(DallasComponent),

View file

@ -7,8 +7,10 @@ from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_PIN, CONF_UPDATE_INT
from esphomeyaml.helpers import App, Application, gpio_input_pin_expression, variable from esphomeyaml.helpers import App, Application, gpio_input_pin_expression, variable
MakeDutyCycleSensor = Application.MakeDutyCycleSensor MakeDutyCycleSensor = Application.MakeDutyCycleSensor
DutyCycleSensor = sensor.sensor_ns.DutyCycleSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(DutyCycleSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeDutyCycleSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeDutyCycleSensor),
vol.Required(CONF_PIN): pins.internal_gpio_input_pin_schema, vol.Required(CONF_PIN): pins.internal_gpio_input_pin_schema,
vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval,

View file

@ -8,8 +8,10 @@ from esphomeyaml.helpers import App, Application, variable
ESP_PLATFORMS = [ESP_PLATFORM_ESP32] ESP_PLATFORMS = [ESP_PLATFORM_ESP32]
MakeESP32HallSensor = Application.MakeESP32HallSensor MakeESP32HallSensor = Application.MakeESP32HallSensor
ESP32HallSensor = sensor.sensor_ns.ESP32HallSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ESP32HallSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeESP32HallSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeESP32HallSensor),
vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval,
})) }))

View file

@ -9,8 +9,10 @@ from esphomeyaml.const import CONF_CS_PIN, CONF_MAKE_ID, CONF_NAME, CONF_SPI_ID,
from esphomeyaml.helpers import App, Application, get_variable, gpio_output_pin_expression, variable from esphomeyaml.helpers import App, Application, get_variable, gpio_output_pin_expression, variable
MakeMAX6675Sensor = Application.MakeMAX6675Sensor MakeMAX6675Sensor = Application.MakeMAX6675Sensor
MAX6675Sensor = sensor.sensor_ns.MAX6675Sensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(MAX6675Sensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeMAX6675Sensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeMAX6675Sensor),
cv.GenerateID(CONF_SPI_ID): cv.use_variable_id(SPIComponent), cv.GenerateID(CONF_SPI_ID): cv.use_variable_id(SPIComponent),
vol.Required(CONF_CS_PIN): pins.gpio_output_pin_schema, vol.Required(CONF_CS_PIN): pins.gpio_output_pin_schema,

View file

@ -8,8 +8,10 @@ from esphomeyaml.helpers import App, Application, add, variable
DEPENDENCIES = ['mqtt'] DEPENDENCIES = ['mqtt']
MakeMQTTSubscribeSensor = Application.MakeMQTTSubscribeSensor MakeMQTTSubscribeSensor = Application.MakeMQTTSubscribeSensor
MQTTSubscribeSensor = sensor.sensor_ns.MQTTSubscribeSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(MQTTSubscribeSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeMQTTSubscribeSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeMQTTSubscribeSensor),
vol.Required(CONF_TOPIC): cv.subscribe_topic, vol.Required(CONF_TOPIC): cv.subscribe_topic,
vol.Optional(CONF_QOS): cv.mqtt_qos, vol.Optional(CONF_QOS): cv.mqtt_qos,

View file

@ -17,6 +17,7 @@ COUNT_MODES = {
COUNT_MODE_SCHEMA = vol.All(vol.Upper, cv.one_of(*COUNT_MODES)) COUNT_MODE_SCHEMA = vol.All(vol.Upper, cv.one_of(*COUNT_MODES))
MakePulseCounterSensor = Application.MakePulseCounterSensor MakePulseCounterSensor = Application.MakePulseCounterSensor
PulseCounterSensorComponent = sensor.sensor_ns.PulseCounterSensorComponent
def validate_internal_filter(value): def validate_internal_filter(value):
@ -33,6 +34,7 @@ def validate_internal_filter(value):
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(PulseCounterSensorComponent),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakePulseCounterSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakePulseCounterSensor),
vol.Required(CONF_PIN): pins.internal_gpio_input_pin_schema, vol.Required(CONF_PIN): pins.internal_gpio_input_pin_schema,
vol.Optional(CONF_COUNT_MODE): vol.Schema({ vol.Optional(CONF_COUNT_MODE): vol.Schema({

View file

@ -17,8 +17,10 @@ CONF_PIN_B = 'pin_b'
CONF_PIN_RESET = 'pin_reset' CONF_PIN_RESET = 'pin_reset'
MakeRotaryEncoderSensor = Application.MakeRotaryEncoderSensor MakeRotaryEncoderSensor = Application.MakeRotaryEncoderSensor
RotaryEncoderSensor = sensor.sensor_ns.RotaryEncoderSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(RotaryEncoderSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeRotaryEncoderSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeRotaryEncoderSensor),
vol.Required(CONF_PIN_A): pins.internal_gpio_input_pin_schema, vol.Required(CONF_PIN_A): pins.internal_gpio_input_pin_schema,
vol.Required(CONF_PIN_B): pins.internal_gpio_input_pin_schema, vol.Required(CONF_PIN_B): pins.internal_gpio_input_pin_schema,

View file

@ -6,8 +6,10 @@ from esphomeyaml.const import CONF_LAMBDA, CONF_MAKE_ID, CONF_NAME, CONF_UPDATE_
from esphomeyaml.helpers import App, process_lambda, variable, Application, float_, optional, add from esphomeyaml.helpers import App, process_lambda, variable, Application, float_, optional, add
MakeTemplateSensor = Application.MakeTemplateSensor MakeTemplateSensor = Application.MakeTemplateSensor
TemplateSensor = sensor.sensor_ns.TemplateSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(TemplateSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTemplateSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTemplateSensor),
vol.Required(CONF_LAMBDA): cv.lambda_, vol.Required(CONF_LAMBDA): cv.lambda_,
vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval,

View file

@ -29,8 +29,10 @@ def validate_integration_time(value):
MakeTSL2561Sensor = Application.MakeTSL2561Sensor MakeTSL2561Sensor = Application.MakeTSL2561Sensor
TSL2561Sensor = Application.TSL2561Sensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(TSL2561Sensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTSL2561Sensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTSL2561Sensor),
vol.Optional(CONF_ADDRESS, default=0x39): cv.i2c_address, vol.Optional(CONF_ADDRESS, default=0x39): cv.i2c_address,
vol.Optional(CONF_INTEGRATION_TIME): validate_integration_time, vol.Optional(CONF_INTEGRATION_TIME): validate_integration_time,

View file

@ -9,8 +9,10 @@ from esphomeyaml.helpers import App, Application, add, gpio_input_pin_expression
gpio_output_pin_expression, variable gpio_output_pin_expression, variable
MakeUltrasonicSensor = Application.MakeUltrasonicSensor MakeUltrasonicSensor = Application.MakeUltrasonicSensor
UltrasonicSensorComponent = sensor.sensor_ns.UltrasonicSensorComponent
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(UltrasonicSensorComponent),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeUltrasonicSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeUltrasonicSensor),
vol.Required(CONF_TRIGGER_PIN): pins.gpio_output_pin_schema, vol.Required(CONF_TRIGGER_PIN): pins.gpio_output_pin_schema,
vol.Required(CONF_ECHO_PIN): pins.internal_gpio_input_pin_schema, vol.Required(CONF_ECHO_PIN): pins.internal_gpio_input_pin_schema,

View file

@ -6,8 +6,10 @@ from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_UPDATE_INTERVAL
from esphomeyaml.helpers import App, Application, variable from esphomeyaml.helpers import App, Application, variable
MakeUptimeSensor = Application.MakeUptimeSensor MakeUptimeSensor = Application.MakeUptimeSensor
UptimeSensor = sensor.sensor_ns.UptimeSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(UptimeSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeUptimeSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeUptimeSensor),
vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval,
})) }))

View file

@ -6,8 +6,10 @@ from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_UPDATE_INTERVAL
from esphomeyaml.helpers import App, Application, variable from esphomeyaml.helpers import App, Application, variable
MakeWiFiSignalSensor = Application.MakeWiFiSignalSensor MakeWiFiSignalSensor = Application.MakeWiFiSignalSensor
WiFiSignalSensor = sensor.sensor_ns.WiFiSignalSensor
PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(WiFiSignalSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeWiFiSignalSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeWiFiSignalSensor),
vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval,
})) }))

View file

@ -6,8 +6,10 @@ from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT
from esphomeyaml.helpers import App, Application, get_variable, variable from esphomeyaml.helpers import App, Application, get_variable, variable
MakeOutputSwitch = Application.MakeOutputSwitch MakeOutputSwitch = Application.MakeOutputSwitch
OutputSwitch = switch.switch_ns.OutputSwitch
PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(OutputSwitch),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeOutputSwitch), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeOutputSwitch),
vol.Required(CONF_OUTPUT): cv.use_variable_id(None), vol.Required(CONF_OUTPUT): cv.use_variable_id(None),
})) }))

View file

@ -39,6 +39,7 @@ RCSwitchTypeDTransmitter = remote_ns.RCSwitchTypeDTransmitter
validate_raw_data = [vol.Any(vol.Coerce(int), cv.time_period_microseconds)] validate_raw_data = [vol.Any(vol.Coerce(int), cv.time_period_microseconds)]
PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(RemoteTransmitter),
vol.Optional(CONF_LG): vol.Schema({ vol.Optional(CONF_LG): vol.Schema({
vol.Required(CONF_DATA): cv.hex_uint32_t, vol.Required(CONF_DATA): cv.hex_uint32_t,
vol.Optional(CONF_NBITS, default=28): vol.All(vol.Coerce(int), cv.one_of(28, 32)), vol.Optional(CONF_NBITS, default=28): vol.All(vol.Coerce(int), cv.one_of(28, 32)),

View file

@ -6,8 +6,10 @@ from esphomeyaml.const import CONF_INVERTED, CONF_MAKE_ID, CONF_NAME
from esphomeyaml.helpers import App, Application, variable from esphomeyaml.helpers import App, Application, variable
MakeRestartSwitch = Application.MakeRestartSwitch MakeRestartSwitch = Application.MakeRestartSwitch
RestartSwitch = switch.switch_ns.RestartSwitch
PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(RestartSwitch),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeRestartSwitch), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeRestartSwitch),
vol.Optional(CONF_INVERTED): cv.invalid("Restart switches do not support inverted mode!"), vol.Optional(CONF_INVERTED): cv.invalid("Restart switches do not support inverted mode!"),
})) }))

View file

@ -6,8 +6,10 @@ from esphomeyaml.const import CONF_INVERTED, CONF_MAKE_ID, CONF_NAME
from esphomeyaml.helpers import App, Application, variable from esphomeyaml.helpers import App, Application, variable
MakeShutdownSwitch = Application.MakeShutdownSwitch MakeShutdownSwitch = Application.MakeShutdownSwitch
ShutdownSwitch = switch.switch_ns.ShutdownSwitch
PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(ShutdownSwitch),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeShutdownSwitch), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeShutdownSwitch),
vol.Optional(CONF_INVERTED): cv.invalid("Shutdown switches do not support inverted mode!"), vol.Optional(CONF_INVERTED): cv.invalid("Shutdown switches do not support inverted mode!"),
})) }))

View file

@ -10,6 +10,7 @@ from esphomeyaml.helpers import App, Application, ArrayInitializer, get_variable
DEPENDENCIES = ['uart'] DEPENDENCIES = ['uart']
MakeUARTSwitch = Application.MakeUARTSwitch MakeUARTSwitch = Application.MakeUARTSwitch
UARTSwitch = switch.switch_ns.UARTSwitch
def validate_data(value): def validate_data(value):
@ -23,6 +24,7 @@ def validate_data(value):
PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(UARTSwitch),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeUARTSwitch), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeUARTSwitch),
cv.GenerateID(CONF_UART_ID): cv.use_variable_id(UARTComponent), cv.GenerateID(CONF_UART_ID): cv.use_variable_id(UARTComponent),
vol.Required(CONF_DATA): validate_data, vol.Required(CONF_DATA): validate_data,

View file

@ -8,8 +8,10 @@ from esphomeyaml.helpers import App, Application, add, variable
DEPENDENCIES = ['mqtt'] DEPENDENCIES = ['mqtt']
MakeMQTTSubscribeTextSensor = Application.MakeMQTTSubscribeTextSensor MakeMQTTSubscribeTextSensor = Application.MakeMQTTSubscribeTextSensor
MQTTSubscribeTextSensor = text_sensor.text_sensor_ns.MQTTSubscribeTextSensor
PLATFORM_SCHEMA = cv.nameable(text_sensor.TEXT_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(text_sensor.TEXT_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(MQTTSubscribeTextSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeMQTTSubscribeTextSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeMQTTSubscribeTextSensor),
vol.Required(CONF_TOPIC): cv.subscribe_topic, vol.Required(CONF_TOPIC): cv.subscribe_topic,
vol.Optional(CONF_QOS): cv.mqtt_qos, vol.Optional(CONF_QOS): cv.mqtt_qos,

View file

@ -7,8 +7,10 @@ from esphomeyaml.helpers import App, Application, add, optional, process_lambda,
variable variable
MakeTemplateTextSensor = Application.MakeTemplateTextSensor MakeTemplateTextSensor = Application.MakeTemplateTextSensor
TemplateTextSensor = text_sensor.text_sensor_ns.TemplateTextSensor
PLATFORM_SCHEMA = cv.nameable(text_sensor.TEXT_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(text_sensor.TEXT_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(TemplateTextSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTemplateTextSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeTemplateTextSensor),
vol.Required(CONF_LAMBDA): cv.lambda_, vol.Required(CONF_LAMBDA): cv.lambda_,
vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval,

View file

@ -4,8 +4,10 @@ from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME
from esphomeyaml.helpers import App, Application, variable from esphomeyaml.helpers import App, Application, variable
MakeVersionTextSensor = Application.MakeVersionTextSensor MakeVersionTextSensor = Application.MakeVersionTextSensor
VersionTextSensor = text_sensor.text_sensor_ns.VersionTextSensor
PLATFORM_SCHEMA = cv.nameable(text_sensor.TEXT_SENSOR_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = cv.nameable(text_sensor.TEXT_SENSOR_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(VersionTextSensor),
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeVersionTextSensor), cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeVersionTextSensor),
})) }))

View file

@ -103,6 +103,7 @@ def get_ini_content(config, path):
build_flags |= get_build_flags(config, 'BUILD_FLAGS') build_flags |= get_build_flags(config, 'BUILD_FLAGS')
build_flags.add(u"-DESPHOMEYAML_USE") build_flags.add(u"-DESPHOMEYAML_USE")
build_flags.add("-Wno-unused-variable") build_flags.add("-Wno-unused-variable")
build_flags.add("-Wno-unused-but-set-variable")
build_flags |= get_build_flags(config, 'required_build_flags') build_flags |= get_build_flags(config, 'required_build_flags')
build_flags |= get_build_flags(config, 'REQUIRED_BUILD_FLAGS') build_flags |= get_build_flags(config, 'REQUIRED_BUILD_FLAGS')