-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* got most of the things I want working to work * set line paths back to original settings * remove carbon stuffs * create some reusable code and add battery to home * simplify naming and create reusable function for getting a number to a single fractional digit * set animation duration to 3s until I can find a nice calculation * add grid to home circle * do actual rounding instead of just formating * ensure hass exists * huge refactor to go to from 7 entities to 4 * a decent duration calc * always show in/out values on battery and grid * implement home circumference border * remove battery to grid line * circle rate tweaks * move each line/circle flow into it's own svg * centralize duration calculations * fix type in flow id * smooth out duration changes * add some workflows and hacs stuff * remove hacs integration validation * fix yaml typo * Add build script * add readme * add description and keywords * update hacs file * add more scripts * add semantic-release * Update README.md
- Loading branch information
Showing
13 changed files
with
2,129 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache pnpm modules | ||
id: cache-modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.pnpm-store | ||
**/node_modules | ||
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'rollup.config.js') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: latest | ||
run_install: false | ||
|
||
- name: Install Packages | ||
if: steps.cache-modules.outputs.cache-hit != 'true' | ||
run: pnpm install | ||
|
||
- name: Build | ||
run: pnpm build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
release-bundle: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' | ||
|
||
outputs: | ||
new_release_published: ${{ steps.semantic.outputs.new_release_published }} | ||
new_release_version: ${{ steps.semantic.outputs.new_release_version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache pnpm modules | ||
id: cache-modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.pnpm-store | ||
**/node_modules | ||
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'rollup.config.js') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: latest | ||
run_install: false | ||
|
||
- name: Install Packages | ||
if: steps.cache-modules.outputs.cache-hit != 'true' | ||
run: pnpm install | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
||
- name: Release | ||
run: pnpx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "Semantic PR" | ||
description: Ensure your PR title matches the Conventional Commits spec (https://www.conventionalcommits.org/). | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v4.2.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: HACS Validation | ||
|
||
on: | ||
pull_request: | ||
jobs: | ||
hacs: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Checkout | ||
uses: "actions/checkout@v2" | ||
- name: Validate HACS | ||
uses: "hacs/action@main" | ||
with: | ||
category: "plugin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
branches: ["main", { name: "dev", prerelease: true }], | ||
plugins: [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
assets: ["CHANGELOG.md", "README.md", "package.json", "pnpm-lock.yaml"], | ||
}, | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
assets: "dist/*.js", | ||
}, | ||
], | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Realtime Energy Distribution Card | ||
|
||
This card for [Home Assistant](https://github.com/home-assistant/home-assistant) Dashboard card is designed to mimic the historic distribution card included by Home Assistant. | ||
|
||
The card works with entities from within the **sensor** & **binary_sensor** domain and displays the sensors current state as well as a line graph representation of the history. | ||
|
||
![realtime-distribution-preview](https://user-images.githubusercontent.com/5641964/165636264-dc2e02ed-e550-4167-9ce4-3dcbd7a84272.png) | ||
|
||
## Install | ||
|
||
### HACS (recommended) | ||
|
||
This card is available in [HACS](https://hacs.xyz/) (Home Assistant Community Store). | ||
<small>_HACS is a third party community store and is not included in Home Assistant out of the box._</small> | ||
|
||
### Manual install | ||
|
||
1. Download and copy `realtime-energy-distribution-card.js` from the [latest release](https://github.com/ulic75/realtime-energy-distribution-card/releases/latest) into your `config/www` directory. | ||
|
||
2. Add the resource reference as decribed below. | ||
|
||
### Add resource reference | ||
|
||
If you configure Dashboards via YAML, add a reference to `realtime-energy-distribution-card.js` inside your `configuration.yaml`: | ||
|
||
```yaml | ||
resources: | ||
- url: /local/realtime-energy-distribution-card.js | ||
type: module | ||
``` | ||
Else, if you prefer the graphical editor, use the menu to add the resource: | ||
1. Make sure, advanced mode is enabled in your user profile (click on your user name to get there) | ||
2. Navigate to Configuration -> Dashboards -> Resources Tab. Hit (+ ADD RESOURCE) icon | ||
3. Enter URL `/local/realtime-energy-distribution-card.js` and select type "JavaScript Module". | ||
(Use `/hacsfiles/realtime-energy-distribution-card/realtime-energy-distribution-card.js` and select "JavaScript Module" for HACS install) | ||
4. Restart Home Assistant. | ||
|
||
## Using the card | ||
|
||
We recommend looking at the [Example usage section](#example-usage) to understand the basics to configure this card. | ||
(also) pay attention to the **required** options mentioned below. | ||
|
||
### Options | ||
|
||
#### Card options | ||
|
||
| Name | Type | Default | Description | | ||
| ------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------- | | ||
| type **_(required)_** | string | | `custom:realtime-energy-distribution-card`. | | ||
| entities **_(required)_** | map | | One or more sensor entities in a list, see [entities map](#entities-map) for additional entity options. | | ||
| | | ||
|
||
#### Entities map | ||
|
||
| Name | Unit | Description | | ||
| ------------------------ | :--: | -------------------------------------------------------------------------------------- | | ||
| battery **_(required)_** | kW | Entity providing a positive value when charging and a negative value when discharging. | | ||
| battery_charge | % | Entity providing the current percentage of charge on the battery. | | ||
| grid **_(required)_** | kW | Entity providing a positive value when consuming and a negative value when producting. | | ||
| solar **_(required)_** | kW | Entity providing a value of generation. | | ||
|
||
### Example usage | ||
|
||
```yaml | ||
type: custom:realtime-energy-distribution-card | ||
title: Realtime Distribution | ||
entities: | ||
battery: sensor.powerwall_battery_now | ||
battery_charge: sensor.powerwall_charge | ||
grid: sensor.powerwall_site_now | ||
solar: sensor.powerwall_solar_now | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "realtime-energy-distribution-card", | ||
"render_readme": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.