Bump pyairvisual and remove unused trends (#34707)
This commit is contained in:
parent
f436e29a0d
commit
8ff1fc6f8b
6 changed files with 7 additions and 19 deletions
|
@ -169,7 +169,7 @@ async def async_setup_entry(hass, config_entry):
|
||||||
_standardize_geography_config_entry(hass, config_entry)
|
_standardize_geography_config_entry(hass, config_entry)
|
||||||
airvisual = AirVisualGeographyData(
|
airvisual = AirVisualGeographyData(
|
||||||
hass,
|
hass,
|
||||||
Client(websession, api_key=config_entry.data[CONF_API_KEY]),
|
Client(api_key=config_entry.data[CONF_API_KEY], session=websession),
|
||||||
config_entry,
|
config_entry,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ async def async_setup_entry(hass, config_entry):
|
||||||
config_entry.add_update_listener(async_update_options)
|
config_entry.add_update_listener(async_update_options)
|
||||||
else:
|
else:
|
||||||
_standardize_node_pro_config_entry(hass, config_entry)
|
_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()
|
await airvisual.async_update()
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,12 @@
|
||||||
from homeassistant.components.air_quality import AirQualityEntity
|
from homeassistant.components.air_quality import AirQualityEntity
|
||||||
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.util import slugify
|
|
||||||
|
|
||||||
from . import AirVisualEntity
|
from . import AirVisualEntity
|
||||||
from .const import DATA_CLIENT, DOMAIN, INTEGRATION_TYPE_GEOGRAPHY
|
from .const import DATA_CLIENT, DOMAIN, INTEGRATION_TYPE_GEOGRAPHY
|
||||||
|
|
||||||
ATTR_HUMIDITY = "humidity"
|
ATTR_HUMIDITY = "humidity"
|
||||||
ATTR_SENSOR_LIFE = "{0}_sensor_life"
|
ATTR_SENSOR_LIFE = "{0}_sensor_life"
|
||||||
ATTR_TREND = "{0}_trend"
|
|
||||||
ATTR_VOC = "voc"
|
ATTR_VOC = "voc"
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,15 +92,6 @@ class AirVisualNodeProSensor(AirVisualEntity, AirQualityEntity):
|
||||||
@callback
|
@callback
|
||||||
def update_from_latest_data(self):
|
def update_from_latest_data(self):
|
||||||
"""Update from the Node/Pro's data."""
|
"""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(
|
self._attrs.update(
|
||||||
{
|
{
|
||||||
ATTR_VOC: self._airvisual.data["current"]["measurements"].get("voc"),
|
ATTR_VOC: self._airvisual.data["current"]["measurements"].get("voc"),
|
||||||
|
@ -112,6 +101,5 @@ class AirVisualNodeProSensor(AirVisualEntity, AirQualityEntity):
|
||||||
"status"
|
"status"
|
||||||
]["sensor_life"].items()
|
]["sensor_life"].items()
|
||||||
},
|
},
|
||||||
**trends,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -101,7 +101,7 @@ class AirVisualFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
|
|
||||||
websession = aiohttp_client.async_get_clientsession(self.hass)
|
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
|
# If this is the first (and only the first) time we've seen this API key, check
|
||||||
# that it's valid:
|
# that it's valid:
|
||||||
|
@ -142,7 +142,7 @@ class AirVisualFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
await self._async_set_unique_id(user_input[CONF_IP_ADDRESS])
|
await self._async_set_unique_id(user_input[CONF_IP_ADDRESS])
|
||||||
|
|
||||||
websession = aiohttp_client.async_get_clientsession(self.hass)
|
websession = aiohttp_client.async_get_clientsession(self.hass)
|
||||||
client = Client(websession)
|
client = Client(session=websession)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await client.node.from_samba(
|
await client.node.from_samba(
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
"name": "AirVisual",
|
"name": "AirVisual",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/airvisual",
|
"documentation": "https://www.home-assistant.io/integrations/airvisual",
|
||||||
"requirements": ["pyairvisual==4.3.0"],
|
"requirements": ["pyairvisual==4.4.0"],
|
||||||
"codeowners": ["@bachya"]
|
"codeowners": ["@bachya"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ pyaehw4a1==0.3.4
|
||||||
pyaftership==0.1.2
|
pyaftership==0.1.2
|
||||||
|
|
||||||
# homeassistant.components.airvisual
|
# homeassistant.components.airvisual
|
||||||
pyairvisual==4.3.0
|
pyairvisual==4.4.0
|
||||||
|
|
||||||
# homeassistant.components.almond
|
# homeassistant.components.almond
|
||||||
pyalmond==0.0.2
|
pyalmond==0.0.2
|
||||||
|
|
|
@ -470,7 +470,7 @@ py_nextbusnext==0.1.4
|
||||||
pyaehw4a1==0.3.4
|
pyaehw4a1==0.3.4
|
||||||
|
|
||||||
# homeassistant.components.airvisual
|
# homeassistant.components.airvisual
|
||||||
pyairvisual==4.3.0
|
pyairvisual==4.4.0
|
||||||
|
|
||||||
# homeassistant.components.almond
|
# homeassistant.components.almond
|
||||||
pyalmond==0.0.2
|
pyalmond==0.0.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue