Repository: JonahKr/power-distribution-card
Branch: master
Commit: a0c826b085c1
Files: 53
Total size: 151.4 KB
Directory structure:
gitextract_bav71kz2/
├── .github/
│ └── workflows/
│ ├── build.yaml
│ └── release.yaml
├── .gitignore
├── .prettierrc.js
├── .vscode/
│ └── settings.json
├── LICENSE
├── README.md
├── eslint.config.mjs
├── hacs.json
├── package.json
├── rollup.config.mjs
├── src/
│ ├── action-handler.ts
│ ├── card-tags.ts
│ ├── deep-equal.ts
│ ├── editor/
│ │ ├── bar-editor.ts
│ │ ├── editor.ts
│ │ ├── ha-form.ts
│ │ ├── item-editor.ts
│ │ └── items-editor.ts
│ ├── localize/
│ │ ├── languages/
│ │ │ ├── de.json
│ │ │ ├── en.json
│ │ │ └── sk.json
│ │ └── localize.ts
│ ├── power-distribution-card.ts
│ ├── presets.ts
│ ├── styles.ts
│ ├── types.ts
│ └── utils/
│ ├── compute-color.ts
│ ├── create-thing.ts
│ ├── custom-cards.ts
│ ├── debounce.ts
│ ├── get-lovelace.ts
│ ├── ha-component-loader.ts
│ ├── hass-types/
│ │ ├── action.ts
│ │ ├── action_handler.ts
│ │ ├── event.ts
│ │ ├── fire_event.ts
│ │ ├── format-number.ts
│ │ ├── get_main_window.ts
│ │ ├── handle-action.ts
│ │ ├── haptics.ts
│ │ ├── has-action.ts
│ │ ├── homeassistant.ts
│ │ ├── integration.ts
│ │ ├── localize.ts
│ │ ├── lovelace.ts
│ │ ├── navigate.ts
│ │ ├── show-dialog-box.ts
│ │ ├── show-ha-voice-command-dialog.ts
│ │ ├── toast.ts
│ │ └── toggle-entity.ts
│ └── index.ts
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/build.yaml
================================================
name: "Build"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Test build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v4
with:
version: latest
- name: Build
run: |
pnpm install
pnpm run build
================================================
FILE: .github/workflows/release.yaml
================================================
name: Release
on:
release:
types: [published]
jobs:
release:
name: Prepare release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v4
with:
version: latest
#Building the Js-File
- name: Build the file
run: |
pnpm install
pnpm run build
# Upload build file to the releas as an asset.
- name: Upload zip to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/power-distribution-card/power-distribution-card/dist/power-distribution-card.js
asset_name: power-distribution-card.js
tag: ${{ github.ref }}
overwrite: true
================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
================================================
FILE: .prettierrc.js
================================================
module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
endOfLine: 'auto',
};
================================================
FILE: .vscode/settings.json
================================================
{
"typescript.tsdk": "node_modules/typescript/lib"
}
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2025 JonahKr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# power-distribution-card
[](https://github.com/JonahKr/power-distribution-card/blob/master/package.json)
[](https://github.com/JonahKr/power-distribution-card/actions)
[](https://img.shields.io/github/license/JonahKr/power-distribution-card/blob/master/LICENSE)
[](https://github.com/custom-components/hacs)
|
|
|
|
|
|
|
|
|
|
|
| battery | car_charger | consumer | grid | home | hydro | pool | producer | solar | wind | heating |
| Any Home Battery e.g. E3dc, Powerwall | Any Electric Car Charger | A custom home power consumer | The interface to the power grid | Your Home's power consumption | Hydropower setup like Turbulent | pool heater or pump | custom home power producer | Power coming from Solar | Power coming from Wind | Radiators |
This could look something like: ```yaml entities: - decimals: 2 display_abs: true name: battery unit_of_display: W consumer: true icon: 'mdi:battery-outline' producer: true entity: sensor.e3dc_battery preset: battery icon_color: bigger: 'green' equal: '' smaller: 'red' ```
If one of those presets is selected there will be additional options in the visual editor.
If you prefer yaml, here are all extra options which can be set per item:
| Setting | type | example | description |
| --------------------------- |:-------------:|:----------------------------:| :------------|
| `battery_percentage_entity` | string | sensor.xyz | Sensor containing the battery charge percentage from 0 to 100 |
| `grid_buy_entity` | string | sensor.xyz | Sensor containing the imported power from the grid |
| `grid_sell_entity` | string | sensor.xyz | Sensor containing the sold power towards the grid |
${secondary_info}
` : null}${displayName}
`}${NanFlag ? `` : formatValue} ${NanFlag ? `` : unit_of_display}
${!item.hide_arrows ? this._render_arrow( //This takes the side the item is on (index even = left) into account for the arrows value == 0 || NanFlag ? 'none' : index % 2 == 0 ? state > 0 ? 'right' : 'left' : state > 0 ? 'left' : 'right', arrow_color, ) : html`` }