While we all wait for the 70% (80%?) mark to leave our homes again - I thought I would add the stats to our Home Assistant dashboard so we can see New South Wales’ progress.
NSW Health does not publish this data in a consumable fashion, so this is using screen scraping - unless somebody can think of a better source for the data.
Thank you @bacco007 - this page had a heap of json embedded in it - a whole heap of the data doesn’t need to be scraped any more. The only problem seems to be the json files are also manually generated, as they have some still old data (not yet up to date)
@troykelly FYI - I updated to your latest version (using HA OS) - and it wont install, because for some reason (not your fault), jq wont install in the HA OS environment
2021-08-05 19:20:04 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package nswcovid==0.1.1: ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp9efru0iy
cwd: /tmp/pip-install-2ucy353_/jq
Complete output (7 lines):
running bdist_wheel
running build
running build_ext
Downloading https://github.com/kkos/oniguruma/releases/download/v6.9.4/onig-6.9.4.tar.gz
Downloaded https://github.com/kkos/oniguruma/releases/download/v6.9.4/onig-6.9.4.tar.gz
Executing: ./configure CFLAGS=-fPIC --prefix=/tmp/pip-install-2ucy353_/jq/_deps/onig-install-6.9.4
error: [Errno 13] Permission denied: './configure'
----------------------------------------
ERROR: Failed building wheel for jq
ERROR: Could not build wheels for jq which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.2.4; however, version 21.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
Anyway - I learned a new thing - jello - and it’s made it faster than using jq externally.
I just need something to parse a search - because I’m lazy and I’ve built this to be generic so I can change it as they change their pages. I load a data file and then get the relevant data sources, be they HTML, json or text and then search away…