Skip to content

Commit

Permalink
Fix the display issue and add integration version at the bottom of th…
Browse files Browse the repository at this point in the history
…e card
  • Loading branch information
Stéphane Senart committed Dec 8, 2024
1 parent fd90911 commit 49bfdca
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
12 changes: 6 additions & 6 deletions dist/gazpar-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lovelace-gazpar-card",
"version": "1.3.11-alpha.1",
"version": "1.3.11-alpha.2",
"compatibleIntegrationVersion": "1.3.4",
"compatibleGazpar2MQTTVersion": "0.1.0",
"description": "GrDF Gazpar meter lovelace card for Home Assistant.",
Expand Down
9 changes: 6 additions & 3 deletions src/gazpar-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export class GazparCard extends LitElement {
${this.renderYearlyCostHistoryChart()}
${this.renderError(attributes.errorMessages)}
${this.renderVersion()}
${this.renderVersion(attributes)}
</ha-card>`
}
}
Expand Down Expand Up @@ -560,12 +560,15 @@ export class GazparCard extends LitElement {
}

//----------------------------------
renderVersion() {
renderVersion(attributes) {
if (this.config.showVersion === true) {

var sourceInfo = attributes.source != null ? attributes.source.name + " v" + attributes.source.version : "home-assistant-gazpar v" + attributes.version;

return html
` <div class="section">
<div class="small-value" style="color: gray; text-align: right;">
Gazpar Card Version ${VERSION}
Gazpar Card v${VERSION} - ${sourceInfo}
</div>
</div>
`
Expand Down
4 changes: 4 additions & 0 deletions tests/attributes.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"attribution": "Data provided by GrDF",
"version": "1.3.4",
"source": {
"name": "gazpar2mqtt",
"version": "0.1.0"
},
"username": "toto.titi@tata.com",
"pce": "123456789101112",
"unit_of_measurement": "kWh",
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
new webpack.DefinePlugin({
VERSION: JSON.stringify(require("./package.json").version),
COMPATIBLE_INTEGRATION_VERSION: JSON.stringify(require("./package.json").compatibleIntegrationVersion),
COMPATIBLE_GAZPAR2MQTT_VERSION: JSON.stringify(require("./package.json").compatibleGAZPAR2MQTTVersion),
COMPATIBLE_GAZPAR2MQTT_VERSION: JSON.stringify(require("./package.json").compatibleGazpar2MQTTVersion),
}),
new HtmlWebpackPlugin({
filename: 'index.html',
Expand Down

0 comments on commit 49bfdca

Please sign in to comment.