mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 15:08:10 +01:00
Require step to be set when calling register_number (#4622)
This commit is contained in:
parent
806e43c34c
commit
e542e75b9e
1 changed files with 3 additions and 4 deletions
|
@ -204,14 +204,13 @@ def number_schema(
|
||||||
|
|
||||||
|
|
||||||
async def setup_number_core_(
|
async def setup_number_core_(
|
||||||
var, config, *, min_value: float, max_value: float, step: Optional[float]
|
var, config, *, min_value: float, max_value: float, step: float
|
||||||
):
|
):
|
||||||
await setup_entity(var, config)
|
await setup_entity(var, config)
|
||||||
|
|
||||||
cg.add(var.traits.set_min_value(min_value))
|
cg.add(var.traits.set_min_value(min_value))
|
||||||
cg.add(var.traits.set_max_value(max_value))
|
cg.add(var.traits.set_max_value(max_value))
|
||||||
if step is not None:
|
cg.add(var.traits.set_step(step))
|
||||||
cg.add(var.traits.set_step(step))
|
|
||||||
|
|
||||||
cg.add(var.traits.set_mode(config[CONF_MODE]))
|
cg.add(var.traits.set_mode(config[CONF_MODE]))
|
||||||
|
|
||||||
|
@ -239,7 +238,7 @@ async def setup_number_core_(
|
||||||
|
|
||||||
|
|
||||||
async def register_number(
|
async def register_number(
|
||||||
var, config, *, min_value: float, max_value: float, step: Optional[float] = None
|
var, config, *, min_value: float, max_value: float, step: float
|
||||||
):
|
):
|
||||||
if not CORE.has_id(config[CONF_ID]):
|
if not CORE.has_id(config[CONF_ID]):
|
||||||
var = cg.Pvariable(config[CONF_ID], var)
|
var = cg.Pvariable(config[CONF_ID], var)
|
||||||
|
|
Loading…
Reference in a new issue