1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-07 12:23:47 +01:00
* Add black

Update pre commit

Update pre commit

add empty line

* Format with black
This commit is contained in:
Guillermo Ruffino
2021-03-07 16:03:16 -03:00
committed by GitHub
parent 2b60b0f1fa
commit 69879920eb
398 changed files with 21624 additions and 12644 deletions

View File

@@ -4,26 +4,36 @@ import esphome.config_validation as cv
from esphome.components import esp32_ble_tracker
from esphome.const import CONF_TRIGGER_ID
CODEOWNERS = ['@OttoWinter']
DEPENDENCIES = ['esp32_ble_tracker']
CODEOWNERS = ["@OttoWinter"]
DEPENDENCIES = ["esp32_ble_tracker"]
exposure_notifications_ns = cg.esphome_ns.namespace('exposure_notifications')
ExposureNotification = exposure_notifications_ns.struct('ExposureNotification')
exposure_notifications_ns = cg.esphome_ns.namespace("exposure_notifications")
ExposureNotification = exposure_notifications_ns.struct("ExposureNotification")
ExposureNotificationTrigger = exposure_notifications_ns.class_(
'ExposureNotificationTrigger', esp32_ble_tracker.ESPBTDeviceListener,
automation.Trigger.template(ExposureNotification))
"ExposureNotificationTrigger",
esp32_ble_tracker.ESPBTDeviceListener,
automation.Trigger.template(ExposureNotification),
)
CONF_ON_EXPOSURE_NOTIFICATION = 'on_exposure_notification'
CONF_ON_EXPOSURE_NOTIFICATION = "on_exposure_notification"
CONFIG_SCHEMA = cv.Schema({
cv.Required(CONF_ON_EXPOSURE_NOTIFICATION): automation.validate_automation(cv.Schema({
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ExposureNotificationTrigger),
}).extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)),
})
CONFIG_SCHEMA = cv.Schema(
{
cv.Required(CONF_ON_EXPOSURE_NOTIFICATION): automation.validate_automation(
cv.Schema(
{
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(
ExposureNotificationTrigger
),
}
).extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
),
}
)
def to_code(config):
for conf in config.get(CONF_ON_EXPOSURE_NOTIFICATION, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
yield automation.build_automation(trigger, [(ExposureNotification, 'x')], conf)
yield automation.build_automation(trigger, [(ExposureNotification, "x")], conf)
yield esp32_ble_tracker.register_ble_device(trigger, conf)