Compare commits
2 Commits
d7a2705fc2
...
v1.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28eb982e5e | ||
|
|
6a03aba4e9 |
26
README.md
26
README.md
@@ -1,5 +1,27 @@
|
|||||||
# Home Assistant Augsburg COVID-19 Tracker Integration
|
# Home Assistant Augsburg COVID-19 Tracker Integration
|
||||||
|
|
||||||
## Requirements
|
## Adding to your dashboard
|
||||||
|
|
||||||
Your system needs to have the `de_DE.utf8` locale installed in order to parse the dates from the scraped web response.
|
You can add an overview of the current infection numbers to your dashboard using the [multiple-entity-row](https://github.com/benct/lovelace-multiple-entity-row) card:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
type: entities
|
||||||
|
entities:
|
||||||
|
- type: custom:multiple-entity-row
|
||||||
|
entity: sensor.coronavirus_augsburg
|
||||||
|
entities:
|
||||||
|
- attribute: total_cases
|
||||||
|
name: Cases
|
||||||
|
- attribute: num_dead
|
||||||
|
name: Deaths
|
||||||
|
- attribute: num_recovered
|
||||||
|
name: Recovered
|
||||||
|
- attribute: num_infected
|
||||||
|
name: Infected
|
||||||
|
show_state: false
|
||||||
|
icon: mdi:biohazard
|
||||||
|
name: COVID-19
|
||||||
|
secondary_info:
|
||||||
|
attribute: incidence
|
||||||
|
unit: cases/100k
|
||||||
|
```
|
||||||
|
|||||||
@@ -67,15 +67,17 @@ class CovidCrawler(CovidCrawlerBase):
|
|||||||
|
|
||||||
matches = re.search(r"(\d+,\d+)\sNeuinfektion", text)
|
matches = re.search(r"(\d+,\d+)\sNeuinfektion", text)
|
||||||
if not matches:
|
if not matches:
|
||||||
raise ValueError("Could not extract incidence from scraped web page")
|
raise ValueError(
|
||||||
|
f"Could not extract incidence from scraped web page, {text=}"
|
||||||
|
)
|
||||||
|
|
||||||
incidence = parse_num(matches.group(1), t=float)
|
incidence = parse_num(matches.group(1), t=float)
|
||||||
_log.debug(f"Parsed incidence: {incidence}")
|
_log.debug(f"Parsed incidence: {incidence}")
|
||||||
|
|
||||||
text = match.h2.text
|
text = match.h2.text
|
||||||
matches = re.search(r"\((\d+)\. (\w+)\)", text)
|
matches = re.search(r"\((\d+)\. (\w+).*\)", text)
|
||||||
if not matches:
|
if not matches:
|
||||||
raise ValueError("Could not extract date from scraped web page")
|
raise ValueError(f"Could not extract date from scraped web page, {text=}")
|
||||||
|
|
||||||
months = [
|
months = [
|
||||||
"Januar",
|
"Januar",
|
||||||
|
|||||||
Reference in New Issue
Block a user