diff --git a/homeassistant/components/blebox/__init__.py b/homeassistant/components/blebox/__init__.py index 36d319b43fb..9245392f89a 100644 --- a/homeassistant/components/blebox/__init__.py +++ b/homeassistant/components/blebox/__init__.py @@ -74,7 +74,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): @callback -def create_blebox_entities(hass, config_entry, async_add, entity_klass, entity_type): +def create_blebox_entities( + hass, config_entry, async_add_entities, entity_klass, entity_type +): """Create entities from a BleBox product's features.""" product = hass.data[DOMAIN][config_entry.entry_id][PRODUCT] @@ -84,7 +86,7 @@ def create_blebox_entities(hass, config_entry, async_add, entity_klass, entity_t for feature in product.features[entity_type]: entities.append(entity_klass(feature)) - async_add(entities, True) + async_add_entities(entities, True) class BleBoxEntity(Entity): diff --git a/homeassistant/components/blebox/air_quality.py b/homeassistant/components/blebox/air_quality.py index 656f19109ea..e7e9bac1f97 100644 --- a/homeassistant/components/blebox/air_quality.py +++ b/homeassistant/components/blebox/air_quality.py @@ -5,10 +5,10 @@ from homeassistant.components.air_quality import AirQualityEntity from . import BleBoxEntity, create_blebox_entities -async def async_setup_entry(hass, config_entry, async_add): +async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox air quality entity.""" create_blebox_entities( - hass, config_entry, async_add, BleBoxAirQualityEntity, "air_qualities" + hass, config_entry, async_add_entities, BleBoxAirQualityEntity, "air_qualities" ) diff --git a/homeassistant/components/blebox/cover.py b/homeassistant/components/blebox/cover.py index 714b642e288..620adacf3f6 100644 --- a/homeassistant/components/blebox/cover.py +++ b/homeassistant/components/blebox/cover.py @@ -16,10 +16,12 @@ from . import BleBoxEntity, create_blebox_entities from .const import BLEBOX_TO_HASS_COVER_STATES, BLEBOX_TO_HASS_DEVICE_CLASSES -async def async_setup_entry(hass, config_entry, async_add): +async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox entry.""" - create_blebox_entities(hass, config_entry, async_add, BleBoxCoverEntity, "covers") + create_blebox_entities( + hass, config_entry, async_add_entities, BleBoxCoverEntity, "covers" + ) class BleBoxCoverEntity(BleBoxEntity, CoverEntity): diff --git a/homeassistant/components/blebox/light.py b/homeassistant/components/blebox/light.py index 251a14f8fb8..a825d102717 100644 --- a/homeassistant/components/blebox/light.py +++ b/homeassistant/components/blebox/light.py @@ -24,10 +24,12 @@ from . import BleBoxEntity, create_blebox_entities _LOGGER = logging.getLogger(__name__) -async def async_setup_entry(hass, config_entry, async_add): +async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox entry.""" - create_blebox_entities(hass, config_entry, async_add, BleBoxLightEntity, "lights") + create_blebox_entities( + hass, config_entry, async_add_entities, BleBoxLightEntity, "lights" + ) class BleBoxLightEntity(BleBoxEntity, LightEntity): @@ -69,9 +71,9 @@ class BleBoxLightEntity(BleBoxEntity, LightEntity): async def async_turn_on(self, **kwargs): """Turn the light on.""" - white = kwargs.get(ATTR_WHITE_VALUE, None) - hs_color = kwargs.get(ATTR_HS_COLOR, None) - brightness = kwargs.get(ATTR_BRIGHTNESS, None) + white = kwargs.get(ATTR_WHITE_VALUE) + hs_color = kwargs.get(ATTR_HS_COLOR) + brightness = kwargs.get(ATTR_BRIGHTNESS) feature = self._feature value = feature.sensible_on_value @@ -90,7 +92,7 @@ class BleBoxLightEntity(BleBoxEntity, LightEntity): await self._feature.async_on(value) except BadOnValueError as ex: _LOGGER.error( - "turning on '%s' failed: Bad value %s (%s)", self.name, value, ex + "Turning on '%s' failed: Bad value %s (%s)", self.name, value, ex ) async def async_turn_off(self, **kwargs): diff --git a/homeassistant/components/blebox/sensor.py b/homeassistant/components/blebox/sensor.py index 00ea4e82b9d..84f4c19371d 100644 --- a/homeassistant/components/blebox/sensor.py +++ b/homeassistant/components/blebox/sensor.py @@ -6,10 +6,12 @@ from . import BleBoxEntity, create_blebox_entities from .const import BLEBOX_TO_HASS_DEVICE_CLASSES, BLEBOX_TO_UNIT_MAP -async def async_setup_entry(hass, config_entry, async_add): +async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox entry.""" - create_blebox_entities(hass, config_entry, async_add, BleBoxSensorEntity, "sensors") + create_blebox_entities( + hass, config_entry, async_add_entities, BleBoxSensorEntity, "sensors" + ) class BleBoxSensorEntity(BleBoxEntity, Entity): diff --git a/homeassistant/components/blebox/switch.py b/homeassistant/components/blebox/switch.py index 6cc05231929..e88773db639 100644 --- a/homeassistant/components/blebox/switch.py +++ b/homeassistant/components/blebox/switch.py @@ -5,10 +5,10 @@ from . import BleBoxEntity, create_blebox_entities from .const import BLEBOX_TO_HASS_DEVICE_CLASSES -async def async_setup_entry(hass, config_entry, async_add): +async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox switch entity.""" create_blebox_entities( - hass, config_entry, async_add, BleBoxSwitchEntity, "switches" + hass, config_entry, async_add_entities, BleBoxSwitchEntity, "switches" ) diff --git a/tests/components/blebox/conftest.py b/tests/components/blebox/conftest.py index 569c16f813f..ece02d50b39 100644 --- a/tests/components/blebox/conftest.py +++ b/tests/components/blebox/conftest.py @@ -71,7 +71,7 @@ def config_fixture(): @pytest.fixture(name="feature") -def feature(request): +def feature_fixture(request): """Return an entity wrapper from given fixture name.""" return request.getfixturevalue(request.param) diff --git a/tests/components/blebox/test_config_flow.py b/tests/components/blebox/test_config_flow.py index fe13dfae15e..a7200b05b28 100644 --- a/tests/components/blebox/test_config_flow.py +++ b/tests/components/blebox/test_config_flow.py @@ -36,14 +36,14 @@ def create_valid_feature_mock(path="homeassistant.components.blebox.Products"): return feature -@pytest.fixture -def valid_feature_mock(): +@pytest.fixture(name="valid_feature_mock") +def valid_feature_mock_fixture(): """Return a valid, complete BleBox feature mock.""" return create_valid_feature_mock() -@pytest.fixture -def flow_feature_mock(): +@pytest.fixture(name="flow_feature_mock") +def flow_feature_mock_fixture(): """Return a mocked user flow feature.""" return create_valid_feature_mock( "homeassistant.components.blebox.config_flow.Products" @@ -74,8 +74,8 @@ async def test_flow_works(hass, valid_feature_mock, flow_feature_mock): } -@pytest.fixture -def product_class_mock(): +@pytest.fixture(name="product_class_mock") +def product_class_mock_fixture(): """Return a mocked feature.""" path = "homeassistant.components.blebox.config_flow.Products" patcher = patch(path, DEFAULT, blebox_uniapi.products.Products, True, True) diff --git a/tests/components/blebox/test_light.py b/tests/components/blebox/test_light.py index e1aa37777fd..fb0d1302e33 100644 --- a/tests/components/blebox/test_light.py +++ b/tests/components/blebox/test_light.py @@ -593,5 +593,5 @@ async def test_turn_on_failure(feature, hass, config, caplog): ) assert ( - f"turning on '{feature_mock.full_name}' failed: Bad value 123 ()" in caplog.text + f"Turning on '{feature_mock.full_name}' failed: Bad value 123 ()" in caplog.text )