Black
This commit is contained in:
parent
da05dfe708
commit
4de97abc3a
2676 changed files with 163166 additions and 140084 deletions
|
@ -3,7 +3,7 @@ from homeassistant.const import TEMP_CELSIUS
|
|||
|
||||
from . import KNOWN_DEVICES, HomeKitEntity
|
||||
|
||||
HUMIDITY_ICON = 'mdi:water-percent'
|
||||
HUMIDITY_ICON = "mdi:water-percent"
|
||||
TEMP_C_ICON = "mdi:thermometer"
|
||||
BRIGHTNESS_ICON = "mdi:brightness-6"
|
||||
|
||||
|
@ -11,29 +11,28 @@ UNIT_PERCENT = "%"
|
|||
UNIT_LUX = "lux"
|
||||
|
||||
|
||||
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):
|
||||
"""Legacy set up platform."""
|
||||
pass
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up Homekit covers."""
|
||||
hkid = config_entry.data['AccessoryPairingID']
|
||||
hkid = config_entry.data["AccessoryPairingID"]
|
||||
conn = hass.data[KNOWN_DEVICES][hkid]
|
||||
|
||||
def async_add_service(aid, service):
|
||||
devtype = service['stype']
|
||||
info = {'aid': aid, 'iid': service['iid']}
|
||||
if devtype == 'humidity':
|
||||
devtype = service["stype"]
|
||||
info = {"aid": aid, "iid": service["iid"]}
|
||||
if devtype == "humidity":
|
||||
async_add_entities([HomeKitHumiditySensor(conn, info)], True)
|
||||
return True
|
||||
|
||||
if devtype == 'temperature':
|
||||
if devtype == "temperature":
|
||||
async_add_entities([HomeKitTemperatureSensor(conn, info)], True)
|
||||
return True
|
||||
|
||||
if devtype == 'light':
|
||||
if devtype == "light":
|
||||
async_add_entities([HomeKitLightSensor(conn, info)], True)
|
||||
return True
|
||||
|
||||
|
@ -55,9 +54,7 @@ class HomeKitHumiditySensor(HomeKitEntity):
|
|||
# pylint: disable=import-error
|
||||
from homekit.model.characteristics import CharacteristicsTypes
|
||||
|
||||
return [
|
||||
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT
|
||||
]
|
||||
return [CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT]
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -96,9 +93,7 @@ class HomeKitTemperatureSensor(HomeKitEntity):
|
|||
# pylint: disable=import-error
|
||||
from homekit.model.characteristics import CharacteristicsTypes
|
||||
|
||||
return [
|
||||
CharacteristicsTypes.TEMPERATURE_CURRENT
|
||||
]
|
||||
return [CharacteristicsTypes.TEMPERATURE_CURRENT]
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -137,9 +132,7 @@ class HomeKitLightSensor(HomeKitEntity):
|
|||
# pylint: disable=import-error
|
||||
from homekit.model.characteristics import CharacteristicsTypes
|
||||
|
||||
return [
|
||||
CharacteristicsTypes.LIGHT_LEVEL_CURRENT
|
||||
]
|
||||
return [CharacteristicsTypes.LIGHT_LEVEL_CURRENT]
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue