Do not render info tooltip if we have an error (#9869)

This commit is contained in:
Paulus Schoutsen 2021-08-22 23:47:03 -07:00 committed by GitHub
parent e963735dba
commit bd8f436c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 35 deletions

View File

@ -124,16 +124,17 @@ class HuiEnergyCarbonGaugeCard
return html`
<ha-card>
<ha-svg-icon id="info" .path=${mdiInformation}></ha-svg-icon>
<paper-tooltip animation-delay="0" for="info" position="left">
<span>
This card represents how much of the energy consumed by your home
was generated using non-fossil fuels like solar, wind and nuclear.
</span>
</paper-tooltip>
${value !== undefined
? html` <ha-gauge
? html`
<ha-svg-icon id="info" .path=${mdiInformation}></ha-svg-icon>
<paper-tooltip animation-delay="0" for="info" position="left">
<span>
This card represents how much of the energy consumed by your
home was generated using non-fossil fuels like solar, wind and
nuclear.
</span>
</paper-tooltip>
<ha-gauge
min="0"
max="100"
.value=${value}
@ -143,7 +144,8 @@ class HuiEnergyCarbonGaugeCard
"--gauge-color": this._computeSeverity(value),
})}
></ha-gauge>
<div class="name">Non-fossil energy consumed</div>`
<div class="name">Non-fossil energy consumed</div>
`
: html`Consumed non-fossil energy couldn't be calculated`}
</ha-card>
`;

View File

@ -97,18 +97,20 @@ class HuiEnergyGridGaugeCard
return html`
<ha-card>
<ha-svg-icon id="info" .path=${mdiInformation}></ha-svg-icon>
<paper-tooltip animation-delay="0" for="info" position="left">
<span>
This card represents your energy dependency.
<br /><br />
If it's green, it means you produced more energy than that you
consumed from the grid. If it's in the red, it means that you relied
on the grid for part of your home's energy consumption.
</span>
</paper-tooltip>
${value !== undefined
? html`<ha-gauge
? html`
<ha-svg-icon id="info" .path=${mdiInformation}></ha-svg-icon>
<paper-tooltip animation-delay="0" for="info" position="left">
<span>
This card represents your energy dependency.
<br /><br />
If it's green, it means you produced more energy than that you
consumed from the grid. If it's in the red, it means that you
relied on the grid for part of your home's energy consumption.
</span>
</paper-tooltip>
<ha-gauge
min="-1"
max="1"
.value=${value}
@ -126,7 +128,8 @@ class HuiEnergyGridGaugeCard
${returnedToGrid! >= consumedFromGrid!
? "Net returned to the grid"
: "Net consumed from the grid"}
</div>`
</div>
`
: "Grid neutrality could not be calculated"}
</ha-card>
`;

View File

@ -86,19 +86,20 @@ class HuiEnergySolarGaugeCard
return html`
<ha-card>
<ha-svg-icon id="info" .path=${mdiInformation}></ha-svg-icon>
<paper-tooltip animation-delay="0" for="info" position="left">
<span>
This card represents how much of the solar energy was used by your
home and was not returned to the grid.
<br /><br />
If you frequently produce more than you consume, try to conserve
this energy by installing a battery or buying an electric car to
charge.
</span>
</paper-tooltip>
${value !== undefined
? html`<ha-gauge
? html`
<ha-svg-icon id="info" .path=${mdiInformation}></ha-svg-icon>
<paper-tooltip animation-delay="0" for="info" position="left">
<span>
This card represents how much of the solar energy was used by
your home and was not returned to the grid.
<br /><br />
If you frequently produce more than you consume, try to
conserve this energy by installing a battery or buying an
electric car to charge.
</span>
</paper-tooltip>
<ha-gauge
min="0"
max="100"
.value=${value}
@ -108,7 +109,8 @@ class HuiEnergySolarGaugeCard
"--gauge-color": this._computeSeverity(value),
})}
></ha-gauge>
<div class="name">Self consumed solar energy</div>`
<div class="name">Self consumed solar energy</div>
`
: totalSolarProduction === 0
? "You have not produced any solar energy"
: "Self consumed solar energy couldn't be calculated"}