mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
[max31856] Use cv.frequency as validator (#7212)
This commit is contained in:
parent
73f786c606
commit
9b0c2234d8
@ -1,6 +1,6 @@
|
|||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome.components import sensor, spi
|
from esphome.components import sensor, spi
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_MAINS_FILTER,
|
CONF_MAINS_FILTER,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
@ -15,8 +15,8 @@ MAX31856Sensor = max31856_ns.class_(
|
|||||||
|
|
||||||
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
|
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
|
||||||
FILTER = {
|
FILTER = {
|
||||||
"50HZ": MAX31865ConfigFilter.FILTER_50HZ,
|
50: MAX31865ConfigFilter.FILTER_50HZ,
|
||||||
"60HZ": MAX31865ConfigFilter.FILTER_60HZ,
|
60: MAX31865ConfigFilter.FILTER_60HZ,
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
@ -29,8 +29,8 @@ CONFIG_SCHEMA = (
|
|||||||
)
|
)
|
||||||
.extend(
|
.extend(
|
||||||
{
|
{
|
||||||
cv.Optional(CONF_MAINS_FILTER, default="60HZ"): cv.enum(
|
cv.Optional(CONF_MAINS_FILTER, default="60Hz"): cv.All(
|
||||||
FILTER, upper=True, space=""
|
cv.frequency, cv.enum(FILTER, int=True)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user