Skip to content

Commit

Permalink
fixed issue with eclipse led status
Browse files Browse the repository at this point in the history
- closes #293
  • Loading branch information
foxriver76 committed Dec 20, 2023
1 parent 4469740 commit cbcfe8b
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 6 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ With API v2 the new channel configurations can be used, for write states you can
|:---:|:---:|
|number|R|

*Read-only number, which represents the inverter AC Power in watts. If the value is greater than 0 the battery is discharging, if greater than zero it is charging.*
*Read-only number, which represents the inverter AC Power in watts. If the value is greater than 0 the battery is discharging, if less than zero it is charging.*

* status.relativeSoc

Expand Down Expand Up @@ -326,6 +326,10 @@ The channel provides battery specific information like the number of cycle count
Placeholder for the next version (at the beginning of the line):
### __WORK IN PROGRESS__
-->
### __WORK IN PROGRESS__
* (foxriver76) sync brightness status of eclipse led
* (foxriver76) fixed issue with eclipse led status (closes #293)

### 1.16.0 (2023-02-02)
* (foxriver76) added state `battery.balanceChargeRequest` (closes #258)

Expand Down
16 changes: 16 additions & 0 deletions build/lib/utils.js

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

2 changes: 1 addition & 1 deletion build/lib/utils.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/main.js

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

2 changes: 1 addition & 1 deletion build/main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/lib/_Types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface LatestDataResponse {
'Pulsing Orange': boolean;
'Pulsing White': boolean;
'Solid Red': boolean;
Brightness: number;
};
'MISC Status Bits': {
'Discharge not allowed': boolean;
Expand Down
16 changes: 16 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,22 @@ export const generalAPIStates: ioBroker.AnyObject[] = [
},
native: {}
},
{
_id: 'latestData.eclipseLedBrightness',
type: 'state',
common: {
name: 'Eclipse LED Brightness',
type: 'number',
role: 'value.brightness',
read: true,
write: false,
desc: 'Brightness of the Eclipse LED',
unit: '%',
min: 0,
max: 100
},
native: {}
},
{
_id: 'latestData.dcShutdownReason',
type: 'state',
Expand Down
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ class Sonnen extends utils.Adapter {
true
);

await this.setStateAsync('latestData.eclipseLedBrightness', data.ic_status['Eclipse Led'].Brightness, true);
await this.setStateAsync('latestData.secondsSinceFullCharge', data.ic_status.secondssincefullcharge, true);
}

Expand All @@ -653,8 +654,8 @@ class Sonnen extends utils.Adapter {
* @param bitmapLike The object to decode
* @param fallback fallback to return if no value is true
*/
decodeBitmapLikeObj<T extends Record<string, boolean>, F extends string>(bitmapLike: T, fallback: F): keyof T | F {
const foundEntry = Object.entries(bitmapLike).find(value => value[1]);
decodeBitmapLikeObj<T extends Record<string, unknown>, F extends string>(bitmapLike: T, fallback: F): keyof T | F {
const foundEntry = Object.entries(bitmapLike).find(value => value[1] === true);

return foundEntry ? foundEntry[0] : fallback;
}
Expand Down

0 comments on commit cbcfe8b

Please sign in to comment.