1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-18 17:53:47 +01:00
Files
esphome/esphome/components/as3935/binary_sensor.py
2025-03-20 09:51:23 -10:00

20 lines
506 B
Python

import esphome.codegen as cg
from esphome.components import binary_sensor
import esphome.config_validation as cv
from . import AS3935, CONF_AS3935_ID
DEPENDENCIES = ["as3935"]
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema().extend(
{
cv.GenerateID(CONF_AS3935_ID): cv.use_id(AS3935),
}
)
async def to_code(config):
hub = await cg.get_variable(config[CONF_AS3935_ID])
var = await binary_sensor.new_binary_sensor(config)
cg.add(hub.set_thunder_alert_binary_sensor(var))