Skip to content

Commit

Permalink
Use binary_sensor_schema (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Oct 21, 2024
1 parent 026ba18 commit fc5ef38
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions components/seplos_bms/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import esphome.codegen as cg
from esphome.components import binary_sensor
import esphome.config_validation as cv
from esphome.const import CONF_ICON, CONF_ID
from esphome.const import CONF_ID

from . import CONF_SEPLOS_BMS_ID, SeplosBms

Expand All @@ -11,20 +11,15 @@

CONF_FAN_RUNNING = "fan_running"

ICON_FAN_RUNNING = "mdi:fan"

BINARY_SENSORS = [
CONF_FAN_RUNNING,
]

CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(CONF_SEPLOS_BMS_ID): cv.use_id(SeplosBms),
cv.Optional(CONF_FAN_RUNNING): binary_sensor.BINARY_SENSOR_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(binary_sensor.BinarySensor),
cv.Optional(CONF_ICON, default=ICON_FAN_RUNNING): cv.icon,
}
cv.Optional(CONF_FAN_RUNNING): binary_sensor.binary_sensor_schema(
icon="mdi:fan"
),
}
)
Expand Down

0 comments on commit fc5ef38

Please sign in to comment.