mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
FastLED power supply
This commit is contained in:
parent
1a9ff55a61
commit
48e42cf478
2 changed files with 17 additions and 6 deletions
|
@ -4,9 +4,10 @@ import esphomeyaml.config_validation as cv
|
||||||
from esphomeyaml import pins
|
from esphomeyaml import pins
|
||||||
from esphomeyaml.components import light
|
from esphomeyaml.components import light
|
||||||
from esphomeyaml.const import CONF_CHIPSET, CONF_DEFAULT_TRANSITION_LENGTH, CONF_GAMMA_CORRECT, \
|
from esphomeyaml.const import CONF_CHIPSET, CONF_DEFAULT_TRANSITION_LENGTH, CONF_GAMMA_CORRECT, \
|
||||||
CONF_ID, CONF_MAX_REFRESH_RATE, CONF_NAME, CONF_NUM_LEDS, CONF_PIN, CONF_RGB_ORDER
|
CONF_ID, CONF_MAX_REFRESH_RATE, CONF_NAME, CONF_NUM_LEDS, CONF_PIN, CONF_POWER_SUPPLY, \
|
||||||
from esphomeyaml.helpers import App, RawExpression, TemplateArguments, add, setup_mqtt_component, \
|
CONF_RGB_ORDER
|
||||||
variable
|
from esphomeyaml.helpers import App, RawExpression, TemplateArguments, add, get_variable, \
|
||||||
|
setup_mqtt_component, variable
|
||||||
|
|
||||||
TYPES = [
|
TYPES = [
|
||||||
'NEOPIXEL',
|
'NEOPIXEL',
|
||||||
|
@ -63,6 +64,7 @@ PLATFORM_SCHEMA = vol.All(light.PLATFORM_SCHEMA.extend({
|
||||||
|
|
||||||
vol.Optional(CONF_GAMMA_CORRECT): cv.positive_float,
|
vol.Optional(CONF_GAMMA_CORRECT): cv.positive_float,
|
||||||
vol.Optional(CONF_DEFAULT_TRANSITION_LENGTH): cv.positive_time_period_milliseconds,
|
vol.Optional(CONF_DEFAULT_TRANSITION_LENGTH): cv.positive_time_period_milliseconds,
|
||||||
|
vol.Optional(CONF_POWER_SUPPLY): cv.variable_id,
|
||||||
}), validate)
|
}), validate)
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +83,10 @@ def to_code(config):
|
||||||
if CONF_MAX_REFRESH_RATE in config:
|
if CONF_MAX_REFRESH_RATE in config:
|
||||||
add(fast_led.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
|
add(fast_led.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
|
||||||
|
|
||||||
|
if CONF_POWER_SUPPLY in config:
|
||||||
|
power_supply = get_variable(config[CONF_POWER_SUPPLY])
|
||||||
|
add(fast_led.set_power_supply(power_supply))
|
||||||
|
|
||||||
setup_mqtt_component(make.Pmqtt, config)
|
setup_mqtt_component(make.Pmqtt, config)
|
||||||
light.setup_light_component(make.Pstate, config)
|
light.setup_light_component(make.Pstate, config)
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ from esphomeyaml import pins
|
||||||
from esphomeyaml.components import light
|
from esphomeyaml.components import light
|
||||||
from esphomeyaml.const import CONF_CHIPSET, CONF_CLOCK_PIN, CONF_DATA_PIN, \
|
from esphomeyaml.const import CONF_CHIPSET, CONF_CLOCK_PIN, CONF_DATA_PIN, \
|
||||||
CONF_DEFAULT_TRANSITION_LENGTH, CONF_GAMMA_CORRECT, CONF_ID, CONF_MAX_REFRESH_RATE, CONF_NAME, \
|
CONF_DEFAULT_TRANSITION_LENGTH, CONF_GAMMA_CORRECT, CONF_ID, CONF_MAX_REFRESH_RATE, CONF_NAME, \
|
||||||
CONF_NUM_LEDS, CONF_RGB_ORDER
|
CONF_NUM_LEDS, CONF_POWER_SUPPLY, CONF_RGB_ORDER
|
||||||
from esphomeyaml.helpers import App, TemplateArguments, add, setup_mqtt_component, variable, \
|
from esphomeyaml.helpers import App, RawExpression, TemplateArguments, add, get_variable, \
|
||||||
RawExpression
|
setup_mqtt_component, variable
|
||||||
|
|
||||||
CHIPSETS = [
|
CHIPSETS = [
|
||||||
'LPD8806',
|
'LPD8806',
|
||||||
|
@ -42,6 +42,7 @@ PLATFORM_SCHEMA = light.PLATFORM_SCHEMA.extend({
|
||||||
|
|
||||||
vol.Optional(CONF_GAMMA_CORRECT): cv.positive_float,
|
vol.Optional(CONF_GAMMA_CORRECT): cv.positive_float,
|
||||||
vol.Optional(CONF_DEFAULT_TRANSITION_LENGTH): cv.positive_time_period_milliseconds,
|
vol.Optional(CONF_DEFAULT_TRANSITION_LENGTH): cv.positive_time_period_milliseconds,
|
||||||
|
vol.Optional(CONF_POWER_SUPPLY): cv.variable_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,6 +63,10 @@ def to_code(config):
|
||||||
if CONF_MAX_REFRESH_RATE in config:
|
if CONF_MAX_REFRESH_RATE in config:
|
||||||
add(fast_led.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
|
add(fast_led.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
|
||||||
|
|
||||||
|
if CONF_POWER_SUPPLY in config:
|
||||||
|
power_supply = get_variable(config[CONF_POWER_SUPPLY])
|
||||||
|
add(fast_led.set_power_supply(power_supply))
|
||||||
|
|
||||||
setup_mqtt_component(make.Pmqtt, config)
|
setup_mqtt_component(make.Pmqtt, config)
|
||||||
light.setup_light_component(make.Pstate, config)
|
light.setup_light_component(make.Pstate, config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue