Last active
May 22, 2020 16:22
-
-
Save krissen/226d7c2570b38fd27cbc49c98514c792 to your computer and use it in GitHub Desktop.
Configuration for differently themed grafana panels (dark/light) that updates automatically according to a light level -sensor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up two cameras, pulling differently themed panels from Grafana | |
# One dark; one light. | |
camera: | |
# Camera-card for dark theme. Note `theme=dark` in the URL. | |
- platform: generic | |
name: Luftfuktighet (mörk) | |
still_image_url: 'http://internal.ip:port/render/d-solo/P_cth9gGz/klimat?orgId=1&refresh=10m&from=now-1d&to=now&panelId=4&theme=dark&width=500&height=325&tz=Europe%2FLondon' | |
username: !secret grafana_user | |
password: !secret grafana_password | |
# Camera-card for light theme. Note `theme=light` in the URL. | |
- platform: generic | |
name: Luftfuktighet (ljus) | |
still_image_url: 'http://internal.ip:port/render/d-solo/P_cth9gGz/klimat?orgId=1&refresh=10m&from=now-1d&to=now&panelId=4&theme=light&width=500&height=325&tz=Europe%2FLondon' | |
username: !secret grafana_user | |
password: !secret grafana_password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up binary sensor, used in the Lovelace conditional card. | |
# You could use sun.angle or whatever instead of sensor.lightlevel. | |
# When the binary sensor is off, light theme is used. | |
# When it is on, dark theme is used. | |
# A similar logic is used for automatically setting dark/light theme | |
# overall in Home assistant. Together, I get a light (or dark) themed | |
# Homeassistant, with grafana panels that fit the theme. | |
binary_sensor: | |
- platform: template | |
sensors: | |
morkare: | |
friendly_name: Light level darker than three | |
# I have a setup with a custom light sensor, | |
# where 0 = daylight and 5 = night. | |
# (Yes, the logic of it can be debated.) | |
value_template: >- | |
{{ states('sensor.lightlevel') | float > 3 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Relevant Lovelace-config for showing one card when it is light | |
# and another for when it is dark. | |
# Camera-card for dark theme | |
- type: conditional | |
conditions: | |
- entity: binary_sensor.morkare | |
state: "off" | |
card: | |
type: picture-entity | |
name: Luftfuktighet | |
entity: camera.luftfuktighet_ljus | |
aspect_ratio: 1.65 | |
show_name: false | |
show_state: false | |
# Camera-card for light theme | |
- type: conditional | |
conditions: | |
- entity: binary_sensor.morkare | |
state: "on" | |
card: | |
type: picture-entity | |
name: Luftfuktighet | |
entity: camera.luftfuktighet_mork | |
aspect_ratio: 1.65 | |
show_name: false | |
show_state: false |
Author
krissen
commented
May 22, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment