Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for long-term statistics #62

Merged
merged 1 commit into from
Dec 10, 2021
Merged
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
14 changes: 11 additions & 3 deletions custom_components/airthings_wave/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@

import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA

from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
STATE_CLASS_MEASUREMENT,
SensorEntity,
)

from homeassistant.const import (ATTR_DEVICE_CLASS, ATTR_ICON, CONF_MAC,
CONF_NAME, CONF_SCAN_INTERVAL, CONF_ELEVATION,
CONF_UNIT_SYSTEM, CONF_UNIT_SYSTEM_IMPERIAL,
Expand All @@ -32,7 +38,6 @@
DEVICE_CLASS_TIMESTAMP,
EVENT_HOMEASSISTANT_STOP, ILLUMINANCE,
STATE_UNKNOWN)
from homeassistant.helpers.entity import Entity

_LOGGER = logging.getLogger(__name__)
CONNECT_TIMEOUT = 30
Expand Down Expand Up @@ -208,7 +213,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(ha_entities, True)


class AirthingsSensor(Entity):
class AirthingsSensor(SensorEntity):

_attr_state_class = STATE_CLASS_MEASUREMENT

"""General Representation of an Airthings sensor."""
def __init__(self, mac, name, device, device_info, sensor_specifics):
"""Initialize a sensor."""
Expand Down