Giter Club home page Giter Club logo

home-assistant-covid19-augsburg's Introduction

Home Assistant Augsburg COVID-19 Tracker Integration

Adding to your dashboard

You can add an overview of the current infection and vaccination numbers to your dashboard using the multiple-entity-row card:

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
  - type: custom:multiple-entity-row
    entity: sensor.covid_19_vaccinations_augsburg
    entities:
      - attribute: ratio_vaccinated_once
        name: Once
        format: precision1
        unit: '%'
      - attribute: ratio_vaccinated_full
        name: Fully
        format: precision1
        unit: '%'
      - attribute: ratio_vaccinated_total
        name: Total
        format: precision1
        unit: '%'
    show_state: false
    icon: mdi:needle
    name: COVID-19 Vaccinations
    secondary_info:
      attribute: date
      format: date

home-assistant-covid19-augsburg's People

Contributors

adrianokf avatar

Stargazers

 avatar

Watchers

 avatar

home-assistant-covid19-augsburg's Issues

Parsing incidence data fails when for integer values without decimals

Parsing the scraped incidence data fails with an exception if the incidence value is a round integer without decimals, probably due to a regexp expecting the decimal separator and one or more decimal places.


Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/adriano/projects/home-assistant-covid19-augsburg/custom_components/home_assistant_covid19_augsburg/main.py", line 16, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/adriano/projects/home-assistant-covid19-augsburg/custom_components/home_assistant_covid19_augsburg/main.py", line 6, in main
    result = await crawler.crawl_incidence()
  File "/home/adriano/projects/home-assistant-covid19-augsburg/custom_components/home_assistant_covid19_augsburg/crawler.py", line 126, in crawl_incidence
    raise ValueError(f"Could not extract date from scraped web page, {text=}")
ValueError: Could not extract date from scraped web page, text='\n\t\t\t\t7-Tage-Inzidenz Stadt Augsburg\n\t\t\t'

Replace deprecatedd entity property device_state_attributes

The device_state_attributes entity property was renamed to
extra_state_attributes, using the old name produces a warning
when the integration is loaded by HA:

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:601
First occurred: 11:30:25 AM (2 occurrences)
Last logged: 11:30:25 AM

Entity sensor.coronavirus_augsburg (<class 'custom_components.covid19_augsburg.sensor.CoronaAugsburgSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.covid_19_vaccinations_augsburg (<class 'custom_components.covid19_augsburg.sensor.CoronaAugsburgVaccinationSensor'>) implements device_state_attributes. Please report it to the custom component author.

Cannot parse current infection data

Probably due to a change in the scraped infection data web page.


Home Assistant error details:

Logger: custom_components.covid19_augsburg
Source: custom_components/covid19_augsburg/crawler.py:126
Integration: COVID-19 Augsburg (documentation, issues)
First occurred: September 16, 2021, 11:54:06 AM (21 occurrences)
Last logged: 7:54:07 AM

Unexpected error fetching covid19_augsburg data: Could not extract date from scraped web page, text='\n\t\t\t\t7-Tage-Inzidenz Stadt Augsburg\n\t\t\t'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/covid19_augsburg/__init__.py", line 73, in async_get_data
    "incidence": await crawler.crawl_incidence(),
  File "/config/custom_components/covid19_augsburg/crawler.py", line 126, in crawl_incidence
    raise ValueError(f"Could not extract date from scraped web page, {text=}")
ValueError: Could not extract date from scraped web page, text='\n\t\t\t\t7-Tage-Inzidenz Stadt Augsburg\n\t\t\t'

[Parser] Support new vaccination report format

The format used to report vaccination data on the Augsburg city website has changed:

  • Number of once-vaccinated people no longer directly reported
  • Added number of booster shots
  • Wording changed
  • Base city population changed to 298014

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.