Skip to content

Commit

Permalink
1.6.1
Browse files Browse the repository at this point in the history
Fixed capability update (manually added, power).
  • Loading branch information
RonnyWinkler committed Jul 17, 2024
1 parent 447ac30 commit 2bb93b0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .homeychangelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@
"1.6.0": {
"en": "Enhanced data/entity processing to reduce CPU usage.",
"de": "Daten/Entitätsverarbeitung optimiert zur Reduzierung der CPU-Auslastung."
},
"1.6.1": {
"en": "Fixed capability update (manually added, power).",
"de": "Capability-Aktualisierung korrigiert (manuell hinzugefügt, Energie)."
}

}
2 changes: 1 addition & 1 deletion .homeycompose/app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "io.home-assistant.community",
"version": "1.6.0",
"version": "1.6.1",
"compatibility": ">=8.1.0",
"sdk": 3,
"brandColor": "#0DA6EA",
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_comment": "This file is generated. Please edit .homeycompose/app.json instead.",
"id": "io.home-assistant.community",
"version": "1.6.0",
"version": "1.6.1",
"compatibility": ">=8.1.0",
"sdk": 3,
"brandColor": "#0DA6EA",
Expand Down
28 changes: 17 additions & 11 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ class Client extends Homey.SimpleClass {

registerCompound(compoundId, device, entityIds){
let compoundDevice = {
id: compoundId,
device: device,
entityIds: entityIds
};
this._compoundRegistration.set(compoundId, compoundDevice);
// register Loopup table for revers search
this.addCompoundLookupTable(compoundId);
// this.addCompoundLookupTable(compoundId);
this.addCompoundLookupTable(compoundDevice);
}

unregisterCompound(compoundId) {
Expand All @@ -170,14 +172,21 @@ class Client extends Homey.SimpleClass {

// Creates Lookup-Objekt to read Compound-ID based on entityId
// (improves performance on entity state update event)
addCompoundLookupTable(compoundId){
let compound = this._compoundRegistration.get(compoundId);
addCompoundLookupTable(compound){
// compound is the 1 device with n entities linked
// Loop over all entities
for (let i=0; i<compound.entityIds.length; i++){
if (this._compoundRegistrationEntityLookup[compound.entityIds[i]] == undefined){
this._compoundRegistrationEntityLookup[compound.entityIds[i]] = {compoundIds: []};
}
if (!this._compoundRegistrationEntityLookup[compound.entityIds[i]].compoundIds.find(id => id === compoundId)){
this._compoundRegistrationEntityLookup[compound.entityIds[i]].compoundIds.push(compoundId);
// check if a device list for this entity is already created
let compoundEntry = this._compoundRegistrationEntityLookup.get(compound.entityIds[i]);
if (compoundEntry == undefined){
// create and add an empty device array to the entity
compoundEntry = {compoundIds: []} ;
this._compoundRegistrationEntityLookup.set(compound.entityIds[i], compoundEntry );
}
// check is device is is not added yet for the entity
if (!compoundEntry.compoundIds.find(id => id === compound.id)){
// register the device id for the entity entrys
compoundEntry.compoundIds.push(compound.id);
}
}
}
Expand Down Expand Up @@ -642,9 +651,6 @@ class Client extends Homey.SimpleClass {
}

async _onEventStateChanged(event){
if (event.entity_id == 'binary_sensor.test'){
this.log("Test");
}
// this._app.log("HA event: ", event.event_type, " Entity: ",entityId);
let tokens = {
entity: event.entity_id,
Expand Down

0 comments on commit 2bb93b0

Please sign in to comment.