Skip to content

Commit

Permalink
Merge pull request #94 from molikk/fixing-circle-flow-when-no-grid-lo…
Browse files Browse the repository at this point in the history
…ad-items-given

fixing circle flow when no grid load items given
  • Loading branch information
molikk authored Dec 26, 2024
2 parents 0db7102 + 916d900 commit d171073
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dist/mlk-power-flow-card.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mlk-power-flow-card",
"version": "0.60.0",
"version": "0.61.0",
"description": "A customizable Home Assistant card to emulate the Sunsynk System flow that's displayed on the Inverter screen.",
"main": "mlk-power-flow-card.js",
"scripts": {
Expand Down
27 changes: 17 additions & 10 deletions src/cards/compact/gridLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class GridLoad {
stroke-width="${data.nonessLineWidth}" stroke-miterlimit="10" pointer-events="stroke"/>
<circle id="nes-dot1" cx="0" cy="0"
r="${Math.min(2 + data.nonessLineWidth + Math.max(data.minLineWidth - 2, 0), 8)}"
fill="${data.nonessentialLoads === 0 ? 'transparent' : `${data.nonEssentialLoadMainDynamicColour}`}">
fill="${data.nonEssentialLoadMainDynamicColour}">
<animateMotion dur="${data.durationCur['ne']}s" repeatCount="indefinite"
keyPoints=${config.grid.ness_invert_flow ? Utils.invertKeyPoints('1;0') : '1;0'}
keyTimes="0;1" calcMode="linear">
Expand All @@ -194,20 +194,27 @@ export class GridLoad {
flowLine1 = svg``;
}

let circle2 = svg`
<circle id="nes-dot2" cx="0" cy="0"
r="${Math.min(2 + data.nonessLineWidth + Math.max(data.minLineWidth - 2, 0), 8)}"
fill="${data.nonEssentialLoadMainDynamicColour}">
<animateMotion dur="${data.durationCur['ne']}s" repeatCount="indefinite"
keyPoints=${config.grid.ness_invert_flow ? Utils.invertKeyPoints('1;0') : '1;0'}
keyTimes="0;1" calcMode="linear">
<mpath xlink:href="#nes-line2"/>
</animateMotion>
</circle`;

if (!config.grid.show_nonessential) {
circle2 = svg``;
}

return svg`
${flowLine1}>
<svg id="nes-flow2">
<path id="nes-line2" d="M 140 290 L 140 234" fill="none" stroke="${data.nonEssentialLoadMainDynamicColour}"
stroke-width="${data.nonessLineWidth}" stroke-miterlimit="10" pointer-events="stroke"/>
<circle id="nes-dot2" cx="0" cy="0"
r="${Math.min(2 + data.nonessLineWidth + Math.max(data.minLineWidth - 2, 0), 8)}"
fill="${data.nonessentialLoads === 0 ? 'transparent' : `${data.nonEssentialLoadMainDynamicColour}`}">
<animateMotion dur="${data.durationCur['ne']}s" repeatCount="indefinite"
keyPoints=${config.grid.ness_invert_flow ? Utils.invertKeyPoints('1;0') : '1;0'}
keyTimes="0;1" calcMode="linear">
<mpath xlink:href="#nes-line2"/>
</animateMotion>
</circle>
${circle2}>
</svg>`;
}

Expand Down

0 comments on commit d171073

Please sign in to comment.