mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
3540b3fbb0
* Web Server * Preparations for 1.3 * Fixes * Fix Lint
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
import voluptuous as vol
|
|
|
|
import esphomeyaml.config_validation as cv
|
|
from esphomeyaml.const import CONF_OSCILLATION_COMMAND_TOPIC, CONF_OSCILLATION_STATE_TOPIC, \
|
|
CONF_SPEED_COMMAND_TOPIC, CONF_SPEED_STATE_TOPIC
|
|
from esphomeyaml.helpers import add, setup_mqtt_component
|
|
|
|
PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({
|
|
vol.Optional(CONF_OSCILLATION_STATE_TOPIC): cv.publish_topic,
|
|
vol.Optional(CONF_OSCILLATION_COMMAND_TOPIC): cv.subscribe_topic,
|
|
}).extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA.schema)
|
|
|
|
|
|
def setup_mqtt_fan(obj, config):
|
|
if CONF_OSCILLATION_STATE_TOPIC in config:
|
|
add(obj.set_custom_oscillation_state_topic(config[CONF_OSCILLATION_STATE_TOPIC]))
|
|
if CONF_OSCILLATION_COMMAND_TOPIC in config:
|
|
add(obj.set_custom_oscillation_command_topic(config[CONF_OSCILLATION_COMMAND_TOPIC]))
|
|
if CONF_SPEED_STATE_TOPIC in config:
|
|
add(obj.set_custom_speed_state_topic(config[CONF_SPEED_STATE_TOPIC]))
|
|
if CONF_SPEED_COMMAND_TOPIC in config:
|
|
add(obj.set_custom_speed_command_topic(config[CONF_SPEED_COMMAND_TOPIC]))
|
|
setup_mqtt_component(obj, config)
|
|
|
|
|
|
def build_flags(config):
|
|
return '-DUSE_FAN'
|