wernerhp / ha.integration.load_shedding

A Home Assistant integration to track your load schedding schedule.
MIT License
113 stars 21 forks source link

ESP status bar view #72

Closed jpmeijers closed 12 months ago

jpmeijers commented 1 year ago

The ESP details page looks like this

I would like to make this a bit more compact and only show the status bars as a card on a lovelace dashboard, something like this:

Does anyone know how to do this?

ribeirompl commented 1 year ago

I got a bit nerd-sniped yesterday evening, thus I tried implementing the ESP design using HTML/CSS/Jinja template with the custom Lovelace HTML Jinja2 Template card.

Preview

Dark Mode Light Mode
Dark Mode Light Mode Limitations
The card determines the dark/light mode based on your device's dark mode settings (not your Home Assistant profile settings), thus the card might pick the wrong dark/light mode if your Home Assistant profile is set to a different dark/light mode than your device. The ESP API, along with this integration, only provides load-shedding schedules for future events, therefore this card won't show events that happened earlier in the day. I decided then to fade out old time slots to not deceive the user that there weren't any outages earlier in the day.
ESP Design This Design
Installation
1. Install the [Lovelace HTML Jinja2 Template card](https://github.com/PiotrMachowski/Home-Assistant-Lovelace-HTML-Jinja2-Template-card), searchable within HACS -> Frontend. 2. Create a new "Manual" (YAML) card on your dashboard. 3. Copy the template code from the [examples/dashboards/esp_status_bar.yaml](https://github.com/wernerhp/ha.integration.load_shedding/blob/master/examples/dashboards/esp_status_bar.yaml) file into the card. 4. Edit the 4 variables at the top of the content section: - area_sensor (sensor): this should be the sensor for your load-shedding area. - number_of_days (1-7): set how many days of the forecast you'd like to see. - show_day_borders (true/false): aesthetic option, if you'd like borders around each day. - show_end_times (true/false): whether to show the load shedding end times. (This removes the "Now" text).
jpmeijers commented 1 year ago

O wow this is really amazing! Thanks a lot @ribeirompl. Shout when you're in town and I'll buy you a beer/coffee.

image

wernerhp commented 1 year ago

Brilliant! Great job @ribeirompl! Thank you for sharing!

wernerhp commented 12 months ago

https://github.com/wernerhp/ha.integration.load_shedding/blob/master/examples/card5.yaml

Viva57 commented 10 months ago

@ribeirompl Thanks for this card. It's such a nice addition to my dashboard!

I recently started getting an error with this card though. From my logs: Error while processing template. Apart from updating my home assistant to the latest version, nothing changed on my side.

Do you perhaps experience the same issue?


Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render render_result = _render_with_context(self.template, compiled, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2231, in _render_with_context return template.render(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "