Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -1,8 +1,7 @@
|
||||
"""Support for MyChevy binary sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
ENTITY_ID_FORMAT, BinarySensorDevice)
|
||||
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorDevice
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.util import slugify
|
||||
|
||||
@@ -10,13 +9,10 @@ from . import DOMAIN as MYCHEVY_DOMAIN, UPDATE_TOPIC, EVBinarySensorConfig
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SENSORS = [
|
||||
EVBinarySensorConfig("Plugged In", "plugged_in", "plug")
|
||||
]
|
||||
SENSORS = [EVBinarySensorConfig("Plugged In", "plugged_in", "plug")]
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
"""Set up the MyChevy sensors."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
@@ -47,8 +43,10 @@ class EVBinarySensor(BinarySensorDevice):
|
||||
self._is_on = None
|
||||
self._car_vid = car_vid
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(
|
||||
'{}_{}_{}'.format(
|
||||
MYCHEVY_DOMAIN, slugify(self._car.name), slugify(self._name)))
|
||||
"{}_{}_{}".format(
|
||||
MYCHEVY_DOMAIN, slugify(self._car.name), slugify(self._name)
|
||||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -68,7 +66,8 @@ class EVBinarySensor(BinarySensorDevice):
|
||||
async def async_added_to_hass(self):
|
||||
"""Register callbacks."""
|
||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||
UPDATE_TOPIC, self.async_update_callback)
|
||||
UPDATE_TOPIC, self.async_update_callback
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_update_callback(self):
|
||||
|
||||
Reference in new issue
Block a user