wernerhp / ha.integration.load_shedding

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

Dashboard Cards #13

Open paulbalinnel opened 2 years ago

paulbalinnel commented 2 years ago

I am so grateful for this integration! thank you!!

My landing page in HA has loadshedding stage info, however I would like to add a button next to the stage loadshedding at top with the secondary info from the schedule? any idea how to

Screenshot 2022-07-07 at 11 42 17 Screenshot 2022-07-07 at 11 35 35

?

wernerhp commented 2 years ago

A button? Why a button? Where now? I'm not sure I understand what you mean. Please rephrase and draw exactly what you want and I can see if I can help.

cliffordwhansen commented 2 years ago

I think I get what @paulbalinnel wants.

Firstly install browser-mod (https://github.com/thomasloven/hass-browser_mod) And then (from his screen shot assuming mushroom) something like the following:

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: sensor.load_shedding_stage
    use_entity_picture: false
    tap_action:
      action: fire-dom-event
      browser_mod:
        command: popup
        deviceID: this
        title: Schedule
        card:
          type: markdown
          content: >
            {% set schedules = state_attr("sensor.load_shedding_parklands",
            "schedule") %} <table width="100%">
              <tbody>
              <tr>
                <td width="10%"><ha-icon icon="mdi:calendar"></ha-icon></td>
                <td align="left"><strong>Schedule</strong></td>
                <td align="right"></td>
              </tr>
              {% for s in schedules[:3] %}
              <tr>
                <td></td>
                <td width="50%" align="left">{{ as_timestamp(s.start_time | as_datetime) | timestamp_custom("%-d %B %Y", True) }}</td>
                <td width="100%" align="right">{{ as_timestamp(s.start_time | as_datetime) | timestamp_custom("%H:%M", True) }} - {{ as_timestamp(s.end_time | as_datetime) | timestamp_custom("%H:%M", True) }}</td>
              </tr>
              {% endfor %}
              </tbody>
            </table>
paulbalinnel commented 2 years ago

hallo, i been away from my machine, i see there some replies!!! thank you I will try explain it better.

Instead of a button I meant a card (mushroom-chip) showing the time to and/or time left to start or end of load shedding, just as info. The secondary info on your schedule, alone displayed. I want to isolate the secondary info to use it elsewhere.

cliffordwhansen commented 2 years ago

Something like this:

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: sensor.load_shedding_stage
  - type: template
    entity: sensor.load_shedding_stage
    content: |-
      {% if states("sensor.load_shedding_parklands") == "off" %} Starts in
                {{ timedelta(minutes=state_attr("sensor.load_shedding_parklands",
                "starts_in")) }} {% else %}  Ends in {{
                timedelta(minutes=state_attr("sensor.load_shedding_parklands",
                "ends_in")) }} {% endif %}

image

If you then add the on_tap action from my previous example you can get a popup with the schedule aswell ;-)

paulbalinnel commented 2 years ago
Screenshot 2022-07-08 at 12 11 45

LOOK HOW AMAZING!!! THANK YOU!!!!