Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: allow template on graph_span #344

Closed
Mariusthvdb opened this issue Jun 2, 2022 · 4 comments
Closed

FR: allow template on graph_span #344

Mariusthvdb opened this issue Jun 2, 2022 · 4 comments
Labels
feature-request New feature or request Stale

Comments

@Mariusthvdb
Copy link

Mariusthvdb commented Jun 2, 2022

Checklist

  • [X ] I am running the latest version of the card
  • [ X] I checked if there isn't another feature request opened with the same request
  • [X ] I checked that the feature is not already available in the dev branch

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

using a template in the graph_span field yields:
Schermafbeelding 2022-06-02 om 09 51 24

Describe the solution you'd like
A clear and concise description of what you want to happen.

would love to natively be able to do:

graph_span: >
  [[[ states['input_select.apex_span'].state; ]]]

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
currently do:

type: custom:config-template-card
entities:
  - input_select.apex_span
variables:
  span: states['input_select.apex_span'].state
card:

  type: custom:apexcharts-card
  graph_span: ${span}

Additional context
Add any other context or screenshots about the feature request here.

even though

        graph_span: >
          [[[
            switch (states['input_select.ui_pool_select_measure_period'].state) {
              case "Mois":
                return "4w";
                break
              case "Semaine":
                return "1w";
                break;
              case "Jour":
                return "1d";
                break;
            }
          ]]]

was posted and apparently used in a valid card config

more-info: https://community.home-assistant.io/t/apexcharts-card-a-highly-customizable-graph-card/272877/1639

my card: https://community.home-assistant.io/t/apexcharts-card-a-highly-customizable-graph-card/272877/1495

my input_select holds the correct options:

Schermafbeelding 2022-06-02 om 09 52 28

Schermafbeelding 2022-06-02 om 10 23 58

Schermafbeelding 2022-06-02 om 10 24 14

full working card config:

type: entities
title: 'Energie: verbruik - levering'
card_mod:
  style: |
    .card-header {
      font-weight: 400;
      font-size: 20px;
      color: {% if states('sensor.netto_verbruik')|int(default=0) < 0 %} var(--primary-color)
             {% else %} var(--text-color-off)
            {% endif %};
      padding: 0px 12px;
      margin: 0px 0px 16px 0px;
      background: {% if states('sensor.netto_verbruik')|int(default=0) < 0 %} gold
                  {% else %} var(--background-color-off)
                  {% endif %};
    }
entities:
  - type: custom:hui-element
    card_type: glance
    card_mod: &mod
      style: |
        ha-card {
          box-shadow: none;
          margin: -8px -16px 0px -16px;
        }
    entities:
      - sensor.levering_of_verbruik
      - entity: sensor.calculated_bruto_verbruik
        name: Bruto verbruik
      - entity: sensor.zp_actuele_opbrengst
        name: Solar production

  - !include /config/lovelace/includes/include_verbruik_actueel_apex.yaml
  - entity: input_select.apex_span

and ofc the include_verbruik_actueel_apex.yaml:

type: custom:config-template-card
entities:
  - input_select.apex_span
variables:
  span: states['input_select.apex_span'].state
card:

  type: custom:apexcharts-card
  card_mod:
    style: |
      ha-card {
        box-shadow: none;
        margin: -8px -16px -16px -16px;
        padding: 0;
      }
  #header:
  #  title: Verbruik actueel
  update_interval: 1min
  graph_span: ${span}
  series:
    - entity: sensor.zp_actuele_opbrengst
      color: gold
      type: area
      name: Zon
      stroke_width: 3
      opacity: 0.5
    - entity: sensor.calculated_bruto_verbruik
      color: darkblue
      name: Verbruik
      group_by:
        func: avg
        duration: 2min
      stroke_width: 1
    - entity: sensor.netto_verbruik
      color: lightblue
      type: area
      name: Vermogen
      group_by:
        func: avg
        duration: 2min
      stroke_width: 3
      opacity: 0.5
@Mariusthvdb Mariusthvdb added the feature-request New feature or request label Jun 2, 2022
@Mariusthvdb Mariusthvdb changed the title FRL allow template on graph_span FR: allow template on graph_span Jun 2, 2022
@github-actions
Copy link

github-actions bot commented Jul 3, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Jul 3, 2022
@Mariusthvdb
Copy link
Author

Keep open

@github-actions github-actions bot removed the Stale label Jul 4, 2022
@github-actions
Copy link

github-actions bot commented Aug 3, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Aug 3, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 10 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request Stale
Projects
None yet
Development

No branches or pull requests

1 participant