WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Nov 19, 2021. It is now read-only.

Commit 5349aa8

Browse files
committed
Update for new source format
You know the drill by now...
1 parent dede994 commit 5349aa8

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

custom_components/coronavirus_hessen/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,13 @@ async def async_get_data():
7878

7979
for row in rows[2:]:
8080
line = row.select("td")
81-
if len(line) != 7:
81+
if len(line) != 6:
8282
continue
8383

8484
try:
8585
county = line[0].get_text(" ", strip=True)
8686
cases = parse_num(line[1].get_text(" ", strip=True))
87-
hospitalized = parse_num(line[2].get_text(" ", strip=True))
88-
deaths = parse_num(line[3].get_text(" ", strip=True))
87+
deaths = parse_num(line[2].get_text(" ", strip=True))
8988
except:
9089
_LOGGER.exception("Error processing line {}, skipping".format(line))
9190
continue
@@ -94,7 +93,7 @@ async def async_get_data():
9493
if county == "Gesamtergebnis":
9594
county = OPTION_TOTAL
9695

97-
result[county] = dict(cases=cases, hospitalized=hospitalized, deaths=deaths)
96+
result[county] = dict(cases=cases, deaths=deaths)
9897

9998
_LOGGER.debug("Corona Hessen: {!r}".format(result))
10099
return result

custom_components/coronavirus_hessen/sensor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
_LOGGER = logging.getLogger(__name__)
1313

1414
ATTR_DEATHS = "deaths"
15-
ATTR_HOSPITALIZED = "hospitalized"
1615

1716
async def async_setup_entry(hass, config_entry, async_add_entities):
1817
"""Defer sensor setup to the shared sensor module."""
@@ -60,7 +59,6 @@ def state(self):
6059
@property
6160
def device_state_attributes(self):
6261
return {ATTR_ATTRIBUTION: ATTRIBUTION,
63-
ATTR_HOSPITALIZED: self.coordinator.data[self.county]["hospitalized"],
6462
ATTR_DEATHS: self.coordinator.data[self.county]["deaths"]}
6563

6664
async def async_added_to_hass(self):

0 commit comments

Comments
 (0)