Use f-strings in integrations starting with "F"and"G" (#32150)
* Use f-strings in integrations starting with F * Use f-strings in tests for integrations starting with F * Use f-strings in integrations starting with G * Use f-strings in tests for integrations starting with G * Fix pylint error * Fix broken test
This commit is contained in:
1 parent
496bd3dddf
commit
ad102b3840
59 files changed
+219
-344
No files matched your search
@@ -247,8 +247,8 @@ class FibaroController:
|
||||
room_name = self._room_map[device.roomID].name
|
||||
device.room_name = room_name
|
||||
device.friendly_name = f"{room_name} {device.name}"
|
||||
device.ha_id = "scene_{}_{}_{}".format(
|
||||
slugify(room_name), slugify(device.name), device.id
|
||||
device.ha_id = (
|
||||
f"scene_{slugify(room_name)}_{slugify(device.name)}_{device.id}"
|
||||
)
|
||||
device.unique_id_str = f"{self.hub_serial}.scene.{device.id}"
|
||||
self._scene_map[device.id] = device
|
||||
@@ -269,8 +269,8 @@ class FibaroController:
|
||||
room_name = self._room_map[device.roomID].name
|
||||
device.room_name = room_name
|
||||
device.friendly_name = f"{room_name} {device.name}"
|
||||
device.ha_id = "{}_{}_{}".format(
|
||||
slugify(room_name), slugify(device.name), device.id
|
||||
device.ha_id = (
|
||||
f"{slugify(room_name)}_{slugify(device.name)}_{device.id}"
|
||||
)
|
||||
if (
|
||||
device.enabled
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Fibaro binary sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorDevice
|
||||
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice
|
||||
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
|
||||
|
||||
from . import FIBARO_DEVICES, FibaroDevice
|
||||
@@ -40,7 +40,7 @@ class FibaroBinarySensor(FibaroDevice, BinarySensorDevice):
|
||||
"""Initialize the binary_sensor."""
|
||||
self._state = None
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
self.entity_id = f"{DOMAIN}.{self.ha_id}"
|
||||
stype = None
|
||||
devconf = fibaro_device.device_config
|
||||
if fibaro_device.type in SENSOR_TYPES:
|
||||
|
||||
@@ -4,7 +4,7 @@ import logging
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
ENTITY_ID_FORMAT,
|
||||
DOMAIN,
|
||||
CoverDevice,
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ class FibaroCover(FibaroDevice, CoverDevice):
|
||||
def __init__(self, fibaro_device):
|
||||
"""Initialize the Vera device."""
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
self.entity_id = f"{DOMAIN}.{self.ha_id}"
|
||||
|
||||
@staticmethod
|
||||
def bound(position):
|
||||
|
||||
@@ -7,7 +7,7 @@ from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_WHITE_VALUE,
|
||||
ENTITY_ID_FORMAT,
|
||||
DOMAIN,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_WHITE_VALUE,
|
||||
@@ -77,7 +77,7 @@ class FibaroLight(FibaroDevice, Light):
|
||||
self._supported_flags |= SUPPORT_WHITE_VALUE
|
||||
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
self.entity_id = f"{DOMAIN}.{self.ha_id}"
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Fibaro sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import ENTITY_ID_FORMAT
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
@@ -53,7 +53,7 @@ class FibaroSensor(FibaroDevice, Entity):
|
||||
self.current_value = None
|
||||
self.last_changed_time = None
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
self.entity_id = f"{DOMAIN}.{self.ha_id}"
|
||||
if fibaro_device.type in SENSOR_TYPES:
|
||||
self._unit = SENSOR_TYPES[fibaro_device.type][1]
|
||||
self._icon = SENSOR_TYPES[fibaro_device.type][2]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Fibaro switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.util import convert
|
||||
|
||||
from . import FIBARO_DEVICES, FibaroDevice
|
||||
@@ -26,7 +26,7 @@ class FibaroSwitch(FibaroDevice, SwitchDevice):
|
||||
"""Initialize the Fibaro device."""
|
||||
self._state = False
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
self.entity_id = f"{DOMAIN}.{self.ha_id}"
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn device on."""
|
||||
|
||||
Reference in new issue
Block a user