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

feat: move to typescript & tidy up some code #56

Merged
merged 44 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
41b8b0e
feat: move to typescript & tidy up some code
marksie1988 Aug 14, 2023
75f763d
refactor: remove show and use 0 instead
marksie1988 Aug 14, 2023
8fb9d99
feat: start localize & change text numbers to numbers
marksie1988 Aug 14, 2023
f46c844
refactor: change yes / no to boolean
marksie1988 Aug 14, 2023
7965f98
chore: add workflows for release notes and release
marksie1988 Aug 14, 2023
4b63aee
chore: add templates
marksie1988 Aug 14, 2023
f2e3673
refactor: added defaults file
marksie1988 Aug 15, 2023
fd5cd88
refactor: add more defaults
marksie1988 Aug 15, 2023
35181d4
refactor: add missing feature from main card
marksie1988 Aug 15, 2023
bdb9f11
feat: add support for lux inverter status
marksie1988 Aug 16, 2023
0e9ee6f
chore: update readme
marksie1988 Aug 16, 2023
74ffe68
chore: remove console.log
marksie1988 Aug 16, 2023
c58cf6c
chore: remove console.log
marksie1988 Aug 16, 2023
e4ad91b
docs: move examples to sphinx docs
marksie1988 Aug 16, 2023
f44f54d
chore: add devcontainer example files
marksie1988 Aug 16, 2023
c4059c4
docs: add devcontainer documentation
marksie1988 Aug 16, 2023
9d538dc
chore: rename file
marksie1988 Aug 16, 2023
550c8cd
Merge branch 'master' into typescript
marksie1988 Aug 16, 2023
2ffcb93
refactor: add more translations, remove unnecissary or statements
marksie1988 Aug 16, 2023
a7beba9
Merge remote-tracking branch 'refs/remotes/origin/typescript' into ty…
marksie1988 Aug 16, 2023
43ef141
Chore: Update readme
slipx06 Aug 16, 2023
8abebdd
feat: add unit of measurement to energy cost
marksie1988 Aug 17, 2023
9bb1fcc
refactor: change default currency measurement to blank
marksie1988 Aug 17, 2023
c7f7d39
feat: clicking additional loads shows more-info dialog for full card
slipx06 Aug 17, 2023
a63117b
refactor: fix types
slipx06 Aug 17, 2023
5f5d8f3
refactor: invert ternary operator to remove negations
marksie1988 Aug 17, 2023
33933ae
chore: update error messages
slipx06 Aug 17, 2023
745f3eb
feat: clicking additional loads shows more-info dialog for lite card
slipx06 Aug 17, 2023
3eedda1
fix: issue when energy_cost is not set
marksie1988 Aug 17, 2023
d9fb819
Merge remote-tracking branch 'refs/remotes/origin/typescript' into ty…
marksie1988 Aug 17, 2023
4db0358
chore: rebuild after changes
marksie1988 Aug 17, 2023
bf59974
refactor: add missing remaining solar
slipx06 Aug 17, 2023
fe5b9ce
chore: rebuild code
marksie1988 Aug 17, 2023
5955630
feat: add daily aux load
slipx06 Aug 17, 2023
93eea98
refactor: fix show_solar error
slipx06 Aug 17, 2023
a9f58bd
fix: remaining_solar conditional check
slipx06 Aug 17, 2023
d6990e4
fix: temperature positioning and styling
slipx06 Aug 17, 2023
29d805c
fix: error messages not functioning as expected
marksie1988 Aug 18, 2023
2021b3c
fix: show_aux not hidden correctly
marksie1988 Aug 18, 2023
775d58a
fix: logic when default value is false
slipx06 Aug 18, 2023
6a16327
docs: update documentation
marksie1988 Aug 18, 2023
8c3fa89
fix: show_solar logic on lite card
slipx06 Aug 18, 2023
f13d4a7
Merge remote-tracking branch 'refs/remotes/origin/typescript' into ty…
marksie1988 Aug 18, 2023
af3edea
chore: update/add docs workflow
marksie1988 Aug 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 38 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Sunsynk-Power-Flow-Card

An animated Home Assistant card to emulate the power flow that's shown on the Sunsynk Inverter screen. You can use this for Deye as well as other Inverters as long as you have the required sensor data. See the [WIKI](https://github.com/slipx06/sunsynk-power-flow-card/wiki) for integration methods and examples.

[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/slipx06/sunsynk-power-flow-card?style=for-the-badge) <a href="https://www.buymeacoffee.com/slipx" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="29" width="120"></a>

## Features

