Just a nice project for the sunday afternoon: your current book as an image on your dashboard. Or the current book your partner is reading, or…
It’s based on a Scrape Sensor, the Downloader component, an automation and the Markdown Card for Lovelace.
For Dutchies only, as it requires an active (free) subscription on this Dutch readers site:
The configuration in configuration.yaml
:
downloader:
download_dir: "www/downloads"
Be sure to create both folders manually. The
www
folder should be inside your configuration folder.
Also create a subfolderhebban
in thedownloads
folder.
The config of the sensor:
- platform: scrape
resource: https://www.hebban.nl/Work/more?filter=shelf&sort=new&user=YOURUSERNUMBERHERE&shelf=reading&offset=0&step=20&context=shelf_reading
scan_interval: 7200
name: Xxx is reading
select: 'img'
attribute: 'src'
value_template: >-
{{ value | replace('\\\"', '') | replace('\\', '') }}
Replace YOURUSERNUMBERHERE
with your user number at Hebban. You can figure it out when you check the url of the XHR request this page is doing to the backend of Hebban (when logged in).
Replace every
xxx
andXxx
with a name preferably only AFTER all things work successfully! (Be sure to use lowercase and underscores when replacingxxx
, e.g.my_beautiful_name
. You can replaceXxx
with e.g.My Beautiful Name
.)
The config of the automation:
- alias: hebban_change_xxx_is_reading
trigger:
platform: state
entity_id: sensor.xxx_is_reading
action:
- service: downloader.download_file
data_template:
url: >-
{{ states("sensor.xxx_is_reading") }}
subdir: hebban
filename: xxx_is_reading.jpg
overwrite: true
The configuration for the cards:
in Lovelace:
- type: markdown
title: Xxx is reading
content: >-
![image](/local/downloads/hebban/xxx_is_reading.jpg "Xxx is reading")
Restart HA. And have fun.