22 lines
674 B
Python
22 lines
674 B
Python
|
import esphome.codegen as cg
|
||
|
import esphome.config_validation as cv
|
||
|
from esphome.components import nimble_tracker
|
||
|
from esphome.const import (
|
||
|
DEVICE_CLASS_DISTANCE,
|
||
|
STATE_CLASS_MEASUREMENT,
|
||
|
UNIT_METER,
|
||
|
)
|
||
|
|
||
|
DEPENDENCIES = ["nimble_tracker"]
|
||
|
|
||
|
nimble_custom_distance_ns = cg.esphome_ns.namespace("nimble_custom_distance")
|
||
|
NimbleDistanceCustomComponent = nimble_custom_distance_ns.class_(
|
||
|
"NimbleDistanceCustomComponent",
|
||
|
cg.Component,
|
||
|
nimble_tracker.NimbleDeviceListener,
|
||
|
)
|
||
|
|
||
|
CONFIG_SCHEMA = cv.Schema({
|
||
|
cv.GenerateID(): cv.declare_id(NimbleDistanceCustomComponent),
|
||
|
}).extend(cv.COMPONENT_SCHEMA).extend(nimble_tracker.NIMBLE_DEVICE_LISTENER_SCHEMA)
|