Skip to content

Commit

Permalink
fix: add additional fields to the visual editor closes #433
Browse files Browse the repository at this point in the history
locale: update Russian translation closes #434
docs: update documentation
  • Loading branch information
slipx06 committed May 16, 2024
1 parent 6bef062 commit ee6f908
Show file tree
Hide file tree
Showing 19 changed files with 154 additions and 137 deletions.
12 changes: 6 additions & 6 deletions dist/sunsynk-power-flow-card.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ The card can be configured through the following attributes:
| show_solar: | Optional | `true` | Toggle display of solar information |
| show_battery: | Optional | `true` | Toggle display of battery information |
| show_grid: | Optional | `true` | Toggle display of grid information |
| card_height: | Optional | `396px` | Only used when `panel_mode: false`. Sets the card height in pixels. Specify the value i.e. `400px` or provide a sensor i.e. `input.numer_height` |
| card_width: | Optional | `100%` | Only used when `panel_mode: true`. Sets the card width in pixels or percentage `400px` or `80%`. For adjustments when using the Panel(1 card) view types or grid layouts |
| card_height: | Optional | `396px` | Only used when `panel_mode: false`. Sets the card height in pixels. Specify the value i.e. `400px` or provide a sensor i.e. `input.number_height` |
| card_width: | Optional | `100%` | Only used when `panel_mode: true`. Sets the card width in pixels or percentage. Specify the value i.e. `400px`, `80%` or provide a sensor i.e. `input.number_width`. For adjustments when using the Panel(1 card) view types or grid layouts |
| decimal_places: | Optional | `2` | Sets the number of decimal places to display when using the `auto_scale` option. |
| decimal_places_energy: | Optional | `1` | Sets the number of decimal places to display for the daily energy values. |
| dynamic_line_width: | Optional | `false` | Adjusts the width of the lines and animated dot based on the ratio of current power to `max_power` (defined in each section below). Requires `max_power` to be explicitly defined |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sunsynk-power-flow-card",
"version": "4.37.0",
"version": "4.37.1",
"description": "A customizable Home Assistant card to emulate the Sunsynk System flow that's displayed on the Inverter screen.",
"main": "sunsynk-power-flow-card.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/cards/compact-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,9 @@ export const compactCard = (config: sunsynkPowerFlowCardConfig, inverterImg: str
<stop offset="${(Number(data.pvPercentageBat < 2 ? 0 : data.pvPercentageBat) + Number(data.gridPercentageBat < 2 ? 0 : data.gridPercentageBat))}%"
stop-color="${Number(data.gridPercentageBat) > 0 ? `${data.gridColour}` : `${data.batteryColour}`}"/>
<stop offset="${(Number(data.pvPercentageBat < 2 ? 0 : data.pvPercentageBat) + Number(data.gridPercentageBat < 2 ? 0 : data.gridPercentageBat))}%"
stop-color="${Number(data.pvPercentageBat) === 100 ? data.solarColour : (Number(data.gridPercentageBat) === 100 ? data.gridColour : data.batteryColour)}"/>
stop-color="${data.batteryColour}"/>
<stop offset="100%"
stop-color="${Number(data.pvPercentageBat) === 100 ? data.solarColour : (Number(data.gridPercentageBat) === 100 ? data.gridColour : data.batteryColour)}"/>
stop-color="${data.batteryColour}"/>
</linearGradient>
</defs>
<path class="${!config.show_battery ? 'st12' : ''}"
Expand Down Expand Up @@ -776,9 +776,9 @@ export const compactCard = (config: sunsynkPowerFlowCardConfig, inverterImg: str
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.batteryPercentage > 0 ? data.batteryColour : data.solarColour}"/>
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
<stop offset="100%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
</linearGradient>
</defs>
<path fill="${config.load.dynamic_colour ? 'url(#Lg)' : data.loadColour}"
Expand Down
20 changes: 10 additions & 10 deletions src/cards/full-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -805,9 +805,9 @@ export const fullCard = (config: sunsynkPowerFlowCardConfig, inverterImg: string
<stop offset="${(Number(data.pvPercentageBat < 2 ? 0 : data.pvPercentageBat) + Number(data.gridPercentageBat < 2 ? 0 : data.gridPercentageBat))}%"
stop-color="${Number(data.gridPercentageBat) > 0 ? `${data.gridColour}` : `${data.batteryColour}`}"/>
<stop offset="${(Number(data.pvPercentageBat < 2 ? 0 : data.pvPercentageBat) + Number(data.gridPercentageBat < 2 ? 0 : data.gridPercentageBat))}%"
stop-color="${Number(data.pvPercentageBat) === 100 ? data.solarColour : (Number(data.gridPercentageBat) === 100 ? data.gridColour : data.batteryColour)}"/>
stop-color="${data.batteryColour}"/>
<stop offset="100%"
stop-color="${Number(data.pvPercentageBat) === 100 ? data.solarColour : (Number(data.gridPercentageBat) === 100 ? data.gridColour : data.batteryColour)}"/>
stop-color="${data.batteryColour}"/>
</linearGradient>
</defs>
<path class="${!config.show_battery ? 'st12' : ''}"
Expand Down Expand Up @@ -1079,9 +1079,9 @@ export const fullCard = (config: sunsynkPowerFlowCardConfig, inverterImg: string
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.batteryPercentage > 0 ? data.batteryColour : data.solarColour}"/>
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
<stop offset="100%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
</linearGradient>
</defs>
<path display="${[1, 2].includes(data.additionalLoad) && !data.showAux ? '' : 'none'}"
Expand All @@ -1101,9 +1101,9 @@ export const fullCard = (config: sunsynkPowerFlowCardConfig, inverterImg: string
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.batteryPercentage > 0 ? data.batteryColour : data.solarColour}"/>
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
<stop offset="100%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
</linearGradient>
</defs>
<path display="${([1, 2].includes(data.additionalLoad) && data.showAux) ? '' : 'none'}"
Expand All @@ -1123,9 +1123,9 @@ export const fullCard = (config: sunsynkPowerFlowCardConfig, inverterImg: string
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.batteryPercentage > 0 ? data.batteryColour : data.solarColour}"/>
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
<stop offset="100%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
</linearGradient>
</defs>
<path display="${[4].includes(data.additionalLoad) && !data.showAux ? '' : 'none'}"
Expand All @@ -1146,9 +1146,9 @@ export const fullCard = (config: sunsynkPowerFlowCardConfig, inverterImg: string
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.batteryPercentage > 0 ? data.batteryColour : data.solarColour}"/>
<stop offset="${(data.gridPercentage + data.batteryPercentage)}%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
<stop offset="100%"
stop-color="${data.pvPercentage > 0 ? data.solarColour : data.solarColour}"/>
stop-color="${data.solarColour}"/>
</linearGradient>
</defs>
<path display="${[1, 2, 3, 4].includes(data.additionalLoad) ? 'none' : ''}"
Expand Down
6 changes: 5 additions & 1 deletion src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ export class SunSynkCardEditor extends ScopedRegistryHost(LitElement) implements
type: "grid",
schema: [
{name: 'energy', selector: {number: {min: 0,}}},
//{name: "energy", selector: {entity: {device_class: SensorDeviceClass.ENERGY}}},
{name: "energy", selector: {entity: {}}},
{name: 'shutdown_soc', selector: {number: {mode: 'box', min: 0, max: 100,}}},
{name: 'shutdown_soc', selector: {entity: {}}},
{name: 'shutdown_soc_offgrid', selector: {number: {mode: 'box', min: 0, max: 100,}}},
{name: 'shutdown_soc_offgrid', selector: {entity: {}}},
{name: 'show_daily', selector: {boolean: {}}},
{name: 'auto_scale', selector: {boolean: {}}},
{name: 'invert_power', selector: {boolean: {}}},
Expand All @@ -154,6 +157,7 @@ export class SunSynkCardEditor extends ScopedRegistryHost(LitElement) implements
{name: 'show_remaining_energy', selector: {boolean: {}}},
{name: 'animation_speed', selector: {number: {}}},
{name: 'max_power', selector: {number: {}}},
{name: 'max_power', selector: {entity: {}}},
]
}]
},
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Inverter Værdier",
"invert_load": "Inverter Værdier",
"shutdown_soc": "Nedluknings SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energi",
"auto_scale": "Auto Skalering",
"three_phase": "Tre Faser",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"aux_dynamic_colour": "Aux Dynamic Colour",
"auto_scale": "Auto Scale",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Invert Values",
"invert_load": "Invert Values",
"shutdown_soc": "Shutdown SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energy",
"auto_scale": "Auto Scale",
"three_phase": "Three Phase",
Expand Down
1 change: 1 addition & 0 deletions src/localize/languages/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"invert_grid": "Inverter Valores",
"invert_load": "Inverter Valores",
"shutdown_soc": "Desligamento do SOC",
"shutdown_soc_offgrid": "Shutdown SOC (Off Grid)",
"energy": "Energia",
"auto_scale": "Escala automática",
"three_phase": "Trifásico",
Expand Down
Loading

0 comments on commit ee6f908

Please sign in to comment.