Skip to content

Conversation

@Ndrinta
Copy link

@Ndrinta Ndrinta commented Sep 22, 2025

Hi, this adds the option to go "bidirectionally" CV and CCW from the top ('0').
To use, simply add the option bar_mode: bidirectional (or "normal" for default behavior).
Backwards compatible because if unused it defaults using the "normal" mode, hence nothing changes for uninterested users.

      // Bidirectional: zero at top, positive CW, negative CCW
      // Assume min < 0 < max

I've been testing this for about 6 months now and seems stable.

@Ndrinta
Copy link
Author

Ndrinta commented Sep 22, 2025

Usage example:
image

type: custom:flex-horseshoe-card
view_layout:
  grid-area: block1
entities:
  - entity: sensor.grid_ct_w
    decimals: 0
    unit: W
    name: GRID
  - entity: sensor.grid_daily
    decimals: 1
    unit: kWh
    icon: mdi:transmission-tower-export
  - entity: sensor.feed_in_energy_today
    decimals: 1
    unit: kWh
    icon: mdi:transmission-tower-import
show:
  horseshoe_style: colorstopgradient
layout:
  hlines:
    - id: 0
      xpos: 50
      ypos: 42
      length: 40
      styles:
        - stroke: grey;
        - stroke-width: 5;
        - stroke-linecap: round;
        - opacity: 0.7;
  states:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 34
      styles:
        - font-size: 3em;
    - id: 1
      entity_index: 1
      xpos: 40
      ypos: 57
      styles:
        - text-anchor: start;
        - font-size: 1.7em;
    - id: 2
      entity_index: 2
      xpos: 40
      ypos: 72
      styles:
        - text-anchor: start;
        - font-size: 1.7em;
  icons:
    - id: 0
      entity_index: 1
      xpos: 37
      ypos: 57
      align: end
      size: 1.3
    - id: 1
      entity_index: 2
      xpos: 37
      ypos: 72
      align: end
      size: 1.3
  names:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 95
horseshoe_scale:
  min: -6500
  max: 6500
  color: lightgrey
bar_mode: bidirectional
color_stops:
  "0": var(--energy-grid-consumption-color)
  "100": var(--energy-grid-return-color)

@meizenga
Copy link

meizenga commented Oct 4, 2025

this is what we're looking for to support grid/battery consumption/production using a single entity which also has negative values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants