# reptilex/tesla-style-solar-power-card architecture

> Architecture diagram of the GitHub repository reptilex/tesla-style-solar-power-card, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reptilex/tesla-style-solar-power-card
- Repository: https://github.com/reptilex/tesla-style-solar-power-card

## Overview

This is a Home Assistant Lovelace solar-power visualization card. Home Assistant supplies configured sensor states to the card; the card computes grid, generation, house, battery, and optional appliance values, then renders bubbles and energy-flow paths, with animation and responsive resizing. The editor and localization support configuration and presentation. Relationships involving unsampled implementation details are omitted or marked unverified; the graph does not treat build or test tooling as product components.

Main entry points: [`src/TeslaStyleSolarPowerCard.ts`](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/TeslaStyleSolarPowerCard.ts) (Solar Power Card), [`src/components/editor.ts`](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/components/editor.ts) (Card Editor), [`src/models/TeslaStyleSolarPowerCardConfig.ts`](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/TeslaStyleSolarPowerCardConfig.ts) (Card Configuration), [`src/models/SensorElement.ts`](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/SensorElement.ts) (Sensor State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_card["Card Runtime"]
  node_card_runtime["Solar Power Card"]
  node_config_model["Card Configuration"]
  node_sensor_element["Sensor State<br/>[SensorElement.ts]"]
  node_bubble_data["Bubble Values<br/>[BubbleData.ts]"]
end

subgraph group_presentation["Visualization"]
  node_html_writer["Bubble and Line Writer"]
  node_resize["Responsive Layout"]
end

subgraph group_configuration["Configuration"]
  node_editor["Card Editor<br/>[editor.ts]"]
  node_localization["Localization<br/>[localize.ts]"]
end

node_ha(("Home Assistant"))
node_sensor_inputs[("Configured Sensors")]

node_ha -->|"hosts card"| node_card_runtime
node_sensor_inputs -->|"provides flows"| node_card_runtime
node_card_runtime -->|"tracks sensors"| node_sensor_element
node_card_runtime -->|"calculates bubbles"| node_bubble_data
node_card_runtime -.->|"renders visualization"| node_html_writer
node_card_runtime -->|"resizes layout"| node_resize
node_editor -->|"edits settings"| node_config_model
node_ha -->|"configures card"| node_editor
node_card_runtime -->|"uses translations"| node_localization

click node_card_runtime "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/TeslaStyleSolarPowerCard.ts"
click node_config_model "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/TeslaStyleSolarPowerCardConfig.ts"
click node_sensor_element "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/SensorElement.ts"
click node_bubble_data "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/BubbleData.ts"
click node_html_writer "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/services/htmlWriterForPowerCard.ts"
click node_resize "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/services/HtmlResizeForPowerCard.ts"
click node_editor "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/components/editor.ts"
click node_localization "https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/localize/localize.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_card_runtime,node_config_model,node_sensor_element,node_bubble_data toneBlue
class node_html_writer,node_resize,node_sensor_inputs toneAmber
class node_editor,node_localization toneMint
class node_ha toneIndigo
```

## Components

### Card Runtime

- [Solar Power Card](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/TeslaStyleSolarPowerCard.ts): `src/TeslaStyleSolarPowerCard.ts`
- [Card Configuration](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/TeslaStyleSolarPowerCardConfig.ts): `src/models/TeslaStyleSolarPowerCardConfig.ts`
- [Sensor State](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/SensorElement.ts): `src/models/SensorElement.ts`
- [Bubble Values](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/models/BubbleData.ts): `src/models/BubbleData.ts`

### Visualization

- [Bubble and Line Writer](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/services/htmlWriterForPowerCard.ts): `src/services/htmlWriterForPowerCard.ts`
- [Responsive Layout](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/services/HtmlResizeForPowerCard.ts): `src/services/HtmlResizeForPowerCard.ts`

### Configuration

- [Card Editor](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/components/editor.ts): `src/components/editor.ts`
- [Localization](https://github.com/reptilex/tesla-style-solar-power-card/blob/master/src/localize/localize.ts): `src/localize/localize.ts`

### Other components

- **Home Assistant**
- **Configured Sensors**

## Connections

- Home Assistant → Solar Power Card: hosts card (evidence: `README.md`)
- Configured Sensors → Solar Power Card: provides flows (evidence: `README.md`)
- Solar Power Card → Sensor State: tracks sensors (evidence: `src/TeslaStyleSolarPowerCard.ts`)
- Solar Power Card → Bubble Values: calculates bubbles (evidence: `src/TeslaStyleSolarPowerCard.ts`)
- Solar Power Card → Bubble and Line Writer: renders visualization (evidence: `src/services/htmlWriterForPowerCard.ts`)
- Solar Power Card → Responsive Layout: resizes layout (evidence: `src/services/HtmlResizeForPowerCard.ts`)
- Card Editor → Card Configuration: edits settings (evidence: `src/components/editor.ts`)
- Home Assistant → Card Editor: configures card (evidence: `src/components/editor.ts`)
- Solar Power Card → Localization: uses translations (evidence: `src/TeslaStyleSolarPowerCard.ts`)
