Skip to content

Commit 9ba062a

Browse files
committed
Fix errors
1 parent 1addfb9 commit 9ba062a

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

custom_components/iaquk/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
Component to calculate IAQ UK index.
1+
"""Component to calculate IAQ UK index.
32
43
For more details about this component, please refer to
54
https://github.com/Limych/ha-iaquk
@@ -8,8 +7,8 @@
87
import logging
98
from typing import Any, Dict, Final, List, Optional, Union
109

11-
import homeassistant.helpers.config_validation as cv
1210
import voluptuous as vol
11+
1312
from homeassistant.components.sensor import DOMAIN as SENSOR
1413
from homeassistant.const import (
1514
ATTR_UNIT_OF_MEASUREMENT,
@@ -26,6 +25,7 @@
2625
)
2726
from homeassistant.core import State, callback
2827
from homeassistant.helpers import discovery
28+
import homeassistant.helpers.config_validation as cv
2929
from homeassistant.helpers.event import async_track_state_change
3030
from homeassistant.util.temperature import convert as convert_temperature
3131

@@ -160,6 +160,7 @@ def __init__(
160160

161161
def async_added_to_hass(self):
162162
"""Register callbacks."""
163+
163164
# pylint: disable=unused-argument
164165
@callback
165166
def sensor_state_listener(entity, old_state, new_state):
@@ -245,6 +246,7 @@ def update(self):
245246
indexes = {}
246247
for src in self._sources:
247248
try:
249+
# pylint: disable=unnecessary-dunder-call
248250
idx = self.__getattribute__(f"_{src}_index")
249251
_LOGGER.debug("[%s] %s_index=%s", self._entity_id, src, idx)
250252
if idx is not None:
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"domain": "iaquk",
3-
"name": "Indoor Air Quality UK Index",
4-
"version": "1.6.3-alpha",
5-
"documentation": "https://github.com/Limych/ha-iaquk",
6-
"issue_tracker": "https://github.com/Limych/ha-iaquk/issues",
7-
"dependencies": [],
8-
"config_flow": false,
9-
"codeowners": [
10-
"@Limych"
11-
],
12-
"requirements": [],
13-
"iot_class": "calculated"
14-
}
2+
"domain": "iaquk",
3+
"name": "Indoor Air Quality UK Index",
4+
"version": "1.6.3-alpha",
5+
"documentation": "https://github.com/Limych/ha-iaquk",
6+
"issue_tracker": "https://github.com/Limych/ha-iaquk/issues",
7+
"dependencies": [],
8+
"config_flow": false,
9+
"codeowners": [
10+
"@Limych"
11+
],
12+
"requirements": [],
13+
"iot_class": "calculated"
14+
}

custom_components/iaquk/sensor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Sensor platform to calculate IAQ UK index."""
22

3+
from collections.abc import Mapping
34
import logging
4-
from typing import Any, Final, Mapping, Optional
5+
from typing import Any, Final, Optional
56

67
from homeassistant.components.sensor import (
78
ENTITY_ID_FORMAT,

hacs.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "Indoor Air Quality UK Index",
3-
"domains": ["sensor"],
43
"hacs": "1.6.0",
54
"homeassistant": "2022.10.0"
65
}

tests/test__init.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"""Test integration setup process."""
22
# pylint: disable=redefined-outer-name,protected-access
33

4-
from homeassistant.const import (
5-
ATTR_UNIT_OF_MEASUREMENT,
6-
PERCENTAGE,
7-
STATE_UNAVAILABLE,
8-
STATE_UNKNOWN,
9-
TEMP_CELSIUS,
10-
TEMP_FAHRENHEIT,
11-
)
12-
from homeassistant.core import HomeAssistant
13-
from homeassistant.setup import async_setup_component
144
from pytest import raises
155
from pytest_homeassistant_custom_component.common import assert_setup_component
166

@@ -37,6 +27,16 @@
3727
Iaquk,
3828
_deslugify,
3929
)
30+
from homeassistant.const import (
31+
ATTR_UNIT_OF_MEASUREMENT,
32+
PERCENTAGE,
33+
STATE_UNAVAILABLE,
34+
STATE_UNKNOWN,
35+
TEMP_CELSIUS,
36+
TEMP_FAHRENHEIT,
37+
)
38+
from homeassistant.core import HomeAssistant
39+
from homeassistant.setup import async_setup_component
4040

4141

4242
async def async_mock_sensors(hass: HomeAssistant):

tests/test_sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""Test sensor setup."""
22
from unittest.mock import patch
33

4-
from homeassistant.core import HomeAssistant
5-
from homeassistant.setup import async_setup_component
64
from pytest_homeassistant_custom_component.common import assert_setup_component
75

86
from custom_components.iaquk import Iaquk
@@ -21,6 +19,8 @@
2119
LEVEL_POOR,
2220
)
2321
from custom_components.iaquk.sensor import SENSOR_INDEX, SENSOR_LEVEL, IaqukSensor
22+
from homeassistant.core import HomeAssistant
23+
from homeassistant.setup import async_setup_component
2424

2525

2626
async def test_entity_initialization(hass: HomeAssistant):

0 commit comments

Comments
 (0)