Skip to content

Commit

Permalink
Merge pull request #51 from DanteWinters/develop
Browse files Browse the repository at this point in the history
Release 1.3.0
  • Loading branch information
DanteWinters authored Nov 24, 2023
2 parents 2e83b7b + bcadb24 commit fa997d4
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 122 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The following is a list of configs for the card:
| lux_dongle | list of strings | This is the LuxPower inverter's dongle number. It will later on be used to call the refresh service. (This requires the LuxPowerTek integration that supports this.) This or the inverter alias list are required if there are more than 1 inverter. |
| inverter_alias | list of strings | This is used when there is more than 1 inverter. This will be the names used in the dropdown list. This or the lux dongle list is required. |
| refresh_button | string | The location of the refresh button. Can be 'left', 'right' or 'both'. See below for more information. **NOTE:** the refresh button will only show if the *lux_dongle* is added. |
| title | string | A title for the card. |

#### Sub-configs that are not a list of entities or values

Expand Down
23 changes: 9 additions & 14 deletions config-entity-functions.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
import * as constants from "./constants.js";

const required_entries = [
"inverter_count",
"battery_soc",
"battery_flow",
"home_consumption",
"grid_flow"
]
const required_entries = ["inverter_count", "battery_soc", "battery_flow", "home_consumption", "grid_flow"];

export function buildConfig(config) {
function deepcopy(value) {
if (!(!!value && typeof value == 'object')) {
if (!(!!value && typeof value == "object")) {
return value;
}
if (Object.prototype.toString.call(value) == '[object Date]') {
if (Object.prototype.toString.call(value) == "[object Date]") {
return new Date(value.getTime());
}
if (Array.isArray(value)) {
return value.map(deepcopy);
}
const result = {};
Object.keys(value).forEach(
function(key) { result[key] = deepcopy(value[key]); });
Object.keys(value).forEach(function (key) {
result[key] = deepcopy(value[key]);
});
return result;
}

config = deepcopy(config);
const new_config = deepcopy(constants.base_config)
const new_config = deepcopy(constants.base_config);

new_config.title = config.title;

Expand Down Expand Up @@ -244,9 +239,9 @@ export function getEntitiesUnit(config, hass, config_entity, index) {

const handleEntityError = (config_entry, entity_name) => {
if (required_entries.includes(config_entry)) {
throw new Error(`Invalid entity: ${entity_name} for config_entry`) ;
throw new Error(`Invalid entity: ${entity_name} for config_entry`);
}
}
};

export function getStatusMessage(status_code, show_no_grid_as_warning) {
var status_level = 0;
Expand Down
2 changes: 1 addition & 1 deletion constants.js

Large diffs are not rendered by default.

87 changes: 86 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,88 @@
# 0.1.0
## Changelog

### v0.1.0

- Initial Release

### v0.2.0

- Reworked the card with better practices.

### v0.2.2

Enhancements

- Implemented HACS validations actions.
- Updated README for HACS requirements.
- Moved README to root folder.

Bugfixes

- Fixed arrow-animation issus
- Cropped arrow image, final result is that the arrows are larger and closer together in the final card.

### v0.3.0

Enhancements

- The refresh button can be shows by adding the correct config, but unfortunately the service isn't called when pressing the button. When this issue is solved, the rest of the interactions should be simple
- Images stored as base64. Issue can be closed when v03.0 is made the latest release.
- Keeping the README up to date is a continuous process but it is sufficient for use and HACS.
- PR for adding to HACS is pending, but the card can be added as a custom repository.
- There are now 3 ways of showing grid status. The LuxPower integration will still require fine tuning.
- Added label to show when last the values were updated, and also how long ago that was (if the entity has a timestamp attribute)

Bugfixes

- Improved formatting and scaling but text is not at a point where I am satisfied with.

### v0.4.0

Features

- Added the functionality to see the entity history and the refresh button works.

### v0.4.2

Bugfix

- Changed styles to accommodate safari browsers.

### v1.0.0

Features

- Parallel inverters
- v1.0.0 implements parallel inverters. Adding a second inverter will allow you to choose which inverter's info you want to see. Blending the info is the next step
- Card now uses status codes directly from the integration and gives a short description based on that.

Breaking changes

- v1.0.0 implements a new config format. This will break existing cards until the new config is implemented. Please refer to the README file for information.

### v1.1.0

Features

- Added mixing between parallel inverters
- Refresh button on Parallel page will. refresh both inverters

### v1.1.1

Bugfix

- For parallel page, all values are added except for battery SOC and voltages.

### v1.1.2

Bugfixes

- Round values to max of 2 decimal places.
- Reworked code to fix issue with battery arrows not showing.
- Reverted LitElement to HTMLElement.

### v1.2.0

Features

- Updated the status indicator to allow for parallel inverters.
13 changes: 5 additions & 8 deletions html-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ export function generateStyles(config) {
grid-template-rows: repeat(${config.pv_power.is_used ? 5 : 4}, 1fr);
padding-left: 5px;
padding-right: 5px;
padding-top: 1px;
}
.status-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(1, 1fr);
padding-left: 5px;
padding-right: 5px;
padding-top: 4px;
padding-top: ${config.title ? 0 : 30}px;
}
.diagram-grid img {
max-width: 100%;
Expand Down Expand Up @@ -53,7 +52,7 @@ export function generateStyles(config) {
text-align: right;
} */
.header-text {
font-size: min(4vw, 1.17em);
font-size: min(4vw, 1em);
font-weight: bold;
line-height: 1;
margin: 0;
Expand All @@ -64,6 +63,7 @@ export function generateStyles(config) {
}
.sub-text {
font-size: min(2.5vw, 0.95em);
color: var(--secondary-text-color);
line-height: 1;
margin: 0;
padding-left: 3px;
Expand Down Expand Up @@ -181,7 +181,6 @@ export function generateStyles(config) {
line-height: 1;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 5px;
}
.grid-status {
text-align: right;
Expand Down Expand Up @@ -303,9 +302,7 @@ export function generateGrid(config) {
cells += `<div id="home-info" class="cell text-cell"></div>`; // Home info
cells += `<div id="home-image" class="cell image-cell"><img src="${constants.getBase64Data("home-normal")}"></div>`; // Home image
cells += `<div id="power-allocation-arrows" class="cell arrow-cell"></div>`; // Power allocation arrows
cells += `<div id="power-allocation-image" class="cell image-cell"><img src="${constants.getBase64Data(
"home-normal"
)}"></div>`; // Power allocation image
cells += `<div id="power-allocation-image" class="cell image-cell"><img src="${constants.getBase64Data("home-normal")}"></div>`; // Power allocation image
cells += `<div id="power-allocation-info" class="cell text-cell"></div>`; // Power allocation info
} else {
cells += `<div class="cell">${refresh_button_left}</div>`;
Expand All @@ -322,7 +319,7 @@ export function generateGrid(config) {
export function generateDateTime(config) {
let date_time_info = ``;
if (config.update_time.is_used) {
let date_time_info = `
date_time_info = `
<p id="time-info">Last update at: -</p>
`;
if (config.update_time.show_last_update) {
Expand Down
Loading

0 comments on commit fa997d4

Please sign in to comment.