9 Commits

Author SHA1 Message Date
Adrian Rumpold
8fb322283c Merge pull request #14 from AdrianoKF/fix/extra_state_attributes
fix: Replace deprecated device_state_attributes property
2022-04-06 11:38:20 +02:00
Adrian Rumpold
35ed25cf3f fix: Replace deprecated device_state_attributes property
See https://developers.home-assistant.io/docs/core/entity/?_highlight=extra_state_attributes#generic-properties for details
2022-04-06 11:31:46 +02:00
Adrian Rumpold
d20b48e6b1 Merge pull request #12 from AdrianoKF/fix-div-ids
Fix div IDs
2022-03-18 09:06:54 +01:00
Adrian Rumpold
d1438f9a0b chore: Bump versin number 2022-03-18 09:01:21 +01:00
Adrian Rumpold
c1b7b16251 fix: Update div IDs to mnatch new page structure 2022-03-18 09:00:15 +01:00
Adrian Rumpold
e6c2644ea5 chore: Dependency updates 2022-03-18 08:59:53 +01:00
Adrian Rumpold
fc5f6e7c93 Merge pull request #11 from AdrianoKF/10-negative-first-vaccination-doses
Fix for negative number of first vaccination doses
2021-11-11 19:56:00 +01:00
Adrian Rumpold
fa052cdfc9 chore: Bump version number for release 2021-11-11 19:51:26 +01:00
Adrian Rumpold
f6f799e85f fix(crawler): Fix invalid calculation of number of first vaccinations
Numbers for second shot are actually inclusive of booster
shots, so booster shots do not
have to be subtracted from the
total number of vaccinations.

Fixes #10.
2021-11-11 19:50:44 +01:00
5 changed files with 587 additions and 474 deletions

View File

@@ -16,7 +16,7 @@ from .crawler import CovidCrawler
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
__version__ = "0.1.0" __version__ = "1.3.0"
PLATFORMS = ["sensor"] PLATFORMS = ["sensor"]

View File

@@ -109,7 +109,7 @@ class CovidCrawler(CovidCrawlerBase):
) )
soup = await self._fetch(url) soup = await self._fetch(url)
match = soup.find(id="c1067628") match = soup.find(id="c1075340")
text = match.text.strip() text = match.text.strip()
_log.debug(f"Infection data text: {text}") _log.debug(f"Infection data text: {text}")
@@ -167,9 +167,9 @@ class CovidCrawler(CovidCrawlerBase):
result = soup.find(id=container_id) result = soup.find(id=container_id)
text = re.sub(r"\s+", " ", result.text) text = re.sub(r"\s+", " ", result.text)
regexes = [ regexes = [
r"(?P<total_vaccinations>\d+([.]\d+)?) Personen in Augsburg mindestens", r"(?P<total_vaccinations>\d+([.]\d+)?) Personen in Augsburg",
r"(?P<num_vaccinated_full>\d+([.]\d+)?) Personen sind mindestens zweimal geimpft", r"(?P<num_vaccinated_full>\d+([.]\d+)?) Personen in Augsburg",
r"(?P<num_vaccinated_booster>\d+([.]\d+)?) Personen haben eine Auffrischungsimpfung", r"(?P<num_vaccinated_booster>\d+([.]\d+)?) Personen, also",
] ]
values = {} values = {}
for r in regexes: for r in regexes:
@@ -187,8 +187,8 @@ class CovidCrawler(CovidCrawlerBase):
if not matches: if not matches:
raise ValueError(f"Could not extract date from scraped web page, {text=}") raise ValueError(f"Could not extract date from scraped web page, {text=}")
values["num_vaccinated_once"] = values["total_vaccinations"] - ( values["num_vaccinated_once"] = (
values["num_vaccinated_full"] + values["num_vaccinated_booster"] values["total_vaccinations"] - values["num_vaccinated_full"]
) )
values["date"] = parse_date(**matches.groupdict()).strftime("%Y-%m-%d") values["date"] = parse_date(**matches.groupdict()).strftime("%Y-%m-%d")

View File

@@ -1,11 +1,15 @@
{ {
"domain": "covid19_augsburg", "domain": "covid19_augsburg",
"name": "COVID-19 Augsburg", "name": "COVID-19 Augsburg",
"version": "1.2.0", "version": "1.3.0",
"config_flow": true, "config_flow": true,
"documentation": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg", "documentation": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg",
"issue_tracker": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg/issues", "issue_tracker": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg/issues",
"requirements": ["beautifulsoup4==4.8.2"], "requirements": [
"dependencies": [], "beautifulsoup4==4.8.2"
"codeowners": ["@AdrianoKF"] ],
} "dependencies": [],
"codeowners": [
"@AdrianoKF"
]
}

1021
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "home_assistant_covid19_augsburg" name = "home_assistant_covid19_augsburg"
version = "0.1.0" version = "1.3.0"
description = "" description = ""
authors = ["Adrian Rumpold <a.rumpold@gmail.com>"] authors = ["Adrian Rumpold <a.rumpold@gmail.com>"]
packages = [ packages = [