* Option to switch between two card styles: `lite` or `full`.
* Animated power flow based on positive/negative/zero sensor values with configurable dynamic speed. (Supports inverted battery, AUX and grid power).
* Dynamic battery image based on SOC (empty->low->medium->high).
Expand Down Expand Up @@ -84,7 +86,6 @@ The card can be configured through the following attributes:
|colour:| Optional |`grey`| Changes the colour of the inverter. Hex codes (`'#66ff00'` etc) or names (`red`, `green`, `blue` etc) |
|autarky:| Optional| `power`| Display autarky and ratio as a percentage using either realtime power or daily energy values. Set to `no` to hide (`energy/power/no`). <br />Autarky is the percentage of self sufficiency through Home Production. Ratio is the percentage of produced electricity used by the home. <br />It is calculated based on the formula below and borrowed from the [Power Distribution Card](https://github.com/JonahKr/power-distribution-card) <br /><ul><li>Autarky in Percent = Home Production / Home Consumption </li><li>Ratio in Percent = Home Consumption / Home Production</li></ul>|


### Battery

Note that the card will always display batter power as a positive number regardless of your sensor value. The animated dot will change direction depending on the charging or discharging state. The `invert_power` attribute can be used to reverse direction if needed by your sensor.
Expand Down Expand Up @@ -130,6 +131,7 @@ These attributes are only needed if `show_solar` is set to `true`
|aux_type: | Optional | `default` | Changes the AUX image using preset or any mdi icon e.g. `mdi:ev-station`. Presets are: `gen`, `inverter` `default`, `oven`, `pump`, `aircon` and `boiler`.
|aux_colour:| Optional | `the load colour` | Changes the colour of all the AUX card objects. Hex codes (`'#66ff00'` etc) or names (`red`, `green`, `blue` etc) |
|aux_off_colour:| Optional| `the load colour` | Changes the colour of the AUX icon and label when disconnected. Hex codes (`'#66ff00'` etc) or names (`red`, `green`, `blue` etc) |
|aux_loads:| Optional | `0` | Display additional loads on the AUX side (`0/1/2`)
| additional_loads: | Optional | `0` | Display additional loads on the essential side (`0/1/2`)
| load1_name: | Optional | | Set the display name for the Essential Load 1
| load2_name: | Optional | | Set the display name for the Essential Load 2
Expand Down Expand Up @@ -237,12 +239,13 @@ The card calculates the sensors below based on supplied attributes in the config
nonessential = grid_ct_power_172 - grid_power_169
essential = inverter_power_175 + grid_power_169 - aux_power_166
```

The modbus registers can be visualised on the `full` card below:

![image](https://user-images.githubusercontent.com/7227275/235479493-b322d5b2-f2b1-431f-9048-f845fc2989b4.png)


### Example Card Configuration

#### Minimum Configuration (No Solar) #####

```yaml
Expand All @@ -260,6 +263,7 @@ entities:
battery_current_191: sensor.sunsynk_battery_current
grid_ct_power_172: sensor.sunsynk_grid_ct_power
```

#### Minimum Configuration (Solar) #####

```yaml
Expand Down Expand Up @@ -304,6 +308,7 @@ entities:
grid_connected_status_194: binary_sensor.sunsynk_grid_connected_status
inverter_status_59: sensor.overall_state
```

#### Minimal Configuration (Solar) #####

```yaml
Expand Down Expand Up @@ -337,23 +342,24 @@ entities:
pv2_voltage_111: sensor.sunsynk_pv2_voltage
pv2_current_112: sensor.sunsynk_pv2_current
```
#### Minimum Configuration (Solar + Daily Totals) #####

#### Minimal Configuration (Solar + Daily Totals) #####

```yaml
type: custom:sunsynk-power-flow-card
cardstyle: full
show_solar: 'yes'
show_solar: true
solar:
mppts: two
show_daily: 'yes'
mppts: 2
show_daily: true
battery:
energy: 15960
shutdown_soc: 20
show_daily: 'yes'
show_daily: true
load:
show_daily: 'yes'
show_daily: true
grid:
show_daily_buy: 'yes'
show_daily_buy: true
entities:
inverter_voltage_154: sensor.sunsynk_inverter_voltage
load_frequency_192: sensor.sunsynk_load_frequency
Expand All @@ -379,32 +385,33 @@ entities:
day_load_energy_84: sensor.sunsynk_day_load_energy
day_grid_import_76: sensor.sunsynk_day_grid_import
```

#### Full Configuration (All Options) #####

```yaml
type: custom:sunsynk-power-flow-card
cardstyle: full
panel_mode: 'no'
large_font: 'no'
show_solar: 'yes'
panel_mode: false
large_font: false
show_solar: true
inverter:
modern: 'yes'
modern: true
colour: grey
autarky: 'power'
battery:
energy: 15960
shutdown_soc: 20
invert_power: 'no'
invert_power: false
colour: pink
show_daily: 'yes'
show_daily: true
animation_speed: 6
max_power: 4500
full_capacity: 80
empty_capacity: 30
solar:
colour: orange
show_daily: 'yes'
mppts: two
show_daily: true
mppts: 2
animation_speed: 9
max_power: 8000
pv1_name: North
Expand All @@ -413,30 +420,35 @@ solar:
pv4_name: West
load:
colour: '#5fb6ad'
show_daily: 'yes'
show_aux: 'yes'
invert_aux: 'no'
show_daily: true
show_aux: true
invert_aux: false
aux_name: Generator
aux_type: gen
aux_colour: green
aux_off_colour: red
aux_loads: 2
aux_load1_name: Aux load 1
aux_load2_name: Aux load 2
aux_load1_icon: mdi:air-filter
aux_load2_icon: mdi:stove
animation_speed: 8
max_power: 8000
additional_loads: two
additional_loads: 2
load1_name: Geyser
load2_name: Pool
load1_icon: boiler
load2_icon: mdi:pool
grid:
colour: '#5490c2'
show_daily_buy: 'yes'
show_daily_sell: 'yes'
show_daily_buy: true
show_daily_sell: true
no_grid_colour: '#a40013'
show_nonessential: 'yes'
invert_grid: 'no'
show_nonessential: true
invert_grid: false
nonessential_name: Non Essential
nonessential_icon: oven
additional_loads: two
additional_loads: 2
load1_name: Load 1
load2_name: Load 2
load1_icon: boiler
Expand Down
Loading