mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Missing py definition
This commit is contained in:
parent
7bbb9b820e
commit
2744fd62e7
1 changed files with 6 additions and 0 deletions
|
@ -3,6 +3,7 @@ import esphome.config_validation as cv
|
||||||
from esphome import automation, pins
|
from esphome import automation, pins
|
||||||
from esphome.components import sensor
|
from esphome.components import sensor
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
|
CONF_BINARY_SENSOR,
|
||||||
CONF_COUNT_MODE,
|
CONF_COUNT_MODE,
|
||||||
CONF_FALLING_EDGE,
|
CONF_FALLING_EDGE,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
@ -115,6 +116,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
accuracy_decimals=0,
|
accuracy_decimals=0,
|
||||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
|
cv.Optional(CONF_BINARY_SENSOR): sensor.sensor_schema(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.extend(cv.polling_component_schema("60s")),
|
.extend(cv.polling_component_schema("60s")),
|
||||||
|
@ -137,6 +139,10 @@ async def to_code(config):
|
||||||
sens = await sensor.new_sensor(config[CONF_TOTAL])
|
sens = await sensor.new_sensor(config[CONF_TOTAL])
|
||||||
cg.add(var.set_total_sensor(sens))
|
cg.add(var.set_total_sensor(sens))
|
||||||
|
|
||||||
|
if CONF_BINARY_SENSOR in config:
|
||||||
|
bsens = await sensor.new_sensor(config[CONF_BINARY_SENSOR])
|
||||||
|
cg.add(var.set_binary_sensor(bsens))
|
||||||
|
|
||||||
|
|
||||||
@automation.register_action(
|
@automation.register_action(
|
||||||
"pulse_counter.set_total_pulses",
|
"pulse_counter.set_total_pulses",
|
||||||
|
|
Loading…
Reference in a new issue