diff --git a/README.md b/README.md index 048232a..6b62d53 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ A custom component designed for [Home Assistant](https://www.home-assistant.io) - Well A5 Air Purifier ### Install with HACS (recommended) -Do you you have [HACS][hacs] installed? Just search for Electrolux Wellbeing and install it direct from HACS. HACS will keep track of updates and you can easly upgrade this component to latest version. +Do you you have [HACS][hacs] installed? Just search for Electrolux Wellbeing and install it direct from HACS. HACS will keep track of updates and you can easily upgrade this integration to latest version. -### Installation +### Manual Installation 1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`). 2. If you do not have a `custom_components` directory (folder) there, you need to create it. diff --git a/custom_components/wellbeing/api.py b/custom_components/wellbeing/api.py index 1f6a692..a182446 100644 --- a/custom_components/wellbeing/api.py +++ b/custom_components/wellbeing/api.py @@ -1,20 +1,18 @@ """Sample API Client.""" -import json -from datetime import datetime, timedelta - import asyncio import logging import socket +from datetime import datetime, timedelta from enum import Enum -from typing import Union import aiohttp import async_timeout from custom_components.wellbeing.const import SENSOR, FAN, BINARY_SENSOR -from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY -from homeassistant.const import TEMP_CELSIUS, PERCENTAGE, DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_CO2, \ - DEVICE_CLASS_HUMIDITY, CONCENTRATION_PARTS_PER_MILLION, CONCENTRATION_PARTS_PER_BILLION +from homeassistant.components.binary_sensor import BinarySensorDeviceClass +from homeassistant.components.sensor import SensorDeviceClass +from homeassistant.const import TEMP_CELSIUS, PERCENTAGE, CONCENTRATION_PARTS_PER_MILLION, \ + CONCENTRATION_PARTS_PER_BILLION, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER TIMEOUT = 10 RETRIES = 3 @@ -113,7 +111,7 @@ def _create_entities(data): name="eCO2", attr='ECO2', unit=CONCENTRATION_PARTS_PER_MILLION, - device_class=DEVICE_CLASS_CO2 + device_class=SensorDeviceClass.CO2 ), ApplianceSensor( name=f"{FILTER_TYPE[data.get('FilterType_1', 0)]} Life", @@ -145,20 +143,20 @@ def _create_entities(data): name="CO2", attr='CO2', unit=CONCENTRATION_PARTS_PER_MILLION, - device_class=DEVICE_CLASS_CO2 + device_class=SensorDeviceClass.CO2 ), ] common_entities = [ ApplianceFan( name="Fan Speed", - attr='Fanspeed' + attr='Fanspeed', ), ApplianceSensor( name="Temperature", attr='Temp', unit=TEMP_CELSIUS, - device_class=DEVICE_CLASS_TEMPERATURE + device_class=SensorDeviceClass.TEMPERATURE ), ApplianceSensor( name="TVOC", @@ -167,21 +165,27 @@ def _create_entities(data): ), ApplianceSensor( name="PM1", - attr='PM1' + attr='PM1', + unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + device_class=SensorDeviceClass.PM1 ), ApplianceSensor( name="PM2.5", - attr='PM2_5' + attr='PM2_5', + unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + device_class=SensorDeviceClass.PM25 ), ApplianceSensor( name="PM10", - attr='PM10' + attr='PM10', + unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + device_class=SensorDeviceClass.PM10 ), ApplianceSensor( name="Humidity", attr='Humidity', unit=PERCENTAGE, - device_class=DEVICE_CLASS_HUMIDITY + device_class=SensorDeviceClass.HUMIDITY ), ApplianceSensor( name="Mode", @@ -198,7 +202,7 @@ def _create_entities(data): ApplianceBinary( name="Connection State", attr='connectionState', - device_class=DEVICE_CLASS_CONNECTIVITY + device_class=BinarySensorDeviceClass.CONNECTIVITY ), ApplianceBinary( name="Status", @@ -206,7 +210,8 @@ def _create_entities(data): ), ApplianceBinary( name="Safety Lock", - attr='SafetyLock' + attr='SafetyLock', + device_class=BinarySensorDeviceClass.LOCK ) ] diff --git a/hacs.json b/hacs.json index 8560381..9f04093 100644 --- a/hacs.json +++ b/hacs.json @@ -1,7 +1,5 @@ { "name": "Electrolux Wellbeing", "hacs": "1.6.0", - "domains": ["binary_sensor", "sensor", "fan"], - "iot_class": "Cloud Polling", - "homeassistant": "2021.5.0" + "homeassistant": "2021.12.0" }