mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Add handling for min power output setting (#448)
* Add handling for min power output setting * Fix line length error
This commit is contained in:
parent
808ee19180
commit
38e7b597d6
2 changed files with 6 additions and 1 deletions
|
@ -3,7 +3,8 @@ import voluptuous as vol
|
||||||
from esphome.automation import ACTION_REGISTRY, maybe_simple_id
|
from esphome.automation import ACTION_REGISTRY, maybe_simple_id
|
||||||
from esphome.components.power_supply import PowerSupplyComponent
|
from esphome.components.power_supply import PowerSupplyComponent
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_ID, CONF_INVERTED, CONF_LEVEL, CONF_MAX_POWER, CONF_POWER_SUPPLY
|
from esphome.const import CONF_ID, CONF_INVERTED, CONF_LEVEL, CONF_MAX_POWER, \
|
||||||
|
CONF_MIN_POWER, CONF_POWER_SUPPLY
|
||||||
from esphome.core import CORE
|
from esphome.core import CORE
|
||||||
from esphome.cpp_generator import Pvariable, add, get_variable, templatable
|
from esphome.cpp_generator import Pvariable, add, get_variable, templatable
|
||||||
from esphome.cpp_types import Action, esphome_ns, float_
|
from esphome.cpp_types import Action, esphome_ns, float_
|
||||||
|
@ -21,6 +22,7 @@ BINARY_OUTPUT_PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(BINARY_OUTPUT_SCHEMA.sche
|
||||||
|
|
||||||
FLOAT_OUTPUT_SCHEMA = BINARY_OUTPUT_SCHEMA.extend({
|
FLOAT_OUTPUT_SCHEMA = BINARY_OUTPUT_SCHEMA.extend({
|
||||||
vol.Optional(CONF_MAX_POWER): cv.percentage,
|
vol.Optional(CONF_MAX_POWER): cv.percentage,
|
||||||
|
vol.Optional(CONF_MIN_POWER): cv.percentage,
|
||||||
})
|
})
|
||||||
|
|
||||||
FLOAT_OUTPUT_PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(FLOAT_OUTPUT_SCHEMA.schema)
|
FLOAT_OUTPUT_PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(FLOAT_OUTPUT_SCHEMA.schema)
|
||||||
|
@ -47,6 +49,8 @@ def setup_output_platform_(obj, config, skip_power_supply=False):
|
||||||
add(obj.set_power_supply(power_supply))
|
add(obj.set_power_supply(power_supply))
|
||||||
if CONF_MAX_POWER in config:
|
if CONF_MAX_POWER in config:
|
||||||
add(obj.set_max_power(config[CONF_MAX_POWER]))
|
add(obj.set_max_power(config[CONF_MAX_POWER]))
|
||||||
|
if CONF_MIN_POWER in config:
|
||||||
|
add(obj.set_min_power(config[CONF_MIN_POWER]))
|
||||||
|
|
||||||
|
|
||||||
def setup_output_platform(obj, config, skip_power_supply=False):
|
def setup_output_platform(obj, config, skip_power_supply=False):
|
||||||
|
|
|
@ -414,6 +414,7 @@ CONF_USE_ADDRESS = 'use_address'
|
||||||
CONF_FROM = 'from'
|
CONF_FROM = 'from'
|
||||||
CONF_TO = 'to'
|
CONF_TO = 'to'
|
||||||
CONF_SEGMENTS = 'segments'
|
CONF_SEGMENTS = 'segments'
|
||||||
|
CONF_MIN_POWER = 'min_power'
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_'
|
ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_'
|
||||||
ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage'
|
ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage'
|
||||||
|
|
Loading…
Reference in a new issue