mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 22:47:01 +01:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
328159fee0 | ||
|
|
276025b6c4 | ||
|
|
ff8881c426 | ||
|
|
425e2fbf1c | ||
|
|
b087cafdb5 | ||
|
|
fffb3178c2 | ||
|
|
683eaca479 | ||
|
|
4cfd7a5c3c | ||
|
|
5bb932293b | ||
|
|
394e5b4614 | ||
|
|
68cf4f74e3 |
@@ -53,24 +53,29 @@ class Card(object):
|
|||||||
self.entities.append(Entity(e))
|
self.entities.append(Entity(e))
|
||||||
self.id = f"{self.cardType}_{self.key}".replace(".","_").replace("~","_").replace(" ","_")
|
self.id = f"{self.cardType}_{self.key}".replace(".","_").replace("~","_").replace(" ","_")
|
||||||
|
|
||||||
def get_entity_names(self):
|
def get_entity_names(self, uuid=False):
|
||||||
entityIds = []
|
entityIds = {}
|
||||||
if self.entity is not None:
|
if self.entity is not None:
|
||||||
entityIds.append(self.entity.entityId)
|
entityIds[self.entity.uuid] = self.entity.entityId
|
||||||
if self.entity.status is not None:
|
if self.entity.status is not None:
|
||||||
entityIds.append(self.entity.status)
|
entityIds[self.entity.uuid] = self.entity.status
|
||||||
for e in self.entities:
|
for e in self.entities:
|
||||||
entityIds.append(e.entityId)
|
entityIds[e.uuid] = e.entityId
|
||||||
if e.status is not None:
|
if e.status is not None:
|
||||||
entityIds.append(e.status)
|
entityIds[e.uuid] = e.status
|
||||||
|
|
||||||
# additional keys to check
|
# additional keys to check
|
||||||
add_ent_keys = ['statusIcon1', 'statusIcon2', 'alarmControl']
|
add_ent_keys = ['statusIcon1', 'statusIcon2', 'alarmControl']
|
||||||
for ent_key in add_ent_keys:
|
for ent_key in add_ent_keys:
|
||||||
val = self.raw_config.get(ent_key)
|
val = self.raw_config.get(ent_key)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
entityIds.append(val.get("entity"))
|
#entityIds.append(val.get("entity"))
|
||||||
|
entityIds["nouuid."] = val.get("entity")
|
||||||
|
|
||||||
|
if uuid:
|
||||||
return entityIds
|
return entityIds
|
||||||
|
else:
|
||||||
|
return entityIds.values()
|
||||||
|
|
||||||
def get_entity_list(self):
|
def get_entity_list(self):
|
||||||
entitys = []
|
entitys = []
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ class LuiController(object):
|
|||||||
apis.ha_api.listen_state(self.update_screensaver_brightness_state_callback, entity_id=screen_brightness_config)
|
apis.ha_api.listen_state(self.update_screensaver_brightness_state_callback, entity_id=screen_brightness_config)
|
||||||
|
|
||||||
items = self._config.get_all_entity_names()
|
items = self._config.get_all_entity_names()
|
||||||
|
prefixes = ("navigate.")
|
||||||
|
items = [x for x in items if not x.startswith(prefixes)]
|
||||||
apis.ha_api.log(f"Registering callbacks for the following items: {items}")
|
apis.ha_api.log(f"Registering callbacks for the following items: {items}")
|
||||||
for item in items:
|
for item in items:
|
||||||
if apis.ha_api.entity_exists(item):
|
if apis.ha_api.entity_exists(item):
|
||||||
@@ -152,13 +154,21 @@ class LuiController(object):
|
|||||||
def state_change_callback(self, entity, attribute, old, new, kwargs):
|
def state_change_callback(self, entity, attribute, old, new, kwargs):
|
||||||
apis.ha_api.log(f"Got callback for: {entity}", level="DEBUG")
|
apis.ha_api.log(f"Got callback for: {entity}", level="DEBUG")
|
||||||
apis.ha_api.log(f"Current page has the following items: {self._current_card.get_entity_names()}", level="DEBUG")
|
apis.ha_api.log(f"Current page has the following items: {self._current_card.get_entity_names()}", level="DEBUG")
|
||||||
if entity in self._current_card.get_entity_names():
|
entities_on_card = self._current_card.get_entity_names(uuid=True)
|
||||||
|
|
||||||
|
# lookup uuid for enity on current card
|
||||||
|
res_uuid = "uuid.notfound"
|
||||||
|
if entity in entities_on_card.values():
|
||||||
|
for uuid, name in entities_on_card.items():
|
||||||
|
if entity == name:
|
||||||
|
res_uuid = uuid
|
||||||
|
|
||||||
apis.ha_api.log(f"Callback Entity is on current page: {entity}", level="DEBUG")
|
apis.ha_api.log(f"Callback Entity is on current page: {entity}", level="DEBUG")
|
||||||
self._pages_gen.render_card(self._current_card, send_page_type=False)
|
self._pages_gen.render_card(self._current_card, send_page_type=False)
|
||||||
# send detail page update, just in case
|
# send detail page update, just in case
|
||||||
if self._current_card.cardType in ["cardGrid", "cardEntities", "cardMedia"]:
|
if self._current_card.cardType in ["cardGrid", "cardEntities", "cardMedia"]:
|
||||||
if entity.startswith("light"):
|
if entity.startswith("light"):
|
||||||
self._pages_gen.generate_light_detail_page(entity)
|
self._pages_gen.generate_light_detail_page(res_uuid)
|
||||||
if entity.startswith("cover"):
|
if entity.startswith("cover"):
|
||||||
self._pages_gen.generate_shutter_detail_page(entity)
|
self._pages_gen.generate_shutter_detail_page(entity)
|
||||||
if entity.startswith("fan"):
|
if entity.startswith("fan"):
|
||||||
|
|||||||
@@ -3764,57 +3764,93 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
|
|||||||
if (o.common.role == 'airCondition') {
|
if (o.common.role == 'airCondition') {
|
||||||
if (existsState(id + '.MODE') && getState(id + '.MODE').val != null) {
|
if (existsState(id + '.MODE') && getState(id + '.MODE').val != null) {
|
||||||
let Mode = getState(id + '.MODE').val
|
let Mode = getState(id + '.MODE').val
|
||||||
if (existsState(id + '.POWER') && getState(id + '.POWER').val != null) {
|
let States = getObject(id + '.MODE').common.states;
|
||||||
if (Mode != 0 || getState(id + '.POWER').val) { //0=ON oder .POWER = true
|
|
||||||
bt[0] = Icons.GetIcon('power-standby') + '~2016~1~' + 'POWER' + '~';
|
let iconIndex: number = 1;
|
||||||
statusStr = 'ON';
|
for(const statekey in States) {
|
||||||
|
let stateName: string = States[statekey];
|
||||||
|
let stateKeyNumber: number = parseInt(statekey);
|
||||||
|
if(stateName == 'OFF' || stateKeyNumber > 6) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
statusStr = stateName.replace('_', ' ');
|
||||||
|
}
|
||||||
|
switch(stateName) {
|
||||||
|
case 'AUTO':
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('air-conditioner') + '~1024~1~' + 'AUTO' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[0] = Icons.GetIcon('power-standby') + '~35921~0~' + 'POWER' + '~';
|
bt[iconIndex] = Icons.GetIcon('air-conditioner') + '~35921~0~' + 'AUTO' + '~';
|
||||||
statusStr = 'OFF';
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
if (Mode == 1) { //1=AUTO
|
case 'COOL':
|
||||||
bt[1] = Icons.GetIcon('air-conditioner') + '~1024~1~' + 'AUTO' + '~';
|
if(stateKeyNumber == Mode) {
|
||||||
statusStr = 'AUTO';
|
bt[iconIndex] = Icons.GetIcon('snowflake') + '~11487~1~' + 'COOL' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[1] = Icons.GetIcon('air-conditioner') + '~35921~0~' + 'AUTO' + '~';
|
bt[iconIndex] = Icons.GetIcon('snowflake') + '~35921~0~' + 'COOL' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 2) { //2=COOL
|
break;
|
||||||
bt[2] = Icons.GetIcon('snowflake') + '~11487~1~' + 'COOL' + '~';
|
case 'HEAT':
|
||||||
statusStr = 'COOL';
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('fire') + '~64512~1~' + 'HEAT' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[2] = Icons.GetIcon('snowflake') + '~35921~0~' + 'COOL' + '~';
|
bt[iconIndex] = Icons.GetIcon('fire') + '~35921~0~' + 'HEAT' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 3) { //3=HEAT
|
break;
|
||||||
bt[3] = Icons.GetIcon('fire') + '~64512~1~' + 'HEAT' + '~';
|
case 'ECO':
|
||||||
statusStr = 'HEAT';
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[3] = Icons.GetIcon('fire') + '~35921~0~' + 'HEAT' + '~';
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 4) { //4=ECO
|
break;
|
||||||
bt[4] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~';
|
case 'FAN_ONLY':
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('fan') + '~11487~1~' + 'FAN_ONLY' + '~';
|
||||||
|
} else {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('fan') + '~35921~0~' + 'FAN_ONLY' + '~';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'DRY':
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('water-percent') + '~60897~1~' + 'DRY' + '~';
|
||||||
|
} else {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('water-percent') + '~35921~0~' + 'DRY' + '~';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
iconIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconIndex <= 7 && existsState(id + '.ECO') && getState(id + '.ECO').val != null) {
|
||||||
|
if (getState(id + '.ECO').val && getState(id + '.ECO').val == 1) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~';
|
||||||
statusStr = 'ECO';
|
statusStr = 'ECO';
|
||||||
} else {
|
} else {
|
||||||
bt[4] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~';
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 5) { //5=FANONLY
|
iconIndex++;
|
||||||
bt[5] = Icons.GetIcon('fan') + '~11487~1~' + 'FAN' + '~';
|
|
||||||
statusStr = 'FAN ONLY';
|
|
||||||
} else {
|
|
||||||
bt[5] = Icons.GetIcon('fan') + '~35921~0~' + 'FAN' + '~';
|
|
||||||
}
|
}
|
||||||
if (Mode == 6) { //6=DRY
|
|
||||||
bt[6] = Icons.GetIcon('water-percent') + '~60897~1~' + 'DRY' + '~';
|
if (iconIndex <= 7 && existsState(id + '.SWING') && getState(id + '.SWING').val != null) {
|
||||||
statusStr = 'DRY';
|
|
||||||
} else {
|
|
||||||
bt[6] = Icons.GetIcon('water-percent') + '~35921~0~' + 'DRY' + '~';
|
|
||||||
}
|
|
||||||
if (existsState(id + '.SWING') && getState(id + '.SWING').val != null) {
|
|
||||||
if (getState(id + '.POWER').val && getState(id + '.SWING').val == 1) { //0=ON oder .SWING = true
|
if (getState(id + '.POWER').val && getState(id + '.SWING').val == 1) { //0=ON oder .SWING = true
|
||||||
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~2016~1~' + 'SWING' + '~';
|
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~2016~1~' + 'SWING' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~35921~0~' + 'SWING' + '~';
|
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~35921~0~' + 'SWING' + '~';
|
||||||
}
|
}
|
||||||
|
iconIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Power Icon zuletzt pruefen, damit der Mode ggf. mit OFF ueberschrieben werden kann
|
||||||
|
if (existsState(id + '.POWER') && getState(id + '.POWER').val != null) {
|
||||||
|
if (States[Mode] == 'OFF' || !getState(id + '.POWER').val) {
|
||||||
|
bt[0] = Icons.GetIcon('power-standby') + '~35921~0~' + 'POWER' + '~';
|
||||||
|
statusStr = 'OFF';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bt[0] = Icons.GetIcon('power-standby') + '~2016~1~' + 'POWER' + '~';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5344,46 +5380,37 @@ function HandleButtonEvent(words: any): void {
|
|||||||
setIfExists(words[2] + '.' + modesDP[mode], false);
|
setIfExists(words[2] + '.' + modesDP[mode], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GeneratePage(config.pages[pageId]);
|
GeneratePage(activePage);
|
||||||
} else {
|
} else {
|
||||||
let HVACMode = 0;
|
let HVACMode = getState(words[2] + '.MODE').val;
|
||||||
|
|
||||||
|
// Event ist an ein eigenes Objekt gebunden
|
||||||
|
if(existsObject(words[2] + '.' + words[4])) {
|
||||||
switch(words[4]) {
|
switch(words[4]) {
|
||||||
case 'POWER':
|
|
||||||
HVACMode = 0;
|
|
||||||
setIfExists(words[2] + '.' + words[4], !getState(words[2] + '.' + words[4]).val);
|
|
||||||
if (getState(words[2] + '.' + words[4]).val) {
|
|
||||||
HVACMode = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'AUTO':
|
|
||||||
HVACMode = 1;
|
|
||||||
break;
|
|
||||||
case 'COOL':
|
|
||||||
HVACMode = 2;
|
|
||||||
break;
|
|
||||||
case 'HEAT':
|
|
||||||
HVACMode = 3;
|
|
||||||
break;
|
|
||||||
case 'ECO':
|
|
||||||
HVACMode = 4;
|
|
||||||
break;
|
|
||||||
case 'FAN':
|
|
||||||
HVACMode = 5;
|
|
||||||
break;
|
|
||||||
case 'DRY':
|
|
||||||
HVACMode = 6;
|
|
||||||
break;
|
|
||||||
case 'SWING':
|
case 'SWING':
|
||||||
HVACMode = getState(words[2] + '.MODE').val;
|
|
||||||
if (getState(words[2] + '.SWING').val == 0) {
|
if (getState(words[2] + '.SWING').val == 0) {
|
||||||
setIfExists(words[2] + '.SWING', 1);
|
setIfExists(words[2] + '.SWING', 1);
|
||||||
} else {
|
} else {
|
||||||
setIfExists(words[2] + '.' + 'SWING', 0);
|
setIfExists(words[2] + '.' + 'SWING', 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default: // Power und Eco koennen einfach getoggelt werden
|
||||||
|
setIfExists(words[2] + '.' + words[4], !getState(words[2] + '.' + words[4]).val);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event ist ein Modus der Liste (Moduswechsel)
|
||||||
|
let HVACModeList = getObject(words[2] + '.MODE').common.states;
|
||||||
|
for(const statekey in HVACModeList) {
|
||||||
|
if(HVACModeList[statekey] == words[4]) {
|
||||||
|
HVACMode = parseInt(statekey);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setIfExists(words[2] + '.' + 'MODE', HVACMode);
|
setIfExists(words[2] + '.' + 'MODE', HVACMode);
|
||||||
GeneratePage(config.pages[pageId]);
|
GeneratePage(activePage);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'mode-modus1':
|
case 'mode-modus1':
|
||||||
|
|||||||
@@ -3381,57 +3381,93 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
|
|||||||
if (o.common.role == 'airCondition') {
|
if (o.common.role == 'airCondition') {
|
||||||
if (existsState(id + '.MODE') && getState(id + '.MODE').val != null) {
|
if (existsState(id + '.MODE') && getState(id + '.MODE').val != null) {
|
||||||
let Mode = getState(id + '.MODE').val
|
let Mode = getState(id + '.MODE').val
|
||||||
if (existsState(id + '.POWER') && getState(id + '.POWER').val != null) {
|
let States = getObject(id + '.MODE').common.states;
|
||||||
if (Mode != 0 || getState(id + '.POWER').val) { //0=ON oder .POWER = true
|
|
||||||
bt[0] = Icons.GetIcon('power-standby') + '~2016~1~' + 'POWER' + '~';
|
let iconIndex: number = 1;
|
||||||
statusStr = 'ON';
|
for(const statekey in States) {
|
||||||
|
let stateName: string = States[statekey];
|
||||||
|
let stateKeyNumber: number = parseInt(statekey);
|
||||||
|
if(stateName == 'OFF' || stateKeyNumber > 6) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
statusStr = stateName.replace('_', ' ');
|
||||||
|
}
|
||||||
|
switch(stateName) {
|
||||||
|
case 'AUTO':
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('air-conditioner') + '~1024~1~' + 'AUTO' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[0] = Icons.GetIcon('power-standby') + '~35921~0~' + 'POWER' + '~';
|
bt[iconIndex] = Icons.GetIcon('air-conditioner') + '~35921~0~' + 'AUTO' + '~';
|
||||||
statusStr = 'OFF';
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
if (Mode == 1) { //1=AUTO
|
case 'COOL':
|
||||||
bt[1] = Icons.GetIcon('air-conditioner') + '~1024~1~' + 'AUTO' + '~';
|
if(stateKeyNumber == Mode) {
|
||||||
statusStr = 'AUTO';
|
bt[iconIndex] = Icons.GetIcon('snowflake') + '~11487~1~' + 'COOL' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[1] = Icons.GetIcon('air-conditioner') + '~35921~0~' + 'AUTO' + '~';
|
bt[iconIndex] = Icons.GetIcon('snowflake') + '~35921~0~' + 'COOL' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 2) { //2=COOL
|
break;
|
||||||
bt[2] = Icons.GetIcon('snowflake') + '~11487~1~' + 'COOL' + '~';
|
case 'HEAT':
|
||||||
statusStr = 'COOL';
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('fire') + '~64512~1~' + 'HEAT' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[2] = Icons.GetIcon('snowflake') + '~35921~0~' + 'COOL' + '~';
|
bt[iconIndex] = Icons.GetIcon('fire') + '~35921~0~' + 'HEAT' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 3) { //3=HEAT
|
break;
|
||||||
bt[3] = Icons.GetIcon('fire') + '~64512~1~' + 'HEAT' + '~';
|
case 'ECO':
|
||||||
statusStr = 'HEAT';
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[3] = Icons.GetIcon('fire') + '~35921~0~' + 'HEAT' + '~';
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 4) { //4=ECO
|
break;
|
||||||
bt[4] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~';
|
case 'FAN_ONLY':
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('fan') + '~11487~1~' + 'FAN_ONLY' + '~';
|
||||||
|
} else {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('fan') + '~35921~0~' + 'FAN_ONLY' + '~';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'DRY':
|
||||||
|
if(stateKeyNumber == Mode) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('water-percent') + '~60897~1~' + 'DRY' + '~';
|
||||||
|
} else {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('water-percent') + '~35921~0~' + 'DRY' + '~';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
iconIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconIndex <= 7 && existsState(id + '.ECO') && getState(id + '.ECO').val != null) {
|
||||||
|
if (getState(id + '.ECO').val && getState(id + '.ECO').val == 1) {
|
||||||
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~';
|
||||||
statusStr = 'ECO';
|
statusStr = 'ECO';
|
||||||
} else {
|
} else {
|
||||||
bt[4] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~';
|
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~';
|
||||||
}
|
}
|
||||||
if (Mode == 5) { //5=FANONLY
|
iconIndex++;
|
||||||
bt[5] = Icons.GetIcon('fan') + '~11487~1~' + 'FAN' + '~';
|
|
||||||
statusStr = 'FAN ONLY';
|
|
||||||
} else {
|
|
||||||
bt[5] = Icons.GetIcon('fan') + '~35921~0~' + 'FAN' + '~';
|
|
||||||
}
|
}
|
||||||
if (Mode == 6) { //6=DRY
|
|
||||||
bt[6] = Icons.GetIcon('water-percent') + '~60897~1~' + 'DRY' + '~';
|
if (iconIndex <= 7 && existsState(id + '.SWING') && getState(id + '.SWING').val != null) {
|
||||||
statusStr = 'DRY';
|
|
||||||
} else {
|
|
||||||
bt[6] = Icons.GetIcon('water-percent') + '~35921~0~' + 'DRY' + '~';
|
|
||||||
}
|
|
||||||
if (existsState(id + '.SWING') && getState(id + '.SWING').val != null) {
|
|
||||||
if (getState(id + '.POWER').val && getState(id + '.SWING').val == 1) { //0=ON oder .SWING = true
|
if (getState(id + '.POWER').val && getState(id + '.SWING').val == 1) { //0=ON oder .SWING = true
|
||||||
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~2016~1~' + 'SWING' + '~';
|
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~2016~1~' + 'SWING' + '~';
|
||||||
} else {
|
} else {
|
||||||
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~35921~0~' + 'SWING' + '~';
|
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~35921~0~' + 'SWING' + '~';
|
||||||
}
|
}
|
||||||
|
iconIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Power Icon zuletzt pruefen, damit der Mode ggf. mit OFF ueberschrieben werden kann
|
||||||
|
if (existsState(id + '.POWER') && getState(id + '.POWER').val != null) {
|
||||||
|
if (States[Mode] == 'OFF' || !getState(id + '.POWER').val) {
|
||||||
|
bt[0] = Icons.GetIcon('power-standby') + '~35921~0~' + 'POWER' + '~';
|
||||||
|
statusStr = 'OFF';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bt[0] = Icons.GetIcon('power-standby') + '~2016~1~' + 'POWER' + '~';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4961,46 +4997,37 @@ function HandleButtonEvent(words: any): void {
|
|||||||
setIfExists(words[2] + '.' + modesDP[mode], false);
|
setIfExists(words[2] + '.' + modesDP[mode], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GeneratePage(config.pages[pageId]);
|
GeneratePage(activePage);
|
||||||
} else {
|
} else {
|
||||||
let HVACMode = 0;
|
let HVACMode = getState(words[2] + '.MODE').val;
|
||||||
|
|
||||||
|
// Event ist an ein eigenes Objekt gebunden
|
||||||
|
if(existsObject(words[2] + '.' + words[4])) {
|
||||||
switch(words[4]) {
|
switch(words[4]) {
|
||||||
case 'POWER':
|
|
||||||
HVACMode = 0;
|
|
||||||
setIfExists(words[2] + '.' + words[4], !getState(words[2] + '.' + words[4]).val);
|
|
||||||
if (getState(words[2] + '.' + words[4]).val) {
|
|
||||||
HVACMode = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'AUTO':
|
|
||||||
HVACMode = 1;
|
|
||||||
break;
|
|
||||||
case 'COOL':
|
|
||||||
HVACMode = 2;
|
|
||||||
break;
|
|
||||||
case 'HEAT':
|
|
||||||
HVACMode = 3;
|
|
||||||
break;
|
|
||||||
case 'ECO':
|
|
||||||
HVACMode = 4;
|
|
||||||
break;
|
|
||||||
case 'FAN':
|
|
||||||
HVACMode = 5;
|
|
||||||
break;
|
|
||||||
case 'DRY':
|
|
||||||
HVACMode = 6;
|
|
||||||
break;
|
|
||||||
case 'SWING':
|
case 'SWING':
|
||||||
HVACMode = getState(words[2] + '.MODE').val;
|
|
||||||
if (getState(words[2] + '.SWING').val == 0) {
|
if (getState(words[2] + '.SWING').val == 0) {
|
||||||
setIfExists(words[2] + '.SWING', 1);
|
setIfExists(words[2] + '.SWING', 1);
|
||||||
} else {
|
} else {
|
||||||
setIfExists(words[2] + '.' + 'SWING', 0);
|
setIfExists(words[2] + '.' + 'SWING', 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default: // Power und Eco koennen einfach getoggelt werden
|
||||||
|
setIfExists(words[2] + '.' + words[4], !getState(words[2] + '.' + words[4]).val);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event ist ein Modus der Liste (Moduswechsel)
|
||||||
|
let HVACModeList = getObject(words[2] + '.MODE').common.states;
|
||||||
|
for(const statekey in HVACModeList) {
|
||||||
|
if(HVACModeList[statekey] == words[4]) {
|
||||||
|
HVACMode = parseInt(statekey);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setIfExists(words[2] + '.' + 'MODE', HVACMode);
|
setIfExists(words[2] + '.' + 'MODE', HVACMode);
|
||||||
GeneratePage(config.pages[pageId]);
|
GeneratePage(activePage);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'mode-modus1':
|
case 'mode-modus1':
|
||||||
|
|||||||
Reference in New Issue
Block a user