Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/airvisual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ async def async_setup_entry(hass, config_entry):
_standardize_geography_config_entry(hass, config_entry)
airvisual = AirVisualGeographyData(
hass,
Client(websession, api_key=config_entry.data[CONF_API_KEY]),
Client(api_key=config_entry.data[CONF_API_KEY], session=websession),
config_entry,
)

# Only geography-based entries have options:
config_entry.add_update_listener(async_update_options)
else:
_standardize_node_pro_config_entry(hass, config_entry)
airvisual = AirVisualNodeProData(hass, Client(websession), config_entry)
airvisual = AirVisualNodeProData(hass, Client(session=websession), config_entry)

await airvisual.async_update()

Expand Down
12 changes: 0 additions & 12 deletions homeassistant/components/airvisual/air_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
from homeassistant.components.air_quality import AirQualityEntity
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
from homeassistant.core import callback
from homeassistant.util import slugify

from . import AirVisualEntity
from .const import DATA_CLIENT, DOMAIN, INTEGRATION_TYPE_GEOGRAPHY

ATTR_HUMIDITY = "humidity"
ATTR_SENSOR_LIFE = "{0}_sensor_life"
ATTR_TREND = "{0}_trend"
ATTR_VOC = "voc"


Expand Down Expand Up @@ -94,15 +92,6 @@ def unique_id(self):
@callback
def update_from_latest_data(self):
"""Update from the Node/Pro's data."""
trends = {
ATTR_TREND.format(slugify(pollutant)): trend
for pollutant, trend in self._airvisual.data["trends"].items()
}
if self._airvisual.data["current"]["settings"]["is_aqi_usa"]:
trends.pop(ATTR_TREND.format("aqi_cn"))
else:
trends.pop(ATTR_TREND.format("aqi_us"))

self._attrs.update(
{
ATTR_VOC: self._airvisual.data["current"]["measurements"].get("voc"),
Expand All @@ -112,6 +101,5 @@ def update_from_latest_data(self):
"status"
]["sensor_life"].items()
},
**trends,
}
)
4 changes: 2 additions & 2 deletions homeassistant/components/airvisual/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def async_step_geography(self, user_input=None):
return self.async_abort(reason="already_configured")

websession = aiohttp_client.async_get_clientsession(self.hass)
client = Client(websession, api_key=user_input[CONF_API_KEY])
client = Client(session=websession, api_key=user_input[CONF_API_KEY])

# If this is the first (and only the first) time we've seen this API key, check
# that it's valid:
Expand Down Expand Up @@ -142,7 +142,7 @@ async def async_step_node_pro(self, user_input=None):
await self._async_set_unique_id(user_input[CONF_IP_ADDRESS])

websession = aiohttp_client.async_get_clientsession(self.hass)
client = Client(websession)
client = Client(session=websession)

try:
await client.node.from_samba(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/airvisual/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"name": "AirVisual",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/airvisual",
"requirements": ["pyairvisual==4.3.0"],
"requirements": ["pyairvisual==4.4.0"],
"codeowners": ["@bachya"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ pyaehw4a1==0.3.4
pyaftership==0.1.2

# homeassistant.components.airvisual
pyairvisual==4.3.0
pyairvisual==4.4.0

# homeassistant.components.almond
pyalmond==0.0.2
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ py_nextbusnext==0.1.4
pyaehw4a1==0.3.4

# homeassistant.components.airvisual
pyairvisual==4.3.0
pyairvisual==4.4.0

# homeassistant.components.almond
pyalmond==0.0.2
Expand Down