Compare commits

..

88 Commits

Author SHA1 Message Date
Armilar
b7687e006c v4.3.3.32 - Update NsPanelTs.ts
Hotfix Spotify Player
2024-01-04 22:23:56 +01:00
Armilar
10cf15bebd v4.3.3.32 - Update NSPanelTs.ts
Hotfix Spotify Player
2024-01-04 22:22:01 +01:00
Armilar
fc3d4adc72 Update NSPanelTs.ts 2024-01-04 22:15:47 +01:00
Armilar
bc330d5aaf Create NSPanelTs.ts 2024-01-04 22:14:03 +01:00
Armilar
9afdaa4cbc v4.3.3.31 - Update NsPanelTs.ts
* Remove: autoCreateAlias from cardMedia
* Remove: adapterPlayerInstance from every card except cardMedia
* [dev]: optional with type - cardMedia has adapterPlayerInstance all other not 
* [dev]: add PlayerType some more work to do
* changed: adapterPlayerInstance instance 0-9 allowed. Always require a '.' at the end.
2024-01-03 21:11:51 +01:00
Armilar
18c7f2eb9c Merge pull request #1116 from ticaki/main
some more types
2024-01-03 21:01:29 +01:00
ticaki
de237171ef add cases 2024-01-03 20:53:15 +01:00
ticaki
a4b90944e8 typo 2024-01-03 20:17:53 +01:00
ticaki
cb44fcc8c9 add bose aliase 2024-01-03 20:16:13 +01:00
ticaki
03bae9e9bd add check for adapterPlayerInstanceType 2024-01-03 19:10:42 +01:00
ticaki
1ec463f6c7 type 2024-01-03 18:45:21 +01:00
ticaki
5420abcfaa adapterPlayerInstance more types 2024-01-03 18:38:45 +01:00
ticaki
e2530cdf62 typo in types 2024-01-03 17:38:53 +01:00
ticaki
b14687cb30 some more types 2024-01-03 17:04:07 +01:00
Armilar
360fb881f1 v4.3.3.30 - Update NsPanelTs.ts by Ticaki
- Überarbeitung der Types 
- Verbesserung der Variablenprüfung
- Bessere Fehleranzeige in der Konfiguration
2024-01-02 22:52:47 +01:00
Armilar
90d35a8574 Merge pull request #1113 from ticaki/main
v4.3.3.30 - Types work
2024-01-02 21:49:30 +01:00
ticaki
73a0ba468e ticaki for ever 2024-01-02 19:58:44 +01:00
ticaki
4e7119768b PageType in config 2024-01-02 18:32:39 +01:00
ticaki
8bfa6deb76 Add version 2024-01-02 17:52:31 +01:00
ticaki
e87febc54a cardUnlock partial usecolor 2024-01-02 17:46:29 +01:00
ticaki
43df10e823 Merge branch 'joBr99:main' into main 2024-01-02 17:37:09 +01:00
ticaki
e2acb70a1c some types 2024-01-02 17:36:30 +01:00
Armilar
f8774af675 Merge pull request #1112 from tt-tom17/Tasmota_Buzzer
v4.3.3.29 Update NSPanel.ts
2024-01-02 16:07:07 +01:00
Thomas
9ddb6c7834 Update NsPanelTs.ts 2024-01-02 15:53:38 +01:00
Thomas
330e5fecdf v4.3.3.29 Update NSPanel.ts
- Add Tasmota Buzzer for NotifyPage
- Fix ThermoPage -> UnSubScribsWatcher
2024-01-02 15:51:48 +01:00
ticaki
6cc41bf510 some types work 2024-01-02 14:05:03 +01:00
ticaki
956bd23a56 add types for ScreensaverEntityIconColor 2024-01-02 11:59:19 +01:00
ticaki
f1ce806ded fix cardMedia 2024-01-02 02:02:28 +01:00
ticaki
7748c22292 fix ActivePage 2024-01-01 23:30:31 +01:00
ticaki
131aa491b9 update config: Config 2024-01-01 22:09:19 +01:00
ticaki
dbc5ff7ccd fix typo 2024-01-01 21:55:22 +01:00
ticaki
5c3f366e53 fix types 2024-01-01 21:53:13 +01:00
Armilar
b1b679701e Merge pull request #1110 from joBr99/Armilar-patch-4
v4.3.3.28 - Update NsPanelTs.ts
2023-12-31 11:43:28 +01:00
Armilar
c489f07c0a v4.3.3.28 - Update NsPanelTs.ts
- Fix short ID's in v4.3.3.27
- Fix window Icons in CreateEntity 
- Add MQTT-Client Check
2023-12-31 11:33:40 +01:00
Armilar
14bc7dedec v4.3.3.28 - Update NsPanelTs.ts
- Fix short ID's in v4.3.3.27
- Fix window Icons in CreateEntity 
- Add MQTT-Client Check
2023-12-30 14:15:54 +01:00
Armilar
d4067c5ddb v4.3.3.28 - Update NsPanelTs.ts
- Fix short ID's in v4.3.3.27
- Fix window Icons in CreateEntity 
- Add MQTT-Client Check
2023-12-30 11:56:31 +01:00
Armilar
50209418d7 v4.3.3.28 - Update NsPanelTs.ts
- short ID's
- Fix windows open/close in createEntity
2023-12-30 11:23:09 +01:00
Armilar
8f3c74165d v4.3.3.26 - Downgrade NsPanelTs.ts
Bug with inSel-Popup in v4.3.3.27
2023-12-29 12:27:21 +01:00
Armilar
b7b8f389eb Merge pull request #1108 from tt-tom17/PageId
v4.3.3.27 Update NSPanel.ts
2023-12-28 14:51:14 +01:00
Thomas
9082ed20f3 v4.3.3.27 Update NSPanel.ts
- Fix Payload (pageItem.id -> placeId) by Function CreateEntity
- Fix Fallback PageItem.name by Function CreateEntity
2023-12-28 14:40:09 +01:00
Thomas
f807406a97 Update NsPanelTs.ts 2023-12-28 10:23:02 +01:00
Thomas
93aafe259b Update NsPanelTs.ts
Ablösung pageItem.id durch placeId
2023-12-28 09:46:05 +01:00
Armilar
b96fc6e6bd Merge pull request #1105 from tt-tom17/main
v4.3.3.26 - Update NSPanel.ts
2023-12-26 20:55:31 +01:00
joBr99
1996b29c60 . 2023-12-26 12:04:00 +01:00
Thomas
c8eb476ca8 Merge pull request #1 from tt-tom17/Log-JSON-Convert
v4.3.3.26 - Update NSPanel.ts
2023-12-26 00:52:26 +01:00
Thomas
aeaa995a0a v4.3.3.26 - Update NSPanel.ts
Fix Log output payload -> Json.stringify
2023-12-26 00:51:23 +01:00
Thomas
b35122868f Update NsPanelTs.ts 2023-12-26 00:45:48 +01:00
Thomas
1cb974494f Update NsPanelTs.ts
Fix Log output payload -> Json.stringify
2023-12-25 14:57:04 +01:00
Armilar
723ecde4cd 4.3.3.25 - Update NsPanelTs.ts
Remove Example
2023-12-22 16:30:02 +01:00
Armilar
f29e5c4978 Merge pull request #1100 from tt-tom17/main
v4.3.3.25 - Update NSPanel.ts
2023-12-22 13:57:08 +01:00
Thomas
46ffff7eea Update ioBroker_NSPanel_locales.json
Tag "qr" supplemented
2023-12-22 13:28:10 +01:00
Thomas
774c920591 v4.3.3.25 - Update NSPanel.ts
Add switch of cardQR by hidePassword: true
2023-12-22 13:25:56 +01:00
Thomas
f27eb07827 v4.3.3.25 - Update NSPanel.ts
Add switch of cardQR by hidePassword: true
2023-12-21 12:25:58 +01:00
Armilar
da8362d81d Merge pull request #1097 from joBr99/Armilar-patch-3
v4.3.3.24 - Update NsPanelTs.ts
2023-12-18 16:45:58 +01:00
Armilar
6e38d4f38d v4.3.3.24 - Update NsPanelTs.ts
* Log info commented out
2023-12-18 16:41:49 +01:00
Armilar
2344c9a9ed v4.3.3.24 - Update NsPanelTs.ts
* Hotfix Update Message
* Add Icon Colors to Entity Button
* Add Color-Const Cyan & Magenta
2023-12-18 16:37:46 +01:00
dependabot[bot]
5180f0f869 Bump home-assistant/builder from 2023.09.0 to 2023.12.0 (#1095)
Bumps [home-assistant/builder](https://github.com/home-assistant/builder) from 2023.09.0 to 2023.12.0.
- [Release notes](https://github.com/home-assistant/builder/releases)
- [Commits](https://github.com/home-assistant/builder/compare/2023.09.0...2023.12.0)

---
updated-dependencies:
- dependency-name: home-assistant/builder
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-18 11:11:52 +01:00
Armilar
b4f2789834 Merge pull request #1093 from joBr99/Armilar-patch-3
v4.3.3.23 - Update NsPanelTs.ts
2023-12-17 17:09:39 +01:00
Armilar
78c6029200 v4.3.3.23 - Update NsPanelTs.ts
Optimization of the blind control (enable or disable Up/Stop/Down)
2023-12-17 17:07:53 +01:00
Armilar
dca112e42b v4.3.3.23 - Update NsPanelTs.ts
Optimization of the blind control (enable or disable Up/Stop/Down)
2023-12-17 17:04:29 +01:00
Armilar
5ad16dd735 Update Countdown_Timer.ts 2023-12-16 10:42:51 +01:00
joBr99
723be0735e . 2023-12-15 14:29:31 +01:00
joBr99
a5bfb9388f . 2023-12-15 14:16:59 +01:00
joBr99
9c6f24f984 Merge branch 'main' of github.com:joBr99/nspanel-lovelace-ui 2023-12-15 14:09:52 +01:00
joBr99
59843ffea5 . 2023-12-15 14:09:25 +01:00
Armilar
4de9c4a12f 4.3.3.22 - Update ioBroker_NSPanel_locales_service.json
Update Notifications
2023-12-14 23:13:44 +01:00
Armilar
3eb05e5a84 4.3.3.22 - Update NsPanelTs.ts 2023-12-14 23:08:14 +01:00
Armilar
5d7a7ed1a4 Merge pull request #1090 from tt-tom17/main
v4.3.3.22 Update NSPanel.ts
2023-12-14 22:44:30 +01:00
Thomas
7124a22c38 v4.3.3.22 Update NSPanel.ts
- Add UpdateMessage => disable the update messages
- Fix name by static Navi Icon
- Fix colorscale by Role Info
2023-12-14 22:36:41 +01:00
Armilar
fa4d65a383 Merge pull request #1089 from tt-tom17/main
Update Alarm_clock.ts
2023-12-13 22:01:03 +01:00
Thomas
d26306f892 Update Alarm_clock.ts
fix dpAction to val: true
2023-12-13 21:55:33 +01:00
joBr99
9c0bb037fb Merge branch 'main' of github.com:joBr99/nspanel-lovelace-ui 2023-12-13 16:50:46 +01:00
joBr99
4b73e20b9b implement templtates for brightness 2023-12-13 16:50:28 +01:00
dependabot[bot]
3940a0c2e9 Bump actions/setup-python from 4 to 5 (#1087)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-13 14:22:56 +01:00
Armilar
8f57d4a642 v4.3.3.21 - Update NsPanelTs.ts
- Add createAutoALias to popupTimer only for Time
2023-12-09 11:19:38 +01:00
Armilar
3979fdf6a0 Create Countdown_Timer.ts 2023-12-08 22:58:24 +01:00
Armilar
4cd47126eb Create Alarm_clock.ts 2023-12-08 22:54:16 +01:00
Armilar
eb0dd79c80 v4.3.3.20 - Update ioBroker_NSPanel_locales.json 2023-12-08 22:41:11 +01:00
Armilar
3a39a8ca0e Merge pull request #1086 from tt-tom17/main
v4.3.3.20 - Update NSPanel.ts
2023-12-08 22:27:04 +01:00
Armilar
b5c4a2128b v4.3.3.20 - Update NsPanelTs.ts
Remove semicolon
2023-12-08 22:25:04 +01:00
Armilar
41f43fe5d0 v4.3.3.20 - Update NsPanelTs.ts
Remove Example
2023-12-08 22:22:44 +01:00
Armilar
f3f93b7136 v4.3.3.12 - Update NsPanelTs.ts 2023-12-08 22:20:08 +01:00
joBr99
2fb1855842 fixed binary sensors 2023-12-08 22:09:35 +01:00
Thomas
9a3627427f v4.3.3.20 - Update NSPanel.ts
add Role AlarmTime for Alarm Clock
2023-12-08 20:24:23 +01:00
Armilar
94fbf0a5f7 Merge pull request #1084 from joBr99/Armilar-patch-2
v4.3.3.19 - Update NsPanelTs.ts
2023-12-07 20:02:54 +01:00
Armilar
caddec1190 v4.3.3.19 - Update NsPanelTs.ts
- Fix Trigger activeDimmodeBrightness if Dimmode = -1
2023-12-07 20:02:12 +01:00
Armilar
03367ea27d v4.3.3.19 - Update NsPanelTs.ts
- Fix Trigger activeDimmodeBrightness if Dimmode = -1
2023-12-07 19:58:21 +01:00
Armilar
8e792ae8fc Merge pull request #1083 from joBr99/Armilar-patch-1
v4.3.3.18 - Update NsPanelTs.ts
2023-12-06 22:00:28 +01:00
17 changed files with 13917 additions and 1710 deletions

View File

@@ -100,7 +100,7 @@ jobs:
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2023.09.0
uses: home-assistant/builder@2023.12.0
with:
args: |
${{ env.BUILD_ARGS }} \

View File

@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install mkdocs-material mkdocs-video markdown-include mike

View File

@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install mkdocs-material mkdocs-video markdown-include mike

1732
ioBroker/.iobroker/types/javascript.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
const dp_userdata: string = '0_userdata.0.NSPanel';
const dp_alias: string = 'alias.0.NSPanel';
// dpAction wird wenn der Wecker gestellt wird auf false geschaltet
// dpAction wird wenn die Weckzeit erreicht ist auf true geschaltet
// Der nachfolgende Datenpunkt muss manuell erstellt werden...
const dpAction: string = '0_userdata.0.example_boolean';
const Debug = true;
let time: number;
let scheduleAlarmTime: any = null;
on({ id: dp_userdata + '.AlarmTime.State', change: 'ne' }, async (obj) => {
time = getState(dp_userdata + '.AlarmTime.Time').val;
if (Debug) log('Uhrzeit: ' + time, 'info');
if ('paused' == obj.state.val) {
(function () { if (scheduleAlarmTime) {
clearSchedule(scheduleAlarmTime);
scheduleAlarmTime = null;
}
});
} else if ('active' == obj.state.val) {
let stunde: number = Math.floor(time / 60);
let minute: number = time % 60;
if (Debug) log('Weckzeit: ' + ('0' + stunde).slice(-2) + ':' + ('0' + minute).slice(-2), 'info');
scheduleAlarmTime = schedule(minute + ' ' + stunde + ' * * *', async () => {
await setStateAsync(dpAction, <iobJS.State>{ val: true, ack: true });
await setStateAsync(dp_userdata + '.AlarmTime.State', <iobJS.State>{ val: 'paused', ack: true });
});
}
});
async function Init_Datenpunkte() {
if (existsState(dp_alias + '.AlarmTime.ACTUAL') == false) {
await createStateAsync(dp_userdata + '.AlarmTime.Time', '0', { type: 'number' });
await createStateAsync(dp_userdata + '.AlarmTime.State', 'paused', { type: 'string' });
setObject(dp_alias + '.AlarmTime', { type: 'channel', common: { role: 'value.alarmtime', name: 'Alarmtime' }, native: {} });
await createAliasAsync(dp_alias + '.AlarmTime.ACTUAL', dp_userdata + '.AlarmTime.Time', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(dp_alias + '.AlarmTime.STATE', dp_userdata + '.AlarmTime.State', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'STATE' });
log("<PageItem>{id: '"+ dp_alias + ".AlarmTime', name: 'Wecker', onColor: Red, offColor: Green, useColor: true}", 'info');
}
}
Init_Datenpunkte();

View File

@@ -0,0 +1,46 @@
const dp_userdata: string = '0_userdata.0.NSPanel';
const dp_alias: string = 'alias.0.NSPanel';
// Der nachfolgende Datenpunkt muss manuell angelegt werden
const dpAction: string = '0_userdata.0.example_boolean'; // anpassen
const Debug = false;
let intervallCounter: any;
let sec_timer = getState(dp_userdata + '.Countdown.Time').val;
on({ id: dp_userdata + '.Countdown.State', change: 'ne' }, async (obj) => {
switch (obj.state.val) {
case 'active':
if (intervallCounter) { clearInterval(intervallCounter); intervallCounter = null; };
intervallCounter = setInterval(async () => {
if (getState(dp_userdata + '.Countdown.Time').val > 0) {
sec_timer = getState(dp_userdata + '.Countdown.Time').val;
setState(dp_userdata + '.Countdown.Time', (sec_timer - 1), false);
} else {
setState(dp_userdata + '.Countdown.Time', 0, false);
setState(dp_userdata + '.Countdown.State', 'idle', false);
// An dieser Stelle kann auch noch eine Meldung an Alexa oder Telegram, etc. erfolgen
}
}, 1000);
break;
default:
if (intervallCounter) { clearInterval(intervallCounter); intervallCounter = null; };
break;
}
});
async function Init_Datenpunkte() {
if (existsState(dp_alias + '.Countdown.ACTUAL') == false) {
await createStateAsync(dp_userdata + '.Countdown.Time', '0', { type: 'number'});
await createStateAsync(dp_userdata + '.Countdown.State', 'paused', { type: 'string' });
setObject(dp_alias + '.Countdown', { type: 'channel', common: { role: 'level.timer', name: 'Countdown' }, native: {} });
await createAliasAsync(dp_alias + '.Countdown.ACTUAL', dp_userdata + '.Countdown.Time', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(dp_alias + '.Countdown.STATE', dp_userdata + '.Countdown.State', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'STATE' });
log("<PageItem>{id: '"+ dp_alias + ".Countdown', name: 'Timer'}", 'info');
}
}
Init_Datenpunkte();

9760
ioBroker/DEV/NSPanelTs.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1047,6 +1047,14 @@
"zh-CN":"空闲",
"zh-TW":"暫停"
},
"on":{
"en-US":"On",
"de-DE":"Ein"
},
"off":{
"en-US":"Off",
"de-DE":"Aus"
},
"paused":{
"en-US":"Paused",
"de-DE":"pausiert",
@@ -2489,6 +2497,14 @@
"vi-VN":"Mật khẩu",
"zh-CN":"密码",
"zh-TW":"密碼"
},
"Wlan enabled":{
"en-US":"Wlan enabled",
"de-DE":"Wlan aktiviert"
},
"Wlan disabled":{
"en-US":"Wlan disabled",
"de-DE":"Wlan deaktiviert"
}
},
"media":{

View File

@@ -2693,5 +2693,9 @@
"update_nextion_tft":{
"en-US":"Update Nextion TFT",
"de-DE":"Nextion TFT Update"
},
"update_message":{
"en-US":"Update Notifications",
"de-DE":"Update Mitteilungen"
}
}

28
ioBroker/tsconfig.json Normal file
View File

@@ -0,0 +1,28 @@
{
"compileOnSave": true,
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"checkJs": true,
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,
"noImplicitReturns": true,
"noImplicitAny": false,
"target": "ES2022",
"typeRoots": [
".iobroker/types",
"node_modules/@types"
]
},
"include": [
"**/*.js",
"**/*.ts",
"./.iobroker/types/javascript.d.ts"
],
"exclude": [
"node_modules/**"
]
}

View File

@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: NSPanel Lovelace UI Addon
version: "4.7.72"
version: "4.7.74"
slug: nspanel-lovelace-ui
description: NSPanel Lovelace UI Addon
services:

View File

@@ -52,6 +52,8 @@ class HAEntity(panel_cards.Entity):
self.state = data.get("state")
self.attributes = data.get("attributes", [])
else:
self.state = "not found"
self.attributes = []
return "~text~iid.404~X~6666~not found~"
# HA Entities
@@ -188,7 +190,7 @@ class HAEntity(panel_cards.Entity):
icon_char = value
case 'binary_sensor':
device_class = self.attributes.get("device_class", "")
value = get_translation(self.locale, f"backend.component.binary_sensor.state.{device_class}.{entity.state}")
value = get_translation(self.locale, f"backend.component.binary_sensor.state.{device_class}.{self.state}")
case 'weather':
attr = self.config.get("attribute", "temperature")
value = str(self.attributes.get(attr, self.state))
@@ -304,8 +306,6 @@ class QRCard(HACard):
super().__init__(locale, config, panel)
self.qrcode = config.get("qrCode", "https://www.youtube.com/watch?v=dQw4w9WgXcQ")
def render(self):
# TODO: Render QRCode as HomeAssistant Template
#qrcode = apis.ha_api.render_template(qrcode)
if self.qrcode.startswith("ha:"):
self.qrcode = libs.home_assistant.get_template(self.qrcode)[3:]
result = f"{self.title}~{self.gen_nav()}~{self.qrcode}"
@@ -475,6 +475,8 @@ class AlarmCard(HACard):
main_entity = self.entities[0]
main_entity.render()
print(main_entity.state)
icon = get_icon_char("shield-off")
color = rgb_dec565([255,255,255])
supported_modes = []

View File

@@ -8,6 +8,7 @@ def wait_for_ha_cache():
while time.time() < mustend:
if len(libs.home_assistant.home_assistant_entity_state_cache) == 0:
time.sleep(0.1)
time.sleep(1)
def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, screenBrightness, sleepOverride, return_involved_entities=False):
dimmode = 10
@@ -17,6 +18,12 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
if sleepBrightness:
if isinstance(sleepBrightness, int):
dimmode = sleepBrightness
elif isinstance(sleepBrightness, list):
logging.error("list style config for sleepBrightness no longer supported")
elif sleepBrightness.startswith("ha:"):
time.sleep(1)
dimmode = int(float(libs.home_assistant.get_template(sleepBrightness)[3:]))
involved_entities.extend(libs.home_assistant.get_template_listener_entities(sleepBrightness))
elif libs.home_assistant.is_existent(sleepBrightness):
involved_entities.append(sleepBrightness)
dimmode = int(float(libs.home_assistant.get_entity_data(sleepBrightness).get('state', 10)))
@@ -24,6 +31,12 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
if screenBrightness:
if isinstance(screenBrightness, int):
dimValueNormal = screenBrightness
elif isinstance(screenBrightness, list):
logging.error("list style config for screenBrightness no longer supported")
elif screenBrightness.startswith("ha:"):
time.sleep(1)
dimValueNormal = int(float(libs.home_assistant.get_template(screenBrightness)[3:]))
involved_entities.extend(libs.home_assistant.get_template_listener_entities(screenBrightness))
elif libs.home_assistant.is_existent(screenBrightness):
involved_entities.append(screenBrightness)
dimValueNormal = int(float(libs.home_assistant.get_entity_data(screenBrightness).get('state', 100)))
@@ -60,7 +73,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
case 'number-set':
if entity_id.startswith('fan'):
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
value = float(value) * float(attr.get(percentage_step, 0))
value = float(value) * float(attr.get('percentage_step', 0))
service_data = {
"value": int(value)
}
@@ -217,30 +230,6 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
case _:
logging.error("Not implemented: %s", btype)
# # for cardUnlock
# if button_type == "cardUnlock-unlock":
# curCard = self._config.get_card_by_uuid(
# entity_id.replace('navigate.', ''))
# if curCard is not None:
# if int(curCard.raw_config.get("pin")) == int(value):
# dstCard = self._config.search_card(
# curCard.raw_config.get("destination"))
# if dstCard is not None:
# if dstCard.hidden:
# self._previous_cards.append(self._current_card)
# self._current_card = dstCard
# self._pages_gen.render_card(self._current_card)
# if button_type == "opnSensorNotify":
# msg = ""
# entity = apis.ha_api.get_entity(entity_id)
# if "open_sensors" in entity.attributes and entity.attributes.open_sensors is not None:
# for e in entity.attributes.open_sensors:
# msg += f"- {apis.ha_api.get_entity(e).attributes.friendly_name}\r\n"
# self._pages_gen.send_message_page(
# "opnSensorNotifyRes", "", msg, "", "")
def call_ha_service(entity_id, service, service_data = {}):
etype = entity_id.split(".")[0]
libs.home_assistant.call_service(

View File

@@ -232,7 +232,7 @@ def execute_script(entity_name: str, domain: str, service: str, service_data: di
]
}
send_message(json.dumps(msg))
# busy waiting for response with a timeout of 0.2 seconds - maybe there's a better way of doing this
# busy waiting for response with a timeout of 0.4 seconds- maybe there's a better way of doing this
mustend = time.time() + 0.4
while time.time() < mustend:
if response_buffer[call_id] == True:
@@ -246,6 +246,8 @@ def execute_script(entity_name: str, domain: str, service: str, service_data: di
return {}
def cache_template(template):
if not template:
raise Exception("Invalid template")
global next_id, response_buffer
try:
call_id = next_id
@@ -273,6 +275,18 @@ def get_template(template):
else:
return template_cache.get(template, []).get("result", "404")
def get_template_listener_entities(template):
global template_cache
if template in template_cache:
return template_cache[template].get("listener-entities")
else:
mustend = time.time() + 0.5
while time.time() < mustend:
if template not in template_cache:
time.sleep(0.0001)
else:
return template_cache.get(template, []).get("listener-entities", "404")
def get_entity_data(entity_id: str):
if entity_id in home_assistant_entity_state_cache:
return home_assistant_entity_state_cache[entity_id]

View File

@@ -41,3 +41,7 @@ def entityUpdateDetail2(msg_out_queue, topic, data):
def statusUpdate(msg_out_queue, topic, data):
custom_send(msg_out_queue, topic, f"statusUpdate~{data}")
def send_message_page(msg_out_queue, topic, ident, heading, msg, b1, b2):
page_type(msg_out_queue, topic, "popupNotify")
custom_send(msg_out_queue, topic, f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")

View File

@@ -7,7 +7,7 @@ from scheduler import Scheduler
import scheduler.trigger as trigger
import time
import babel.dates
from ha_cards import Screensaver, EntitiesCard, card_factory, detail_open
from ha_cards import Screensaver, card_factory, detail_open
import ha_control
class LovelaceUIPanel:
@@ -67,7 +67,7 @@ class LovelaceUIPanel:
self.schedule = Scheduler()
self.schedule.minutely(datetime.time(second=0), self.update_time)
self.schedule.hourly(datetime.time(
minute=0, second=0), self.update_time)
minute=0, second=0), self.update_date)
schedule_thread = threading.Thread(target=self.schedule_thread_target)
schedule_thread.daemon = True
schedule_thread.start()
@@ -76,6 +76,10 @@ class LovelaceUIPanel:
ha_control.wait_for_ha_cache()
#request templates on cards
if isinstance(self.settings.get("sleepBrightness",""), str) and self.settings.get("sleepBrightness", "").startswith("ha:"):
libs.home_assistant.cache_template(self.settings.get("sleepBrightness"))
if isinstance(self.settings.get("sleepBrightness",""), str) and self.settings.get("screenBrightness", "").startswith("ha:"):
libs.home_assistant.cache_template(self.settings.get("screenBrightness"))
for c in self.cards.values():
if hasattr(c, "qrcode"):
if c.qrcode.startswith("ha:"):
@@ -242,12 +246,6 @@ class LovelaceUIPanel:
self.render_current_page(switchPages=True)
return
# replace iid with real entity id
#if entity_id.startswith("iid."):
# iid = entity_id.split(".")[1]
# if iid in self.entity_iids:
# entity_id = self.entity_iids[iid]
# replace iid with real entity id
if entity_id.startswith("iid."):
iid = entity_id.split(".")[1]