1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-25 22:52:20 +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

@@ -3,26 +3,30 @@ import esphome.config_validation as cv
from esphome.const import CONF_ID, CONF_TYPE, CONF_UUID, ESP_PLATFORM_ESP32
ESP_PLATFORMS = [ESP_PLATFORM_ESP32]
CONFLICTS_WITH = ['esp32_ble_tracker']
CONFLICTS_WITH = ["esp32_ble_tracker"]
esp32_ble_beacon_ns = cg.esphome_ns.namespace('esp32_ble_beacon')
ESP32BLEBeacon = esp32_ble_beacon_ns.class_('ESP32BLEBeacon', cg.Component)
esp32_ble_beacon_ns = cg.esphome_ns.namespace("esp32_ble_beacon")
ESP32BLEBeacon = esp32_ble_beacon_ns.class_("ESP32BLEBeacon", cg.Component)
CONF_MAJOR = 'major'
CONF_MINOR = 'minor'
CONF_MAJOR = "major"
CONF_MINOR = "minor"
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(ESP32BLEBeacon),
cv.Required(CONF_TYPE): cv.one_of('IBEACON', upper=True),
cv.Required(CONF_UUID): cv.uuid,
cv.Optional(CONF_MAJOR, default=10167): cv.uint16_t,
cv.Optional(CONF_MINOR, default=61958): cv.uint16_t,
}).extend(cv.COMPONENT_SCHEMA)
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32BLEBeacon),
cv.Required(CONF_TYPE): cv.one_of("IBEACON", upper=True),
cv.Required(CONF_UUID): cv.uuid,
cv.Optional(CONF_MAJOR, default=10167): cv.uint16_t,
cv.Optional(CONF_MINOR, default=61958): cv.uint16_t,
}
).extend(cv.COMPONENT_SCHEMA)
def to_code(config):
uuid = config[CONF_UUID].hex
uuid_arr = [cg.RawExpression('0x{}'.format(uuid[i:i + 2])) for i in range(0, len(uuid), 2)]
uuid_arr = [
cg.RawExpression("0x{}".format(uuid[i : i + 2])) for i in range(0, len(uuid), 2)
]
var = cg.new_Pvariable(config[CONF_ID], uuid_arr)
yield cg.register_component(var, config)
cg.add(var.set_major(config[CONF_MAJOR]))