From 61944f504afbc121a69fd7979c9a51139082008d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sun, 1 Nov 2020 13:40:54 +0100 Subject: [PATCH] Add 7d incidence to attributes --- custom_components/coronavirus_hessen/sensor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/coronavirus_hessen/sensor.py b/custom_components/coronavirus_hessen/sensor.py index 8ab26a8..692512c 100644 --- a/custom_components/coronavirus_hessen/sensor.py +++ b/custom_components/coronavirus_hessen/sensor.py @@ -11,7 +11,9 @@ _LOGGER = logging.getLogger(__name__) +ATTR_CASES = "cases" ATTR_DEATHS = "deaths" +ATTR_INCIDENCE = "incidence" async def async_setup_entry(hass, config_entry, async_add_entities): """Defer sensor setup to the shared sensor module.""" @@ -59,7 +61,9 @@ def state(self): @property def device_state_attributes(self): return {ATTR_ATTRIBUTION: ATTRIBUTION, - ATTR_DEATHS: self.coordinator.data[self.county]["deaths"]} + ATTR_CASES: self.coordinator.data[self.county]["cases"], + ATTR_DEATHS: self.coordinator.data[self.county]["deaths"], + ATTR_INCIDENCE: self.coordinator.data[self.county]["incidence"]} async def async_added_to_hass(self): """When entity is added to hass."""