Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #53 from thebino/Feature/support-long-term-statistics
Browse files Browse the repository at this point in the history
add support for long-term-statistics
  • Loading branch information
thebino authored Aug 10, 2021
2 parents 4c41f57 + b1856ec commit f6b97eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [1.5.4] - 2021-08-10
### Added
- Added support for long-term statistics.

## [1.5.3] - 2021-07-01
### Changed
- Changed string representation of the incidence number (# to nb).
Expand Down
2 changes: 1 addition & 1 deletion custom_components/rki_covid/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"domain": "rki_covid",
"version": "1.5.1",
"version": "1.5.4",
"iot_class": "cloud_polling",
"name": "Robert-Koch Institut COVID Numbers",
"documentation": "https://github.com/thebino/rki_covid/blob/master/README.md",
Expand Down
7 changes: 6 additions & 1 deletion custom_components/rki_covid/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Callable, Dict, Optional

from homeassistant import config_entries, core
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, STATE_CLASS_MEASUREMENT
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers import update_coordinator
Expand Down Expand Up @@ -156,6 +156,11 @@ def icon(self):
"""Return the icon."""
return SENSORS[self.info_type]

@property
def state_class(self):
"""Opt-in for long-term statistics."""
return STATE_CLASS_MEASUREMENT

@property
def unit_of_measurement(self):
"""Return unit of measurement."""
Expand Down

0 comments on commit f6b97eb

Please sign in to comment.