This commit is contained in:
Johannes
2022-11-15 19:10:22 +01:00
13 changed files with 577 additions and 155 deletions

View File

@@ -101,6 +101,8 @@ The following message can be used to update the content on the cardEntities Page
`~number~input_number.entityName~4~17299~Number123~value|min|max` `~number~input_number.entityName~4~17299~Number123~value|min|max`
`~input_sel~input_select.entityName~3~17299~sel-name~sel-text`
### popupLight Page ### popupLight Page
`entityUpdateDetail~entityName~*ignored*~*iconColor*~*buttonState*~*sliderBrightnessPos*~*sliderColorTempPos*~*colorMode*~*color_translation*~*color_temp_translation*~*brightness_translation*` `entityUpdateDetail~entityName~*ignored*~*iconColor*~*buttonState*~*sliderBrightnessPos*~*sliderColorTempPos*~*colorMode*~*color_translation*~*color_temp_translation*~*brightness_translation*`
@@ -121,9 +123,19 @@ The following message can be used to update the content on the cardEntities Page
`exitPopup` `exitPopup`
### popupThermo Page
`entityUpdateDetail~{entity_id}~{icon_id}~{icon_color}~{heading}~{mode}~mode1~mode1?mode2?mode3~{heading}~{mode}~mode1~mode1?mode2?mode3~{heading}~{mode}~mode1~mode1?mode2?mode3~`
### popupInSel Page (input_select detail page)
`entityUpdateDetail2~*entity_id*~~*icon_color*~*input_sel*~*state*~*options*
options are ? seperated
### cardThermo Page ### cardThermo Page
`entityUpd~*heading*~*navigation*~*internalNameEntiy*~*currentTemp*~*destTemp*~*status*~*minTemp*~*maxTemp*~*stepTemp*[[~*iconId*~*activeColor*~*state*~*hvac_action*]]~tCurTempLbl~tStateLbl~tALbl~iconTemperature~dstTempTwoTempMode` `entityUpd~*heading*~*navigation*~*internalNameEntiy*~*currentTemp*~*destTemp*~*status*~*minTemp*~*maxTemp*~*stepTemp*[[~*iconId*~*activeColor*~*state*~*hvac_action*]]~tCurTempLbl~tStateLbl~tALbl~iconTemperature~dstTempTwoTempMode~btDetail`
`[[]]` are not part of the command~ this part repeats 8 times for the buttons `[[]]` are not part of the command~ this part repeats 8 times for the buttons

View File

@@ -6,10 +6,6 @@ pageIcons
7 Component(s) 7 Component(s)
0 Line(s) of event code 0 Line(s) of event code
0 Unique line(s) of event code 0 Unique line(s) of event code
pageStartup
19 Component(s)
172 Line(s) of event code
125 Unique line(s) of event code
popupNotify popupNotify
19 Component(s) 19 Component(s)
253 Line(s) of event code 253 Line(s) of event code
@@ -22,6 +18,10 @@ cardPower
43 Component(s) 43 Component(s)
435 Line(s) of event code 435 Line(s) of event code
297 Unique line(s) of event code 297 Unique line(s) of event code
pageStartup
19 Component(s)
172 Line(s) of event code
125 Unique line(s) of event code
popupShutter popupShutter
25 Component(s) 25 Component(s)
394 Line(s) of event code 394 Line(s) of event code

View File

@@ -402,7 +402,7 @@ Text tVersion
Horizontal Alignment : center Horizontal Alignment : center
Vertical Alignment : center Vertical Alignment : center
Input Type : character Input Type : character
Text : 43 Text : 44
Max. Text Size : 10 Max. Text Size : 10
Word wrap : disabled Word wrap : disabled
Horizontal Spacing : 0 Horizontal Spacing : 0

View File

@@ -152,7 +152,7 @@ Text tVersion
Disable release event after dragging: 0 Disable release event after dragging: 0
Send Component ID : disabled Send Component ID : disabled
Associated Keyboard : none Associated Keyboard : none
Text : 43 Text : 44
Max. Text Size : 10 Max. Text Size : 10
Picture p0 Picture p0

View File

@@ -402,7 +402,7 @@ Text tVersion
Horizontal Alignment : center Horizontal Alignment : center
Vertical Alignment : center Vertical Alignment : center
Input Type : character Input Type : character
Text : 43 Text : 44
Max. Text Size : 10 Max. Text Size : 10
Word wrap : disabled Word wrap : disabled
Horizontal Spacing : 0 Horizontal Spacing : 0

View File

@@ -152,7 +152,7 @@ Text tVersion
Disable release event after dragging: 0 Disable release event after dragging: 0
Send Component ID : disabled Send Component ID : disabled
Associated Keyboard : none Associated Keyboard : none
Text : 43 Text : 44
Max. Text Size : 10 Max. Text Size : 10
Picture p0 Picture p0

View File

@@ -18,14 +18,14 @@ popupLight
28 Component(s) 28 Component(s)
404 Line(s) of event code 404 Line(s) of event code
223 Unique line(s) of event code 223 Unique line(s) of event code
popupNotify
19 Component(s)
253 Line(s) of event code
164 Unique line(s) of event code
pageStartup pageStartup
19 Component(s) 19 Component(s)
172 Line(s) of event code 172 Line(s) of event code
125 Unique line(s) of event code 125 Unique line(s) of event code
popupNotify
19 Component(s)
253 Line(s) of event code
164 Unique line(s) of event code
cardQR cardQR
32 Component(s) 32 Component(s)
421 Line(s) of event code 421 Line(s) of event code

View File

@@ -402,7 +402,7 @@ Text tVersion
Horizontal Alignment : center Horizontal Alignment : center
Vertical Alignment : center Vertical Alignment : center
Input Type : character Input Type : character
Text : 43 Text : 44
Max. Text Size : 10 Max. Text Size : 10
Word wrap : disabled Word wrap : disabled
Horizontal Spacing : 0 Horizontal Spacing : 0

View File

@@ -152,7 +152,7 @@ Text tVersion
Disable release event after dragging: 0 Disable release event after dragging: 0
Send Component ID : disabled Send Component ID : disabled
Associated Keyboard : none Associated Keyboard : none
Text : 43 Text : 44
Max. Text Size : 10 Max. Text Size : 10
Picture p0 Picture p0

View File

@@ -16,4 +16,4 @@ key | optional | type | default | description
`title` | True | string | `None` | Title of the Page `title` | True | string | `None` | Title of the Page
`entity` | False | string | `None` | contains the entity of the current card `entity` | False | string | `None` | contains the entity of the current card
`key` | True | string | `None` | Used by navigate items `key` | True | string | `None` | Used by navigate items
`mediaControl` | True | complex | `None` | overwrites the action executed on pressing the left upper icon (red circle), icon is showing the current type of media and cannot be changed `mediaControl` | True | complex | `None` | overwrites the action executed on pressing the left upper icon (red circle), icon is showing the current type of media and cannot be changed (configure it to a navigate entity; see subpages for more details `navigate.cardGrid_key`)

View File

@@ -51,6 +51,7 @@ key | option | type | default | description
`tMainTextAlt` | True | list | White | `[R, G, B]` `tMainTextAlt` | True | list | White | `[R, G, B]`
`tMRIcon` | True | list | White | `[R, G, B]` `tMRIcon` | True | list | White | `[R, G, B]`
`tMR` | True | list | White | `[R, G, B]` `tMR` | True | list | White | `[R, G, B]`
`tTimeAdd` | True | list | White | `[R, G, B]`
`autoWeather` | True | boolean | false | Set to `true` to enable weather icons to change depending on state e.g. blue for rainy. Any custom colors in `tMainIcon` `tF1Icon` `tF2Icon` `tF3Icon` `tF4Icon` take precedence. `autoWeather` | True | boolean | false | Set to `true` to enable weather icons to change depending on state e.g. blue for rainy. Any custom colors in `tMainIcon` `tF1Icon` `tF2Icon` `tF3Icon` `tF4Icon` take precedence.
If `autoWeather: true` is set. You may also overwrite the default color mapping for any valid weather state provided by homeassistant e.g. `rainy: [50, 50, 255]` or `sunny: [255, 255, 0]` If `autoWeather: true` is set. You may also overwrite the default color mapping for any valid weather state provided by homeassistant e.g. `rainy: [50, 50, 255]` or `sunny: [255, 255, 0]`
@@ -138,7 +139,7 @@ Example for the theme config:
#bar: [220, 0, 255] #bar: [220, 0, 255]
#tMRIcon: [220, 0, 255] #tMRIcon: [220, 0, 255]
#tMR: [220, 0, 255] #tMR: [220, 0, 255]
#tTimeAdd: [220, 0, 255] #tTimeAdd: [220, 0, 255]
#autoWeather automatically colors the screensaver weather icons based upon weather. Uncomment the following line to enable. #autoWeather automatically colors the screensaver weather icons based upon weather. Uncomment the following line to enable.
#autoWeather: true #autoWeather: true

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
TypeScript v3.5.0.4 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf TypeScript v3.5.0.5 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf
- abgestimmt auf TFT 43 / v3.5.0 / BerryDriver 4 / Tasmota 12.2.0 - abgestimmt auf TFT 43 / v3.5.0 / BerryDriver 4 / Tasmota 12.2.0
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker @joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
@@ -7,10 +7,12 @@ icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroke
ioBroker-Unterstützung: https://forum.iobroker.net/topic/50888/sonoff-nspanel ioBroker-Unterstützung: https://forum.iobroker.net/topic/50888/sonoff-nspanel
WIKI zu diesem Projekt unter: https://github.com/joBr99/nspanel-lovelace-ui/wiki (siehe Sidebar) WIKI zu diesem Projekt unter: https://github.com/joBr99/nspanel-lovelace-ui/wiki (siehe Sidebar)
Icons unter: https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/master/cheatsheet.html Icons unter: https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/master/cheatsheet.html
******************************************************************************* *******************************************************************************
Achtung Änderung des Sonoff ESP-Temperatursensors Achtung Änderung des Sonoff ESP-Temperatursensors
!!! Bitte "SetOption146 1" in der Tasmota-Console ausführen !!! !!! Bitte "SetOption146 1" in der Tasmota-Console ausführen !!!
******************************************************************************* *******************************************************************************
ReleaseNotes: ReleaseNotes:
Bugfixes und Erweiterungen: Bugfixes und Erweiterungen:
- cardQR (für Gäste WLAN) - cardQR (für Gäste WLAN)
@@ -63,6 +65,14 @@ ReleaseNotes:
- 27.10.2022 - v3.5.0.2 Applied Boy Scout Rule (Fixed some typos, changed var to let, fixed min/max colorTemp Bug) - 27.10.2022 - v3.5.0.2 Applied Boy Scout Rule (Fixed some typos, changed var to let, fixed min/max colorTemp Bug)
- 30.10.2022 - v3.5.0.3 Fixed Media Play/Pause icon for alexa (and others) devices - 30.10.2022 - v3.5.0.3 Fixed Media Play/Pause icon for alexa (and others) devices
- 31.10.2022 - v3.5.0.4 Reengineering Media Subscriptions - 31.10.2022 - v3.5.0.4 Reengineering Media Subscriptions
- 02.11.2022 - v3.5.0.5 Page navigation continues with page 0 from the last page
- 04.11.2022 - v3.5.0.5 Create Auto-Alias for Service Pages
- 07.11.2022 - v3.5.0.5 Create Auto-Alias for Alexa2, Spotify-Premium, Sonos
- 08.11.2022 - v3.5.0.5 Create Auto-Alias for Wheather-Forcast (Screensaver Big-Icon)
*****************************************************************************************************************
* Falls Aliase durch das Skript erstellt werden sollen, muss in der JavaScript Instanz "setObect" gesetzt sein! *
*****************************************************************************************************************
Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden
@@ -138,9 +148,12 @@ Upgrades in Konsole:
let Icons = new IconsSelector(); let Icons = new IconsSelector();
let timeoutSlider: any; let timeoutSlider: any;
let manually_Update = false; let manually_Update = false;
const autoCreateAlias = true; //Für diese Option muss der Haken in setObjects in deiner javascript.X. Instanz gesetzt sein.
const NSPanel_Path = '0_userdata.0.NSPanel.1.'; const NSPanel_Path = '0_userdata.0.NSPanel.1.';
const NSPanel_Alarm_Path = '0_userdata.0.NSPanel.'; //Neuer Pfad für gemeinsame Nutzung durch mehrere Panels (bei Nutzung der cardAlarm) const NSPanel_Alarm_Path = '0_userdata.0.NSPanel.'; //Neuer Pfad für gemeinsame Nutzung durch mehrere Panels (bei Nutzung der cardAlarm)
let AliasPath: string = 'alias.0.' + NSPanel_Path.substring(13, NSPanel_Path.length);
const Debug = false; const Debug = false;
// Variablen zur Steuerung der Wettericons auf dem Screensaver (Steuerung in 0_userdata.0.XPANELX.ScreensaverInfo) // Variablen zur Steuerung der Wettericons auf dem Screensaver (Steuerung in 0_userdata.0.XPANELX.ScreensaverInfo)
@@ -224,7 +237,8 @@ const swWindy: RGB = { red: 150, green: 150, blue: 150};
let vwIconColor = []; let vwIconColor = [];
//-- Anfang der Beispiele für Seitengestaltung -- Aliase erforderlich ----------------
//-- Anfang der Beispiele für Seitengestaltung -- Selbstdefinierte Aliase erforderlich ----------------
let Test_Licht1: PageEntities = let Test_Licht1: PageEntities =
{ {
@@ -400,31 +414,33 @@ let Radiosender: PageGrid =
// MEDIA ALIASE können auch per JS-Script erstellt werden https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-ALIAS-Definitionen#medien---cardmedia // MEDIA ALIASE können auch per JS-Script erstellt werden https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-ALIAS-Definitionen#medien---cardmedia
let Alexa: PageMedia = let Alexa: PageMedia =
{ {
"type": "cardMedia", 'type': 'cardMedia',
"heading": "Alexa", 'heading': 'Alexa',
"useColor": true, 'useColor': true,
"subPage": false, 'subPage': false,
"parent": undefined, 'parent': undefined,
"items": [<PageItem>{ 'items': [<PageItem>{
id: "alias.0.NSPanel_1.Media.PlayerAlexa2", id: AliasPath + 'Media.PlayerAlexa',
adapterPlayerInstance: "alexa2.0.", adapterPlayerInstance: 'alexa2.0.',
mediaDevice: "G0XXXXXXXXXXXXXX", mediaDevice: 'G0XXXXXXXXXXXXXX', //Hier eigenes Device (Alexa-Seriennummer) auswählen
speakerList: ['Überall','Gartenhaus','Esszimmer','Heimkino','Echo Dot Küche','Echo Spot Buero'] speakerList: ['Überall','Gartenhaus','Esszimmer','Heimkino','Echo Dot Küche','Echo Spot Buero'], //anpassen an eigene Alexa's
autoCreateALias : true
}] }]
}; };
let Sonos: PageMedia = let Sonos: PageMedia =
{ {
"type": "cardMedia", 'type': 'cardMedia',
"heading": "Sonos", 'heading': 'Sonos',
"useColor": true, 'useColor': true,
"subPage": false, 'subPage': false,
"parent": undefined, 'parent': undefined,
"items": [<PageItem>{ 'items': [<PageItem>{
id: "alias.0.NSPanel_1.Media.PlayerSonos", id: AliasPath + 'Media.PlayerSonos',
adapterPlayerInstance: "sonos.0.", adapterPlayerInstance: "sonos.0.",
mediaDevice: "192_168_1_212", mediaDevice: "192_168_1_212", //IP der eigenen Sonos anpassen
speakerList: ['Terrasse'] speakerList: ['Terrasse'],
autoCreateALias : true
}] }]
}; };
@@ -436,9 +452,10 @@ let SpotifyPremium: PageMedia =
"subPage": false, "subPage": false,
"parent": undefined, "parent": undefined,
"items": [<PageItem>{ "items": [<PageItem>{
id: "alias.0.NSPanel_1.Media.PlayerSpotifyPremium", id: AliasPath + 'Media.PlayerSpotifyPremium',
adapterPlayerInstance: "spotify-premium.0.", adapterPlayerInstance: "spotify-premium.0.",
speakerList: ['LENOVO-W11-01','Terrasse','Überall','Gartenhaus','Esszimmer','Heimkino','Echo Dot Küche','Echo Spot Buero'] speakerList: ['LENOVO-W11-01','Terrasse','Überall','Gartenhaus','Esszimmer','Heimkino','Echo Dot Küche','Echo Spot Buero'], //anpassen
autoCreateALias : true
}] }]
}; };
@@ -451,7 +468,7 @@ let SqueezeboxRPC: PageMedia =
"parent": undefined, "parent": undefined,
"items": [<PageItem>{ "items": [<PageItem>{
id: "alias.0.Media.LMS.SqueezePlay", id: "alias.0.Media.LMS.SqueezePlay",
adapterPlayerInstance: "squeezeboxrpc.0.Players.SqueezePlay.", adapterPlayerInstance: "squeezeboxrpc.0.Players.SqueezePlay.", //Player anpassen
speakerList: ['SqueezePlay'] speakerList: ['SqueezePlay']
}] }]
}; };
@@ -486,7 +503,43 @@ let Buero_Alarm: PageAlarm =
"items": [<PageItem>{ id: "alias.0.Alarm" }] "items": [<PageItem>{ id: "alias.0.Alarm" }]
}; };
//Subpages 2 (+ Info) let button1Page: PageGrid =
{
'type': 'cardGrid',
'heading': 'Radio',
'useColor': true,
'subPage': false,
'parent': undefined,
'items': [
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.FFN', icon: 'radio', name: 'FFN', onColor: colorRadio},
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.Antenne' , icon: 'radio', name: 'Antenne Nds.', onColor: colorRadio},
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.NDR2', icon: 'radio', name: 'NDR2', onColor: colorRadio},
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.Bob', icon: 'radio', name: 'Radio BOB', onColor: colorRadio},
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.Spotify', icon: 'spotify', name: 'Party Playlist', onColor: colorSpotify},
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.Alexa', icon: 'playlist-music', name: 'Playlist 2021', onColor: colorAlexa}
]
};
let button2Page: PageEntities =
{
'type': 'cardEntities',
'heading': 'Büro',
'useColor': true,
'subPage': false,
'parent': undefined,
'items': [
<PageItem>{ id: 'alias.0.NSPanel_1.Schreibtischlampe'},
<PageItem>{ id: 'alias.0.NSPanel_1.Deckenbeleuchtung'}
]
};
//-- ENDE der Beispiele für Seitengestaltung -- Selbstdefinierte Aliase erforderlich ------------------
/********************************************************************************************************** */
//Service Pages mit Auto-Alias (Nachfolgende Seiten werden mit Alias automatisch angelegt)
/********************************************************************************************************** */
let Service: PageEntities = let Service: PageEntities =
{ {
"type": "cardEntities", "type": "cardEntities",
@@ -495,10 +548,10 @@ let Service: PageEntities =
"subPage": false, "subPage": false,
"parent": undefined, "parent": undefined,
"items": [ "items": [
<PageItem>{ id: "alias.0.NSPanel_1.NSPanel_AutoUpdate", name: "Auto-Updates" ,icon: "update", offColor: MSRed, onColor: MSGreen}, <PageItem>{ id: AliasPath + 'autoUpdate', name: "Auto-Updates" ,icon: "update", offColor: MSRed, onColor: MSGreen},
<PageItem>{ navigate: true, id: "NSPanel_Infos", icon: "information-outline", onColor: White, name: "NSPanel Infos"}, <PageItem>{ navigate: true, id: "NSPanel_Infos", icon: "information-outline", onColor: White, name: "NSPanel Infos"},
<PageItem>{ navigate: true, id: "NSPanel_Firmware_Updates", icon: "update", onColor: White, name: "Manuelle-Updates"}, <PageItem>{ navigate: true, id: "NSPanel_Firmware_Info", icon: "update", onColor: White, name: "Firmware Infos"},
<PageItem>{ navigate: true, id: "NSPanel_Einstellungen", icon: "wrench-outline", onColor: White, name: "Einstellungen"} <PageItem>{ navigate: true, id: "NSPanel_Einstellungen", icon: "wrench-outline", onColor: White, name: "Screensaver"}
] ]
}; };
@@ -511,90 +564,45 @@ let Service: PageEntities =
"subPage": true, "subPage": true,
"parent": Service, "parent": Service,
"items": [ "items": [
<PageItem>{ id: "alias.0.NSPanel_1.NSPanel_Hardware", name: "Hardware", icon: "memory", offColor: MSYellow, onColor: MSYellow, useColor: true}, <PageItem>{ id: AliasPath + 'Tasmota.Hardware', name: 'Hardware', icon: 'memory', offColor: MSYellow, onColor: MSYellow, useColor: true},
<PageItem>{ id: "alias.0.NSPanel_1.NSPanel_ESP_Temp", name: "ESP Temperatur", icon: "thermometer", unit: "°C", offColor: MSYellow, onColor: MSYellow, useColor: true}, <PageItem>{ id: AliasPath + 'Sensor.ESP32.Temperature', name: "ESP Temperatur", icon: "thermometer", unit: "°C", offColor: MSYellow, onColor: MSYellow, useColor: true},
<PageItem>{ id: "alias.0.NSPanel_1.NSPanel_UpTime", name: "Uptime", icon: "timeline-clock-outline", offColor: MSYellow, onColor: MSYellow, useColor: true}, <PageItem>{ id: AliasPath + 'Tasmota.Uptime', name: "Uptime", icon: "timeline-clock-outline", offColor: MSYellow, onColor: MSYellow, useColor: true},
<PageItem>{ id: "alias.0.NSPanel_1.NSPanel_RSSI", name: "Wifi-Signal", icon: "signal-distance-variant", unit: "dBm", offColor: MSYellow, onColor: MSYellow, useColor: true} <PageItem>{ id: AliasPath + 'Tasmota.Wifi.RSSI', name: "Wifi-Signal", icon: "signal-distance-variant", unit: "dBm", offColor: MSYellow, onColor: MSYellow, useColor: true}
] ]
}; };
//Subpage 2 von Subpages_2 //Subpage 2 von Subpages_2
let NSPanel_Einstellungen: PageEntities = let NSPanel_Einstellungen: PageEntities =
{ {
"type": "cardEntities", 'type': 'cardEntities',
"heading": "Screensaver", 'heading': 'Screensaver',
"useColor": true, 'useColor': true,
"subPage": true, 'subPage': true,
"parent": Service, 'parent': Service,
"items": [ 'items': [
<PageItem>{ id: "alias.0.NSPanel_1.Dimmode_BrightnessDay", name: "Brightness Tag", icon: "brightness-5", offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 5, maxValue: 10}, <PageItem>{ id: AliasPath + 'Dimmode.brightnessDay', name: 'Brightness Tag', icon: 'brightness-5', offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 5, maxValue: 10},
<PageItem>{ id: "alias.0.NSPanel_1.Dimmode_BrightnessNight", name: "Brightness Nacht", icon: "brightness-4", offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 0, maxValue: 4}, <PageItem>{ id: AliasPath + 'Dimmode.brightnessNight', name: 'Brightness Nacht', icon: 'brightness-4', offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 0, maxValue: 4},
<PageItem>{ id: "alias.0.NSPanel_1.Dimmode_HourDay", name: "Stunde Tag", icon: "sun-clock", offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 0, maxValue: 23}, <PageItem>{ id: AliasPath + 'Dimmode.hourDay', name: 'Stunde Tag', icon: 'sun-clock', offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 0, maxValue: 23},
<PageItem>{ id: "alias.0.NSPanel_1.Dimmode_HourNight", name: "Stunde Nacht", icon: "sun-clock-outline", offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 0, maxValue: 23} <PageItem>{ id: AliasPath + 'Dimmode.hourNight', name: 'Stunde Nacht', icon: 'sun-clock-outline', offColor: MSYellow, onColor: MSYellow, useColor: true, minValue: 0, maxValue: 23}
] ]
}; };
//Subpage 3 von Subpages_2 //Subpage 3 von Subpages_2
let NSPanel_Firmware_Updates: PageEntities = let NSPanel_Firmware_Info: PageEntities =
{ {
"type": "cardEntities", 'type': 'cardEntities',
"heading": "Firmware-Updates", 'heading': 'Firmware-Updates',
"useColor": true, 'useColor': true,
"subPage": true, 'subPage': true,
"parent": Service, 'parent': Service,
"items": [ 'items': [
<PageItem>{ id: "alias.0.NSPanel_1.Tasmota_Version", name: "Tasmota Firmware", useColor: true}, <PageItem>{ id: AliasPath + 'Tasmota.Version', name: 'Tasmota Firmware', offColor: MSYellow, onColor: MSYellow, useColor: true},
<PageItem>{ id: "alias.0.NSPanel_1.TFT_Firmware", name: "TFT-Firmware", useColor: true}, <PageItem>{ id: AliasPath + 'Display.TFTVersion', name: 'TFT-Firmware', offColor: MSYellow, onColor: MSYellow, useColor: true},
<PageItem>{ navigate: true, id: "Subpage_Level2", icon: "wrench-outline", onColor: White, name: "Subpage Level 2"} <PageItem>{ id: AliasPath + 'Display.BerryDriver', name: 'Berry-Treiber', offColor: MSYellow, onColor: MSYellow, useColor: true},
<PageItem>{ id: AliasPath + 'Display.Model', name: 'NSPanel Version', offColor: MSYellow, onColor: MSYellow, useColor: true}
] ]
}; };
//Subpage1 von Subpage3 von Subpages_2
let Subpage2_Level_2: PageEntities =
{
"type": "cardEntities",
"heading": "Firmware-Updates",
"useColor": true,
"subPage": true,
"parent": NSPanel_Firmware_Updates,
"items": [
<PageItem>{ id: "alias.0.NSPanel_1.Tasmota_Version", name: "Tasmota Firmware", useColor: true},
<PageItem>{ id: "alias.0.NSPanel_1.TFT_Firmware", name: "TFT-Firmware", useColor: true},
]
};
let button1Page: PageGrid =
{
"type": "cardGrid",
"heading": "Radio",
"useColor": true,
"subPage": false,
"parent": undefined,
"items": [
<PageItem>{ id: "alias.0.NSPanel_1.Radio.FFN", icon: "radio", name: "FFN", onColor: colorRadio},
<PageItem>{ id: "alias.0.NSPanel_1.Radio.Antenne" , icon: "radio", name: "Antenne Nds.", onColor: colorRadio},
<PageItem>{ id: "alias.0.NSPanel_1.Radio.NDR2", icon: "radio", name: "NDR2", onColor: colorRadio},
<PageItem>{ id: "alias.0.NSPanel_1.Radio.Bob", icon: "radio", name: "Radio BOB", onColor: colorRadio},
<PageItem>{ id: "alias.0.NSPanel_1.Radio.Spotify", icon: "spotify", name: "Party Playlist", onColor: colorSpotify},
<PageItem>{ id: "alias.0.NSPanel_1.Radio.Alexa", icon: "playlist-music", name: "Playlist 2021", onColor: colorAlexa}
]
};
let button2Page: PageEntities =
{
"type": "cardEntities",
"heading": "Büro",
"useColor": true,
"subPage": false,
"parent": undefined,
"items": [
<PageItem>{ id: "alias.0.NSPanel_1.Schreibtischlampe"},
<PageItem>{ id: "alias.0.NSPanel_1.Deckenbeleuchtung"}
]
};
//-- ENDE der Beispiele für Seitengestaltung -- Aliase erforderlich ------------------
export const config: Config = { export const config: Config = {
panelRecvTopic: 'mqtt.0.SmartHome.NSPanel_1.tele.RESULT', // anpassen panelRecvTopic: 'mqtt.0.SmartHome.NSPanel_1.tele.RESULT', // anpassen
panelSendTopic: 'mqtt.0.SmartHome.NSPanel_1.cmnd.CustomSend', // anpassen panelSendTopic: 'mqtt.0.SmartHome.NSPanel_1.cmnd.CustomSend', // anpassen
@@ -604,25 +612,26 @@ export const config: Config = {
fourthScreensaverEntity: { ScreensaverEntity: 'accuweather.0.Current.RelativeHumidity', ScreensaverEntityIcon: 'water-percent', ScreensaverEntityText: 'Luft', ScreensaverEntityUnitText: '%', ScreensaverEntityIconColor: {'val_min': 0, 'val_max': 100, 'val_best': 65} }, fourthScreensaverEntity: { ScreensaverEntity: 'accuweather.0.Current.RelativeHumidity', ScreensaverEntityIcon: 'water-percent', ScreensaverEntityText: 'Luft', ScreensaverEntityUnitText: '%', ScreensaverEntityIconColor: {'val_min': 0, 'val_max': 100, 'val_best': 65} },
alternativeScreensaverLayout: false, alternativeScreensaverLayout: false,
autoWeatherColorScreensaverLayout: true, autoWeatherColorScreensaverLayout: true,
mrIcon1ScreensaverEntity: { ScreensaverEntity: 'mqtt.0.SmartHome.NSPanel_1.stat.POWER1', ScreensaverEntityIcon: 'light-switch', ScreensaverEntityOnColor: On, ScreensaverEntityOffColor: Off }, mrIcon1ScreensaverEntity: { ScreensaverEntity: 'mqtt.0.SmartHome.NSPanel_1.stat.POWER1', ScreensaverEntityIcon: 'light-switch', ScreensaverEntityOnColor: On, ScreensaverEntityOffColor: HMIOff },
mrIcon2ScreensaverEntity: { ScreensaverEntity: 'mqtt.0.SmartHome.NSPanel_1.stat.POWER2', ScreensaverEntityIcon: 'lightbulb', ScreensaverEntityOnColor: On, ScreensaverEntityOffColor: Off }, mrIcon2ScreensaverEntity: { ScreensaverEntity: 'mqtt.0.SmartHome.NSPanel_1.stat.POWER2', ScreensaverEntityIcon: 'lightbulb', ScreensaverEntityOnColor: On, ScreensaverEntityOffColor: HMIOff },
timeoutScreensaver: 20, timeoutScreensaver: 20,
dimmode: 20, dimmode: 20,
active: 100, //Standard-Brightness TFT active: 100, //Standard-Brightness TFT
screenSaverDoubleClick: true, screenSaverDoubleClick: true,
locale: 'de-DE', // en-US, de-DE, nl-NL, da-DK, es-ES, fr-FR, it-IT, ru-RU, etc. locale: 'de-DE', // en-US, de-DE, nl-NL, da-DK, es-ES, fr-FR, it-IT, ru-RU, etc.
timeFormat: '%H:%M', // currently not used timeFormat: '%H:%M', // currently not used
dateFormat: '%A, %d. %B %Y', // currently not used dateFormat: '%A, %d. %B %Y', // currently not used
weatherEntity: 'alias.0.Wetter', // Dieser Alias muss erstellt werden, damit die 4 kleineren Icons (Wetter oder DP) angezeigt werden können weatherEntity: 'alias.0.Wetter', // Dieser Alias muss erstellt werden, damit die 4 kleineren Icons (Wetter oder DP) angezeigt werden können --> oder autoCreateAlias auf true
defaultOffColor: Off, defaultOffColor: Off,
defaultOnColor: On, defaultOnColor: On,
defaultColor: Off, defaultColor: Off,
defaultBackgroundColor: Black, //New Parameter defaultBackgroundColor: Black, //New Parameter
temperatureUnit: '°C', temperatureUnit: '°C',
pages: [ pages: [
SqueezeboxRPC, //Beispiel-Seite //SqueezeboxRPC, //Beispiel-Seite
Buero_Seite_1, //Beispiel-Seite Buero_Seite_1, //Beispiel-Seite
CardPowerExample, //Beispiel-Seite CardPowerExample, //Beispiel-Seite
Sonos, //Beispiel-Seite
SpotifyPremium, //Beispiel-Seite SpotifyPremium, //Beispiel-Seite
Alexa, //Beispiel-Seite Alexa, //Beispiel-Seite
Buero_Seite_2, //Beispiel-Seite Buero_Seite_2, //Beispiel-Seite
@@ -635,15 +644,16 @@ export const config: Config = {
Subpages_1, //Beispiel-Seite Subpages_1, //Beispiel-Seite
Buero_Themostat, //Beispiel-Seite Buero_Themostat, //Beispiel-Seite
Buero_Alarm, //Beispiel-Seite Buero_Alarm, //Beispiel-Seite
Service //Beispiel-Seite
Service //Auto-Alias Service Page
], ],
subPages: [ subPages: [
Abfall, //Beispiel-Unterseite Abfall, //Beispiel-Unterseite
WLAN, //Beispiel-Unterseite WLAN, //Beispiel-Unterseite
NSPanel_Infos, //Beispiel-Unterseite
NSPanel_Einstellungen, //Beispiel-Unterseite NSPanel_Infos, //Auto-Alias Service Page
NSPanel_Firmware_Updates, //Beispiel-Unterseite NSPanel_Einstellungen, //Auto-Alias Service Page
Subpage2_Level_2 NSPanel_Firmware_Info //Auto-Alias Service Page
], ],
button1Page: button1Page, //Beispiel-Seite auf Button 1, wenn Rule2 definiert - Wenn nicht definiert --> button1Page: null, button1Page: button1Page, //Beispiel-Seite auf Button 1, wenn Rule2 definiert - Wenn nicht definiert --> button1Page: null,
button2Page: button2Page //Beispiel-Seite auf Button 2, wenn Rule2 definiert - Wenn nicht definiert --> button1Page: null, button2Page: button2Page //Beispiel-Seite auf Button 2, wenn Rule2 definiert - Wenn nicht definiert --> button1Page: null,
@@ -656,6 +666,27 @@ const request = require('request');
let useMediaEvents: boolean = false; let useMediaEvents: boolean = false;
let timeoutMedia: any; let timeoutMedia: any;
// Create atomatically Wheather-Alias, if exists accuweather.0. and is not exists Config-Wheather-Alias
async function CreateWeatherAlias () {
if (autoCreateAlias) {
try {
if (!existsState(config.weatherEntity + '.ICON') && existsState('accuweather.0.Current.WeatherIcon')) {
console.log('Wetter-Alias existiert noch nicht, wird jetzt angelegt');
setObject(config.weatherEntity, {_id: config.weatherEntity, type: 'channel', common: {role: 'weatherCurrent', name:'media'}, native: {}});
await createAliasAsync(config.weatherEntity + '.ICON', 'accuweather.0.Current.WeatherIcon', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ICON' });
await createAliasAsync(config.weatherEntity + '.TEMP', 'accuweather.0.Current.Temperature', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature', name: 'TEMP' });
await createAliasAsync(config.weatherEntity + '.TEMP_MIN', 'accuweather.0.Daily.Day1.Temperature.Minimum', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature.forecast.0', name: 'TEMP_MIN' });
await createAliasAsync(config.weatherEntity + '.TEMP_MAX', 'accuweather.0.Daily.Day1.Temperature.Maximum', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature.max.forecast.0', name: 'TEMP_MAX' });
} else {
console.log('Wetter-Alias existiert bereits');
}
} catch (err) {
console.log('function InitPageNavi: ' + err.message);
}
}
}
CreateWeatherAlias();
//---------------------Begin PageNavi //---------------------Begin PageNavi
async function InitPageNavi() { async function InitPageNavi() {
try { try {
@@ -734,21 +765,33 @@ async function InitDimmode() {
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.State>{ val: 8, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.State>{ val: 8, ack: true });
setObject(AliasPath + 'Dimmode.brightnessDay', {type: 'channel', common: {role: 'slider', name:'brightnessDay'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.brightnessDay.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.brightnessDay.SET', NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourDay')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourDay')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.State>{ val: 7, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.State>{ val: 7, ack: true });
setObject(AliasPath + 'Dimmode.hourDay', {type: 'channel', common: {role: 'slider', name:'hourDay'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.hourDay.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_hourDay', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.hourDay.SET', NSPanel_Path + 'NSPanel_Dimmode_hourDay', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.State>{ val: 1, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.State>{ val: 1, ack: true });
setObject(AliasPath + 'Dimmode.brightnessNight', {type: 'channel', common: {role: 'slider', name:'brightnessNight'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.brightnessNight.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.brightnessNight.SET', NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourNight')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourNight')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.State>{ val: 22, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.State>{ val: 22, ack: true });
setObject(AliasPath + 'Dimmode.hourNight', {type: 'channel', common: {role: 'slider', name:'hourNight'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.hourNight.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_hourNight', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.hourNight.SET', NSPanel_Path + 'NSPanel_Dimmode_hourNight', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
const vTimeDay = getState(NSPanel_Path + 'NSPanel_Dimmode_hourDay').val; const vTimeDay = getState(NSPanel_Path + 'NSPanel_Dimmode_hourDay').val;
@@ -1167,10 +1210,17 @@ on({ id: NSPanel_Path + 'popupNotify.popupNotifyAction', change: 'any' }, async
async function get_panel_update_data() { async function get_panel_update_data() {
try { try {
await createStateAsync(NSPanel_Path + 'NSPanel_autoUpdate', false, <iobJS.StateCommon>{ read: true, write: true, name: 'Auto-Update', type: 'boolean', def: false }); await createStateAsync(NSPanel_Path + 'NSPanel_autoUpdate', false, <iobJS.StateCommon>{ read: true, write: true, name: 'Auto-Update', type: 'boolean', def: false });
if (autoCreateAlias) {
setObject(AliasPath + 'autoUpdate', {type: 'channel', common: {role: 'socket', name:'AutoUpdate'}, native: {}});
await createAliasAsync(AliasPath + 'autoUpdate.ACTUAL', NSPanel_Path + 'NSPanel_autoUpdate', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'autoUpdate.SET', NSPanel_Path + 'NSPanel_autoUpdate', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
}
await createStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.StateCommon>{ type: 'string' }); await createStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.StateCommon>{ type: 'string' });
await setStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.State>{ val: get_current_tasmota_ip_address(), ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.State>{ val: get_current_tasmota_ip_address(), ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'ipAddress', {type: 'channel', common: {role: 'info', name:'ipAddress'}, native: {}});
await createAliasAsync(AliasPath + 'ipAddress.ACTUAL', NSPanel_Path + 'NSPanel_ipAddress', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
}
get_online_tasmota_firmware_version(); get_online_tasmota_firmware_version();
get_current_berry_driver_version(); get_current_berry_driver_version();
get_online_berry_driver_version(); get_online_berry_driver_version();
@@ -1237,6 +1287,10 @@ function get_current_berry_driver_version() {
try { try {
await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.State>{ val: JSON.parse(result).nlui_driver_version, ack: true }); await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.State>{ val: JSON.parse(result).nlui_driver_version, ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'Display.BerryDriver', {type: 'channel', common: {role: 'info', name: 'Berry Driver'}, native: {}});
await createAliasAsync(AliasPath + 'Display.BerryDriver.ACTUAL', NSPanel_Path + 'Berry_Driver.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
}
} catch (err) { } catch (err) {
console.warn('get_current_berry_driver_version: ' + err.message); console.warn('get_current_berry_driver_version: ' + err.message);
} }
@@ -1287,6 +1341,28 @@ function get_tasmota_status0() {
} catch (err) { } catch (err) {
console.warn('get_tasmota_status0' + err.message); console.warn('get_tasmota_status0' + err.message);
} }
if (autoCreateAlias) {
setObject(AliasPath + 'Tasmota.Uptime', {type: 'channel', common: {role: 'info', name: 'Uptime'}, native: {}});
setObject(AliasPath + 'Tasmota.Version', {type: 'channel', common: {role: 'info', name:'Version'}, native: {}});
setObject(AliasPath + 'Tasmota.Hardware', {type: 'channel', common: {role: 'info', name: 'Hardware'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.AP', {type: 'channel', common: {role: 'info', name:'AP'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.SSId', {type: 'channel', common: {role: 'info', name:'SSId'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.BSSId', {type: 'channel', common: {role: 'info', name: 'BSSId'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.Channel', {type: 'channel', common: {role: 'info', name:'Channel'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.Mode', {type: 'channel', common: {role: 'info', name: 'Mode'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.RSSI', {type: 'channel', common: {role: 'info', name:'RSSI'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.Signal', {type: 'channel', common: {role: 'info', name:'Signal'}, native: {}});
await createAliasAsync(AliasPath + 'Tasmota.Uptime.ACTUAL', NSPanel_Path + 'Tasmota.Uptime', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Version.ACTUAL', NSPanel_Path + 'Tasmota.Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Hardware.ACTUAL', NSPanel_Path + 'Tasmota.Hardware', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.AP.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.AP', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.SSId.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.SSId', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.BSSId.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.BSSId', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Channel.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Channel', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Mode.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Mode', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.RSSI.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.RSSI', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Signal.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Signal', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
}
}); });
} catch (err) { } catch (err) {
console.warn('error requesting firmware in function get_tasmota_status0: ' + err.message); console.warn('error requesting firmware in function get_tasmota_status0: ' + err.message);
@@ -1386,6 +1462,13 @@ on({ id: config.panelRecvTopic }, async (obj) => {
await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', <iobJS.State>{ val: split[2], ack: true }); await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', <iobJS.State>{ val: split[2], ack: true });
await setStateAsync(NSPanel_Path + 'NSPanel_Version', <iobJS.State>{ val: split[3], ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Version', <iobJS.State>{ val: split[3], ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'Display.TFTVersion', {type: 'channel', common: {role: 'info', name:'Display.TFTVersion'}, native: {}});
setObject(AliasPath + 'Display.Model', {type: 'channel', common: {role: 'info', name:'Display.Model'}, native: {}});
await createAliasAsync(AliasPath + 'Display.TFTVersion.ACTUAL', NSPanel_Path + 'Display_Firmware.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Display.Model.ACTUAL', NSPanel_Path + 'NSPanel_Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
}
} }
} catch (err) { } catch (err) {
console.warn('error rceiving CustomRecv: ' + err.message); console.warn('error rceiving CustomRecv: ' + err.message);
@@ -2485,6 +2568,16 @@ function unsubscribeMediaSubscriptions(): void {
unsubscribe(mediaID + '.VOLUME') unsubscribe(mediaID + '.VOLUME')
} }
} }
for (let i = 0; i < config.subPages.length; i++) {
if (config.subPages[i].type == 'cardMedia') {
let mediaID = config.subPages[i].items[0].id;
unsubscribe(mediaID + '.STATE')
unsubscribe(mediaID + '.ARTIST')
unsubscribe(mediaID + '.TITLE')
unsubscribe(mediaID + '.ALBUM')
unsubscribe(mediaID + '.VOLUME')
}
}
} }
function subscribeMediaSubscriptions(id: string): void { function subscribeMediaSubscriptions(id: string): void {
@@ -2498,6 +2591,91 @@ function subscribeMediaSubscriptions(id: string): void {
}); });
} }
async function createAutoMediaAlias(id: string, mediaDevice: string, adapterPlayerInstance: string) {
if (autoCreateAlias) {
if (adapterPlayerInstance == 'alexa2.0.') {
if (existsObject(id) == false){
console.log('Alexa Alias ' + id + ' existiert nicht - wird jetzt angelegt')
let dpPath: string = adapterPlayerInstance + 'Echo-Devices.' + mediaDevice;
try {
setObject(id, {_id: id, type: 'channel', common: {role: 'media', name:'media'}, native: {}});
await createAliasAsync(id + '.ACTUAL', dpPath + '.Player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' });
await createAliasAsync(id + '.ALBUM', dpPath + '.Player.currentAlbum', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' });
await createAliasAsync(id + '.ARTIST', dpPath + '.Player.currentArtist', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' });
await createAliasAsync(id + '.TITLE', dpPath + '.Player.currentTitle', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' });
await createAliasAsync(id + '.NEXT', dpPath + '.Player.controlNext', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' });
await createAliasAsync(id + '.PREV', dpPath + '.Player.controlPrevious', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' });
await createAliasAsync(id + '.PLAY', dpPath + '.Player.controlPlay', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' });
await createAliasAsync(id + '.PAUSE', dpPath + '.Player.controlPause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' });
await createAliasAsync(id + '.STOP', dpPath + '.Commands.deviceStop', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' });
await createAliasAsync(id + '.STATE', dpPath + '.Player.currentState', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' });
await createAliasAsync(id + '.VOLUME', dpPath + '.Player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' });
} catch (err) {
console.warn('function createAutoMediaAlias: ' + err.message);
}
}
}
if (adapterPlayerInstance == 'spotify-premium.0.') {
if (existsObject(id) == false){
console.log('Spotify Alias ' + id + ' existiert nicht - wird jetzt angelegt')
let dpPath: string = adapterPlayerInstance;
try {
setObject(id, {_id: id + 'player', type: 'channel', common: {role: 'media', name:'media'}, native: {}});
await createAliasAsync(id + '.ACTUAL', dpPath + 'player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' });
await createAliasAsync(id + '.ALBUM', dpPath + 'player.album', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' });
await createAliasAsync(id + '.ARTIST', dpPath + 'player.artistName', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' });
await createAliasAsync(id + '.TITLE', dpPath + 'player.trackName', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' });
await createAliasAsync(id + '.CONTEXT_DESCRIPTION', dpPath + 'player.contextDescription', true, <iobJS.StateCommon>{ type: 'string', role: 'media.station', name: 'CONTEXT_DESCRIPTION' });
await createAliasAsync(id + '.NEXT', dpPath + 'player.skipPlus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' });
await createAliasAsync(id + '.PREV', dpPath + 'player.skipMinus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' });
await createAliasAsync(id + '.PLAY', dpPath + 'player.play', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' });
await createAliasAsync(id + '.PAUSE', dpPath + 'player.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' });
await createAliasAsync(id + '.STOP', dpPath + 'player.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' });
await createAliasAsync(id + '.STATE', dpPath + 'player.isPlaying', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' });
await createAliasAsync(id + '.VOLUME', dpPath + 'player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' });
} catch (err) {
console.warn('function createAutoMediaAlias: ' + err.message);
}
}
}
if (adapterPlayerInstance == 'sonos.0.') {
if (existsObject(id) == false){
console.log('Sonos Alias ' + id + ' existiert nicht - wird jetzt angelegt')
let dpPath: string = adapterPlayerInstance + 'root.' + mediaDevice;
try {
setObject(id, {_id: id, type: 'channel', common: {role: 'media', name:'media'}, native: {}});
await createAliasAsync(id + '.ACTUAL', dpPath + '.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' });
await createAliasAsync(id + '.ALBUM', dpPath + '.current_album', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' });
await createAliasAsync(id + '.ARTIST', dpPath + '.current_artist', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' });
await createAliasAsync(id + '.TITLE', dpPath + '.current_title', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' });
await createAliasAsync(id + '.CONTEXT_DESCRIPTION', dpPath + '.current_station', true, <iobJS.StateCommon>{ type: 'string', role: 'media.station', name: 'CONTEXT_DESCRIPTION' });
await createAliasAsync(id + '.NEXT', dpPath + '.next', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' });
await createAliasAsync(id + '.PREV', dpPath + '.prev', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' });
await createAliasAsync(id + '.PLAY', dpPath + '.play', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' });
await createAliasAsync(id + '.PAUSE', dpPath + '.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' });
await createAliasAsync(id + '.STOP', dpPath + '.stop', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' });
await createAliasAsync(id + '.STATE', dpPath + '.state_simple', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' });
await createAliasAsync(id + '.VOLUME', dpPath + '.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' });
} catch (err) {
console.warn('function createAutoMediaAlias: ' + err.message);
}
}
}
}
}
function GenerateMediaPage(page: PageMedia): Payload[] { function GenerateMediaPage(page: PageMedia): Payload[] {
try { try {
let id = page.items[0].id let id = page.items[0].id
@@ -2508,6 +2686,11 @@ function GenerateMediaPage(page: PageMedia): Payload[] {
subscribeMediaSubscriptions(id); subscribeMediaSubscriptions(id);
if (page.items[0].autoCreateALias) {
let vMediaDevice = (page.items[0].mediaDevice != undefined) ? page.items[0].mediaDevice : '';
createAutoMediaAlias(id, vMediaDevice, page.items[0].adapterPlayerInstance);
}
out_msgs.push({ payload: 'pageType~cardMedia' }); out_msgs.push({ payload: 'pageType~cardMedia' });
if (existsObject(id)) { if (existsObject(id)) {
let name = getState(id + '.ALBUM').val; let name = getState(id + '.ALBUM').val;
@@ -3424,6 +3607,7 @@ function HandleButtonEvent(words): void {
} }
} }
//Determination of page navigation (CustomSend-Payload)
function GetNavigationString(pageId: number): string { function GetNavigationString(pageId: number): string {
try { try {
@@ -3431,14 +3615,20 @@ function GetNavigationString(pageId: number): string {
console.log(pageId); console.log(pageId);
} }
// left navigation arrow | right navigation arrow
// X|X
// 0 = no arrow
// 1 = right or left navigation arrow
// 2 = up navigation arrow
if (activePage.subPage) if (activePage.subPage)
return '1|0'; return '1|0';
switch (pageId) { switch (pageId) {
case 0: case 0:
return '0|1'; return '1|1';
case config.pages.length - 1: case config.pages.length - 1:
return '1|0'; return '1|1';
case -1: case -1:
return '2|0'; return '2|0';
case -2: case -2:
@@ -3446,6 +3636,7 @@ function GetNavigationString(pageId: number): string {
default: default:
return '1|1'; return '1|1';
} }
} catch (err) { } catch (err) {
console.log('function GetNavigationString: ' + err.message); console.log('function GetNavigationString: ' + err.message);
} }
@@ -4564,6 +4755,13 @@ on({ id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESU
await setStateAsync(NSPanel_Path + 'Sensor.TempUnit', <iobJS.State>{ val: '°' + Tasmota_Sensor.TempUnit, ack: true }); await setStateAsync(NSPanel_Path + 'Sensor.TempUnit', <iobJS.State>{ val: '°' + Tasmota_Sensor.TempUnit, ack: true });
await setStateAsync(NSPanel_Path + 'Sensor.ANALOG.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ANALOG.Temperature1), ack: true }); await setStateAsync(NSPanel_Path + 'Sensor.ANALOG.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ANALOG.Temperature1), ack: true });
await setStateAsync(NSPanel_Path + 'Sensor.ESP32.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ESP32.Temperature), ack: true }); await setStateAsync(NSPanel_Path + 'Sensor.ESP32.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ESP32.Temperature), ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'Sensor.ANALOG.Temperature', {type: 'channel', common: {role: 'info', name: ''}, native: {}});
setObject(AliasPath + 'Sensor.ESP32.Temperature', {type: 'channel', common: {role: 'info', name:''}, native: {}});
await createAliasAsync(AliasPath + 'Sensor.ANALOG.Temperature.ACTUAL', NSPanel_Path + 'Sensor.ANALOG.Temperature', true, <iobJS.StateCommon>{ type: 'number', 'unit': '°C' });
await createAliasAsync(AliasPath + 'Sensor.ESP32.Temperature.ACTUAL', NSPanel_Path + 'Sensor.ESP32.Temperature', true, <iobJS.StateCommon>{ type: 'number', 'unit': '°C' });
}
} catch (err) { } catch (err) {
console.warn('error with reading senor-data: '+ err.message); console.warn('error with reading senor-data: '+ err.message);
} }
@@ -4784,7 +4982,8 @@ type PageItem = {
mediaDevice: (string | undefined), mediaDevice: (string | undefined),
targetPage: (string | undefined), targetPage: (string | undefined),
speakerList: (string[] | undefined), speakerList: (string[] | undefined),
hidePassword: (boolean | undefined) hidePassword: (boolean | undefined),
autoCreateALias: (boolean | undefined)
} }
type DimMode = { type DimMode = {

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
TypeScript v3.5.0.4 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf TypeScript v3.5.0.5 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf
- abgestimmt auf TFT 43 / v3.5.0 / BerryDriver 4 / Tasmota 12.2.0 - abgestimmt auf TFT 43 / v3.5.0 / BerryDriver 4 / Tasmota 12.2.0
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker @joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
@@ -7,6 +7,7 @@ icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroke
ioBroker-Unterstützung: https://forum.iobroker.net/topic/50888/sonoff-nspanel ioBroker-Unterstützung: https://forum.iobroker.net/topic/50888/sonoff-nspanel
WIKI zu diesem Projekt unter: https://github.com/joBr99/nspanel-lovelace-ui/wiki (siehe Sidebar) WIKI zu diesem Projekt unter: https://github.com/joBr99/nspanel-lovelace-ui/wiki (siehe Sidebar)
Icons unter: https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/master/cheatsheet.html Icons unter: https://htmlpreview.github.io/?https://github.com/jobr99/Generate-HASP-Fonts/blob/master/cheatsheet.html
******************************************************************************* *******************************************************************************
Achtung Änderung des Sonoff ESP-Temperatursensors Achtung Änderung des Sonoff ESP-Temperatursensors
!!! Bitte "SetOption146 1" in der Tasmota-Console ausführen !!! !!! Bitte "SetOption146 1" in der Tasmota-Console ausführen !!!
@@ -63,11 +64,22 @@ ReleaseNotes:
- 27.10.2022 - v3.5.0.2 Applied Boy Scout Rule (Fixed some typos, changed var to let, fixed min/max colorTemp Bug) - 27.10.2022 - v3.5.0.2 Applied Boy Scout Rule (Fixed some typos, changed var to let, fixed min/max colorTemp Bug)
- 30.10.2022 - v3.5.0.3 Fixed Media Play/Pause icon for alexa (and others) devices - 30.10.2022 - v3.5.0.3 Fixed Media Play/Pause icon for alexa (and others) devices
- 31.10.2022 - v3.5.0.4 Reengineering Media Subscriptions - 31.10.2022 - v3.5.0.4 Reengineering Media Subscriptions
- 02.11.2022 - v3.5.0.5 Page navigation continues with page 0 from the last page
- 04.11.2022 - v3.5.0.5 Create Auto-Alias for Service Pages
- 07.11.2022 - v3.5.0.5 Create Auto-Alias for Alexa2, Spotify-Premium, Sonos
- 08.11.2022 - v3.5.0.5 Create Auto-Alias for Wheather-Forcast (Screensaver Big-Icon)
*****************************************************************************************************************
* Falls Aliase durch das Skript erstellt werden sollen, muss in der JavaScript Instanz "setObect" gesetzt sein! *
*****************************************************************************************************************
Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden
Tasmota Konsole: Tasmota Konsole:
Rule2 on Button1#state do Publish %topic%/%prefix%/RESULT {"CustomRecv":"event,button1"} endon on Button2#state do Publish %topic%/%prefix%/RESULT {"CustomRecv":"event,button2"} endon Rule2 on Button1#state do Publish %topic%/%prefix%/RESULT {"CustomRecv":"event,button1"} endon on Button2#state do Publish %topic%/%prefix%/RESULT {"CustomRecv":"event,button2"} endon
Rule2 1 (Rule aktivieren) Rule2 1 (Rule aktivieren)
Rule2 0 (Rule deaktivieren) Rule2 0 (Rule deaktivieren)
Mögliche Seiten-Ansichten: Mögliche Seiten-Ansichten:
screensaver Page - wird nach definiertem Zeitraum (config) mit Dimm-Modus aktiv (Uhrzeit, Datum, Aktuelle Temperatur mit Symbol) screensaver Page - wird nach definiertem Zeitraum (config) mit Dimm-Modus aktiv (Uhrzeit, Datum, Aktuelle Temperatur mit Symbol)
(die 4 kleineren Icons können als Wetter-Vorschau + 4Tage (Symbol + Höchsttemperatur) oder zur Anzeige definierter Infos konfiguriert werden) (die 4 kleineren Icons können als Wetter-Vorschau + 4Tage (Symbol + Höchsttemperatur) oder zur Anzeige definierter Infos konfiguriert werden)
@@ -77,11 +89,13 @@ Mögliche Seiten-Ansichten:
cardMedia Page - Mediaplayer - Ausnahme: Alias sollte mit Alias-Manager automatisch über Alexa-Verzeichnis Player angelegt werden cardMedia Page - Mediaplayer - Ausnahme: Alias sollte mit Alias-Manager automatisch über Alexa-Verzeichnis Player angelegt werden
cardAlarm Page - Alarmseite mit Zustand und Tastenfeld cardAlarm Page - Alarmseite mit Zustand und Tastenfeld
cardPower Page - Energiefluss cardPower Page - Energiefluss
Popup-Pages: Popup-Pages:
popupLight Page - in Abhängigkeit zum gewählten Alias werden "Helligkeit", "Farbtemperatur" und "Farbauswahl" bereitgestellt popupLight Page - in Abhängigkeit zum gewählten Alias werden "Helligkeit", "Farbtemperatur" und "Farbauswahl" bereitgestellt
popupShutter Page - die Shutter-Position (Rollo, Jalousie, Markise, Leinwand, etc.) kann über einen Slider verändert werden. popupShutter Page - die Shutter-Position (Rollo, Jalousie, Markise, Leinwand, etc.) kann über einen Slider verändert werden.
popupNotify Page - Info - Seite mit Headline Text und Buttons - Intern für manuelle Updates / Extern zur Befüllung von Datenpunkten unter 0_userdata popupNotify Page - Info - Seite mit Headline Text und Buttons - Intern für manuelle Updates / Extern zur Befüllung von Datenpunkten unter 0_userdata
screensaver Notify - Über zwei externe Datenpunkte in 0_userdata können "Headline" und "Text" an den Screensaver zur Info gesendet werden screensaver Notify - Über zwei externe Datenpunkte in 0_userdata können "Headline" und "Text" an den Screensaver zur Info gesendet werden
Mögliche Aliase: (Vorzugsweise mit ioBroker-Adapter "Geräte verwalten" konfigurieren, da SET, GET, ACTUAL, etc. verwendet werden) Mögliche Aliase: (Vorzugsweise mit ioBroker-Adapter "Geräte verwalten" konfigurieren, da SET, GET, ACTUAL, etc. verwendet werden)
Info - Werte aus Datenpunkt Info - Werte aus Datenpunkt
Schieberegler - Slider numerische Werte (SET/ACTUAL) Schieberegler - Slider numerische Werte (SET/ACTUAL)
@@ -106,6 +120,7 @@ Mögliche Aliase: (Vorzugsweise mit ioBroker-Adapter "Geräte verwalten" konfigu
Feuchtigkeit - Anzeige von Humidity - Datenpunkten, analog Info Feuchtigkeit - Anzeige von Humidity - Datenpunkten, analog Info
Medien - Steuerung von Alexa - Über Alias-Manager im Verzeichnis Player automatisch anlegen (Geräte-Manager funktioniert nicht) Medien - Steuerung von Alexa - Über Alias-Manager im Verzeichnis Player automatisch anlegen (Geräte-Manager funktioniert nicht)
Wettervorhersage - Aktuelle Außen-Temperatur (Temp) und aktuelles AccuWeather-Icon (Icon) für Screensaver Wettervorhersage - Aktuelle Außen-Temperatur (Temp) und aktuelles AccuWeather-Icon (Icon) für Screensaver
Interne Sonoff-Sensoren (über Tasmota): Interne Sonoff-Sensoren (über Tasmota):
ESP-Temperatur - wird in 0_userdata.0. abgelegt, kann als Alias importiert werden --> SetOption146 1 ESP-Temperatur - wird in 0_userdata.0. abgelegt, kann als Alias importiert werden --> SetOption146 1
Temperatur - Raumtemperatur - wird in 0_userdata.0. abgelegt, kann als Alias importiert werden Temperatur - Raumtemperatur - wird in 0_userdata.0. abgelegt, kann als Alias importiert werden
@@ -114,13 +129,16 @@ Interne Sonoff-Sensoren (über Tasmota):
Timestamp - wird in 0_userdata.0. Zeitpunkt der letzten Sensorübertragung Timestamp - wird in 0_userdata.0. Zeitpunkt der letzten Sensorübertragung
Tasmota-Status0 - (zyklische Ausführung) Tasmota-Status0 - (zyklische Ausführung)
liefert relevanten Tasmota-Informationen und kann bei Bedarf in "function get_tasmota_status0()" erweitert werden. Daten werden in 0_userdata.0. abgelegt liefert relevanten Tasmota-Informationen und kann bei Bedarf in "function get_tasmota_status0()" erweitert werden. Daten werden in 0_userdata.0. abgelegt
Erforderliche Adapter: Erforderliche Adapter:
AccuWeather: - Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver AccuWeather: - Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver
Alexa2: - Bei Nutzung der dynamischen SpeakerList in der cardMedia Alexa2: - Bei Nutzung der dynamischen SpeakerList in der cardMedia
Geräte verwalten - Für Erstellung der Aliase Geräte verwalten - Für Erstellung der Aliase
Alias-Manager - !!! ausschließlich für MEDIA-Alias Alias-Manager - !!! ausschließlich für MEDIA-Alias
MQTT-Adapter - Für Kommunikation zwischen Skript und Tasmota MQTT-Adapter - Für Kommunikation zwischen Skript und Tasmota
JavaScript-Adapter JavaScript-Adapter
Upgrades in Konsole: Upgrades in Konsole:
Tasmota BerryDriver : Backlog UpdateDriverVersion https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; Restart 1 Tasmota BerryDriver : Backlog UpdateDriverVersion https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; Restart 1
TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v3.5.0.tft TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v3.5.0.tft
@@ -129,9 +147,12 @@ Upgrades in Konsole:
let Icons = new IconsSelector(); let Icons = new IconsSelector();
let timeoutSlider: any; let timeoutSlider: any;
let manually_Update = false; let manually_Update = false;
const autoCreateAlias = true; //Für diese Option muss der Haken in setObjects in deiner javascript.X. Instanz gesetzt sein.
const NSPanel_Path = '0_userdata.0.NSPanel.1.'; const NSPanel_Path = '0_userdata.0.NSPanel.1.';
const NSPanel_Alarm_Path = '0_userdata.0.NSPanel.'; //Neuer Pfad für gemeinsame Nutzung durch mehrere Panels (bei Nutzung der cardAlarm) const NSPanel_Alarm_Path = '0_userdata.0.NSPanel.'; //Neuer Pfad für gemeinsame Nutzung durch mehrere Panels (bei Nutzung der cardAlarm)
let AliasPath: string = 'alias.0.' + NSPanel_Path.substring(13, NSPanel_Path.length);
const Debug = false; const Debug = false;
// Variablen zur Steuerung der Wettericons auf dem Screensaver (Steuerung in 0_userdata.0.XPANELX.ScreensaverInfo) // Variablen zur Steuerung der Wettericons auf dem Screensaver (Steuerung in 0_userdata.0.XPANELX.ScreensaverInfo)
@@ -262,6 +283,27 @@ const request = require('request');
let useMediaEvents: boolean = false; let useMediaEvents: boolean = false;
let timeoutMedia: any; let timeoutMedia: any;
// Create atomatically Wheather-Alias, if exists accuweather.0. and is not exists Config-Wheather-Alias
async function CreateWeatherAlias () {
if (autoCreateAlias) {
try {
if (!existsState(config.weatherEntity + '.ICON') && existsState('accuweather.0.Current.WeatherIcon')) {
console.log('Wetter-Alias existiert noch nicht, wird jetzt angelegt');
setObject(config.weatherEntity, {_id: config.weatherEntity, type: 'channel', common: {role: 'weatherCurrent', name:'media'}, native: {}});
await createAliasAsync(config.weatherEntity + '.ICON', 'accuweather.0.Current.WeatherIcon', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ICON' });
await createAliasAsync(config.weatherEntity + '.TEMP', 'accuweather.0.Current.Temperature', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature', name: 'TEMP' });
await createAliasAsync(config.weatherEntity + '.TEMP_MIN', 'accuweather.0.Daily.Day1.Temperature.Minimum', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature.forecast.0', name: 'TEMP_MIN' });
await createAliasAsync(config.weatherEntity + '.TEMP_MAX', 'accuweather.0.Daily.Day1.Temperature.Maximum', true, <iobJS.StateCommon>{ type: 'number', role: 'value.temperature.max.forecast.0', name: 'TEMP_MAX' });
} else {
console.log('Wetter-Alias existiert bereits');
}
} catch (err) {
console.log('function InitPageNavi: ' + err.message);
}
}
}
CreateWeatherAlias();
//---------------------Begin PageNavi //---------------------Begin PageNavi
async function InitPageNavi() { async function InitPageNavi() {
try { try {
@@ -340,21 +382,33 @@ async function InitDimmode() {
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.State>{ val: 8, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.State>{ val: 8, ack: true });
setObject(AliasPath + 'Dimmode.brightnessDay', {type: 'channel', common: {role: 'slider', name:'brightnessDay'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.brightnessDay.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.brightnessDay.SET', NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourDay')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourDay')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.State>{ val: 7, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourDay', <iobJS.State>{ val: 7, ack: true });
setObject(AliasPath + 'Dimmode.hourDay', {type: 'channel', common: {role: 'slider', name:'hourDay'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.hourDay.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_hourDay', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.hourDay.SET', NSPanel_Path + 'NSPanel_Dimmode_hourDay', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.State>{ val: 1, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', <iobJS.State>{ val: 1, ack: true });
setObject(AliasPath + 'Dimmode.brightnessNight', {type: 'channel', common: {role: 'slider', name:'brightnessNight'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.brightnessNight.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.brightnessNight.SET', NSPanel_Path + 'NSPanel_Dimmode_brightnessNight', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourNight')) { if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_hourNight')) {
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.State>{ val: 22, ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Dimmode_hourNight', <iobJS.State>{ val: 22, ack: true });
setObject(AliasPath + 'Dimmode.hourNight', {type: 'channel', common: {role: 'slider', name:'hourNight'}, native: {}});
await createAliasAsync(AliasPath + 'Dimmode.hourNight.ACTUAL', NSPanel_Path + 'NSPanel_Dimmode_hourNight', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Dimmode.hourNight.SET', NSPanel_Path + 'NSPanel_Dimmode_hourNight', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
} }
const vTimeDay = getState(NSPanel_Path + 'NSPanel_Dimmode_hourDay').val; const vTimeDay = getState(NSPanel_Path + 'NSPanel_Dimmode_hourDay').val;
@@ -773,10 +827,17 @@ on({ id: NSPanel_Path + 'popupNotify.popupNotifyAction', change: 'any' }, async
async function get_panel_update_data() { async function get_panel_update_data() {
try { try {
await createStateAsync(NSPanel_Path + 'NSPanel_autoUpdate', false, <iobJS.StateCommon>{ read: true, write: true, name: 'Auto-Update', type: 'boolean', def: false }); await createStateAsync(NSPanel_Path + 'NSPanel_autoUpdate', false, <iobJS.StateCommon>{ read: true, write: true, name: 'Auto-Update', type: 'boolean', def: false });
if (autoCreateAlias) {
setObject(AliasPath + 'autoUpdate', {type: 'channel', common: {role: 'socket', name:'AutoUpdate'}, native: {}});
await createAliasAsync(AliasPath + 'autoUpdate.ACTUAL', NSPanel_Path + 'NSPanel_autoUpdate', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'autoUpdate.SET', NSPanel_Path + 'NSPanel_autoUpdate', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
}
await createStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.StateCommon>{ type: 'string' }); await createStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.StateCommon>{ type: 'string' });
await setStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.State>{ val: get_current_tasmota_ip_address(), ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_ipAddress', <iobJS.State>{ val: get_current_tasmota_ip_address(), ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'ipAddress', {type: 'channel', common: {role: 'info', name:'ipAddress'}, native: {}});
await createAliasAsync(AliasPath + 'ipAddress.ACTUAL', NSPanel_Path + 'NSPanel_ipAddress', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
}
get_online_tasmota_firmware_version(); get_online_tasmota_firmware_version();
get_current_berry_driver_version(); get_current_berry_driver_version();
get_online_berry_driver_version(); get_online_berry_driver_version();
@@ -843,6 +904,10 @@ function get_current_berry_driver_version() {
try { try {
await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.StateCommon>{ type: 'number' }); await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.StateCommon>{ type: 'number' });
await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.State>{ val: JSON.parse(result).nlui_driver_version, ack: true }); await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.State>{ val: JSON.parse(result).nlui_driver_version, ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'Display.BerryDriver', {type: 'channel', common: {role: 'info', name: 'Berry Driver'}, native: {}});
await createAliasAsync(AliasPath + 'Display.BerryDriver.ACTUAL', NSPanel_Path + 'Berry_Driver.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
}
} catch (err) { } catch (err) {
console.warn('get_current_berry_driver_version: ' + err.message); console.warn('get_current_berry_driver_version: ' + err.message);
} }
@@ -893,6 +958,28 @@ function get_tasmota_status0() {
} catch (err) { } catch (err) {
console.warn('get_tasmota_status0' + err.message); console.warn('get_tasmota_status0' + err.message);
} }
if (autoCreateAlias) {
setObject(AliasPath + 'Tasmota.Uptime', {type: 'channel', common: {role: 'info', name: 'Uptime'}, native: {}});
setObject(AliasPath + 'Tasmota.Version', {type: 'channel', common: {role: 'info', name:'Version'}, native: {}});
setObject(AliasPath + 'Tasmota.Hardware', {type: 'channel', common: {role: 'info', name: 'Hardware'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.AP', {type: 'channel', common: {role: 'info', name:'AP'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.SSId', {type: 'channel', common: {role: 'info', name:'SSId'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.BSSId', {type: 'channel', common: {role: 'info', name: 'BSSId'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.Channel', {type: 'channel', common: {role: 'info', name:'Channel'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.Mode', {type: 'channel', common: {role: 'info', name: 'Mode'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.RSSI', {type: 'channel', common: {role: 'info', name:'RSSI'}, native: {}});
setObject(AliasPath + 'Tasmota.Wifi.Signal', {type: 'channel', common: {role: 'info', name:'Signal'}, native: {}});
await createAliasAsync(AliasPath + 'Tasmota.Uptime.ACTUAL', NSPanel_Path + 'Tasmota.Uptime', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Version.ACTUAL', NSPanel_Path + 'Tasmota.Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Hardware.ACTUAL', NSPanel_Path + 'Tasmota.Hardware', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.AP.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.AP', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.SSId.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.SSId', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.BSSId.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.BSSId', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Channel.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Channel', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Mode.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Mode', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.RSSI.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.RSSI', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Signal.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Signal', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
}
}); });
} catch (err) { } catch (err) {
console.warn('error requesting firmware in function get_tasmota_status0: ' + err.message); console.warn('error requesting firmware in function get_tasmota_status0: ' + err.message);
@@ -992,6 +1079,13 @@ on({ id: config.panelRecvTopic }, async (obj) => {
await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', <iobJS.State>{ val: split[2], ack: true }); await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', <iobJS.State>{ val: split[2], ack: true });
await setStateAsync(NSPanel_Path + 'NSPanel_Version', <iobJS.State>{ val: split[3], ack: true }); await setStateAsync(NSPanel_Path + 'NSPanel_Version', <iobJS.State>{ val: split[3], ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'Display.TFTVersion', {type: 'channel', common: {role: 'info', name:'Display.TFTVersion'}, native: {}});
setObject(AliasPath + 'Display.Model', {type: 'channel', common: {role: 'info', name:'Display.Model'}, native: {}});
await createAliasAsync(AliasPath + 'Display.TFTVersion.ACTUAL', NSPanel_Path + 'Display_Firmware.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(AliasPath + 'Display.Model.ACTUAL', NSPanel_Path + 'NSPanel_Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
}
} }
} catch (err) { } catch (err) {
console.warn('error rceiving CustomRecv: ' + err.message); console.warn('error rceiving CustomRecv: ' + err.message);
@@ -2091,6 +2185,16 @@ function unsubscribeMediaSubscriptions(): void {
unsubscribe(mediaID + '.VOLUME') unsubscribe(mediaID + '.VOLUME')
} }
} }
for (let i = 0; i < config.subPages.length; i++) {
if (config.subPages[i].type == 'cardMedia') {
let mediaID = config.subPages[i].items[0].id;
unsubscribe(mediaID + '.STATE')
unsubscribe(mediaID + '.ARTIST')
unsubscribe(mediaID + '.TITLE')
unsubscribe(mediaID + '.ALBUM')
unsubscribe(mediaID + '.VOLUME')
}
}
} }
function subscribeMediaSubscriptions(id: string): void { function subscribeMediaSubscriptions(id: string): void {
@@ -2104,6 +2208,91 @@ function subscribeMediaSubscriptions(id: string): void {
}); });
} }
async function createAutoMediaAlias(id: string, mediaDevice: string, adapterPlayerInstance: string) {
if (autoCreateAlias) {
if (adapterPlayerInstance == 'alexa2.0.') {
if (existsObject(id) == false){
console.log('Alexa Alias ' + id + ' existiert nicht - wird jetzt angelegt')
let dpPath: string = adapterPlayerInstance + 'Echo-Devices.' + mediaDevice;
try {
setObject(id, {_id: id, type: 'channel', common: {role: 'media', name:'media'}, native: {}});
await createAliasAsync(id + '.ACTUAL', dpPath + '.Player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' });
await createAliasAsync(id + '.ALBUM', dpPath + '.Player.currentAlbum', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' });
await createAliasAsync(id + '.ARTIST', dpPath + '.Player.currentArtist', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' });
await createAliasAsync(id + '.TITLE', dpPath + '.Player.currentTitle', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' });
await createAliasAsync(id + '.NEXT', dpPath + '.Player.controlNext', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' });
await createAliasAsync(id + '.PREV', dpPath + '.Player.controlPrevious', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' });
await createAliasAsync(id + '.PLAY', dpPath + '.Player.controlPlay', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' });
await createAliasAsync(id + '.PAUSE', dpPath + '.Player.controlPause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' });
await createAliasAsync(id + '.STOP', dpPath + '.Commands.deviceStop', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' });
await createAliasAsync(id + '.STATE', dpPath + '.Player.currentState', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' });
await createAliasAsync(id + '.VOLUME', dpPath + '.Player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' });
} catch (err) {
console.warn('function createAutoMediaAlias: ' + err.message);
}
}
}
if (adapterPlayerInstance == 'spotify-premium.0.') {
if (existsObject(id) == false){
console.log('Spotify Alias ' + id + ' existiert nicht - wird jetzt angelegt')
let dpPath: string = adapterPlayerInstance;
try {
setObject(id, {_id: id + 'player', type: 'channel', common: {role: 'media', name:'media'}, native: {}});
await createAliasAsync(id + '.ACTUAL', dpPath + 'player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' });
await createAliasAsync(id + '.ALBUM', dpPath + 'player.album', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' });
await createAliasAsync(id + '.ARTIST', dpPath + 'player.artistName', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' });
await createAliasAsync(id + '.TITLE', dpPath + 'player.trackName', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' });
await createAliasAsync(id + '.CONTEXT_DESCRIPTION', dpPath + 'player.contextDescription', true, <iobJS.StateCommon>{ type: 'string', role: 'media.station', name: 'CONTEXT_DESCRIPTION' });
await createAliasAsync(id + '.NEXT', dpPath + 'player.skipPlus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' });
await createAliasAsync(id + '.PREV', dpPath + 'player.skipMinus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' });
await createAliasAsync(id + '.PLAY', dpPath + 'player.play', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' });
await createAliasAsync(id + '.PAUSE', dpPath + 'player.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' });
await createAliasAsync(id + '.STOP', dpPath + 'player.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' });
await createAliasAsync(id + '.STATE', dpPath + 'player.isPlaying', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' });
await createAliasAsync(id + '.VOLUME', dpPath + 'player.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' });
} catch (err) {
console.warn('function createAutoMediaAlias: ' + err.message);
}
}
}
if (adapterPlayerInstance == 'sonos.0.') {
if (existsObject(id) == false){
console.log('Sonos Alias ' + id + ' existiert nicht - wird jetzt angelegt')
let dpPath: string = adapterPlayerInstance + 'root.' + mediaDevice;
try {
setObject(id, {_id: id, type: 'channel', common: {role: 'media', name:'media'}, native: {}});
await createAliasAsync(id + '.ACTUAL', dpPath + '.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'value.volume', name: 'ACTUAL' });
await createAliasAsync(id + '.ALBUM', dpPath + '.current_album', true, <iobJS.StateCommon>{ type: 'string', role: 'media.album', name: 'ALBUM' });
await createAliasAsync(id + '.ARTIST', dpPath + '.current_artist', true, <iobJS.StateCommon>{ type: 'string', role: 'media.artist', name: 'ARTIST' });
await createAliasAsync(id + '.TITLE', dpPath + '.current_title', true, <iobJS.StateCommon>{ type: 'string', role: 'media.title', name: 'TITLE' });
await createAliasAsync(id + '.CONTEXT_DESCRIPTION', dpPath + '.current_station', true, <iobJS.StateCommon>{ type: 'string', role: 'media.station', name: 'CONTEXT_DESCRIPTION' });
await createAliasAsync(id + '.NEXT', dpPath + '.next', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.next', name: 'NEXT' });
await createAliasAsync(id + '.PREV', dpPath + '.prev', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.prev', name: 'PREV' });
await createAliasAsync(id + '.PLAY', dpPath + '.play', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.play', name: 'PLAY' });
await createAliasAsync(id + '.PAUSE', dpPath + '.pause', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.pause', name: 'PAUSE' });
await createAliasAsync(id + '.STOP', dpPath + '.stop', true, <iobJS.StateCommon>{ type: 'boolean', role: 'button.stop', name: 'STOP' });
await createAliasAsync(id + '.STATE', dpPath + '.state_simple', true, <iobJS.StateCommon>{ type: 'boolean', role: 'media.state', name: 'STATE' });
await createAliasAsync(id + '.VOLUME', dpPath + '.volume', true, <iobJS.StateCommon>{ type: 'number', role: 'level.volume', name: 'VOLUME' });
} catch (err) {
console.warn('function createAutoMediaAlias: ' + err.message);
}
}
}
}
}
function GenerateMediaPage(page: PageMedia): Payload[] { function GenerateMediaPage(page: PageMedia): Payload[] {
try { try {
let id = page.items[0].id let id = page.items[0].id
@@ -2114,6 +2303,11 @@ function GenerateMediaPage(page: PageMedia): Payload[] {
subscribeMediaSubscriptions(id); subscribeMediaSubscriptions(id);
if (page.items[0].autoCreateALias) {
let vMediaDevice = (page.items[0].mediaDevice != undefined) ? page.items[0].mediaDevice : '';
createAutoMediaAlias(id, vMediaDevice, page.items[0].adapterPlayerInstance);
}
out_msgs.push({ payload: 'pageType~cardMedia' }); out_msgs.push({ payload: 'pageType~cardMedia' });
if (existsObject(id)) { if (existsObject(id)) {
let name = getState(id + '.ALBUM').val; let name = getState(id + '.ALBUM').val;
@@ -3030,6 +3224,7 @@ function HandleButtonEvent(words): void {
} }
} }
//Determination of page navigation (CustomSend-Payload)
function GetNavigationString(pageId: number): string { function GetNavigationString(pageId: number): string {
try { try {
@@ -3037,14 +3232,20 @@ function GetNavigationString(pageId: number): string {
console.log(pageId); console.log(pageId);
} }
// left navigation arrow | right navigation arrow
// X|X
// 0 = no arrow
// 1 = right or left navigation arrow
// 2 = up navigation arrow
if (activePage.subPage) if (activePage.subPage)
return '1|0'; return '1|0';
switch (pageId) { switch (pageId) {
case 0: case 0:
return '0|1'; return '1|1';
case config.pages.length - 1: case config.pages.length - 1:
return '1|0'; return '1|1';
case -1: case -1:
return '2|0'; return '2|0';
case -2: case -2:
@@ -3052,6 +3253,7 @@ function GetNavigationString(pageId: number): string {
default: default:
return '1|1'; return '1|1';
} }
} catch (err) { } catch (err) {
console.log('function GetNavigationString: ' + err.message); console.log('function GetNavigationString: ' + err.message);
} }
@@ -4170,6 +4372,13 @@ on({ id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESU
await setStateAsync(NSPanel_Path + 'Sensor.TempUnit', <iobJS.State>{ val: '°' + Tasmota_Sensor.TempUnit, ack: true }); await setStateAsync(NSPanel_Path + 'Sensor.TempUnit', <iobJS.State>{ val: '°' + Tasmota_Sensor.TempUnit, ack: true });
await setStateAsync(NSPanel_Path + 'Sensor.ANALOG.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ANALOG.Temperature1), ack: true }); await setStateAsync(NSPanel_Path + 'Sensor.ANALOG.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ANALOG.Temperature1), ack: true });
await setStateAsync(NSPanel_Path + 'Sensor.ESP32.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ESP32.Temperature), ack: true }); await setStateAsync(NSPanel_Path + 'Sensor.ESP32.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ESP32.Temperature), ack: true });
if (autoCreateAlias) {
setObject(AliasPath + 'Sensor.ANALOG.Temperature', {type: 'channel', common: {role: 'info', name: ''}, native: {}});
setObject(AliasPath + 'Sensor.ESP32.Temperature', {type: 'channel', common: {role: 'info', name:''}, native: {}});
await createAliasAsync(AliasPath + 'Sensor.ANALOG.Temperature.ACTUAL', NSPanel_Path + 'Sensor.ANALOG.Temperature', true, <iobJS.StateCommon>{ type: 'number', 'unit': '°C' });
await createAliasAsync(AliasPath + 'Sensor.ESP32.Temperature.ACTUAL', NSPanel_Path + 'Sensor.ESP32.Temperature', true, <iobJS.StateCommon>{ type: 'number', 'unit': '°C' });
}
} catch (err) { } catch (err) {
console.warn('error with reading senor-data: '+ err.message); console.warn('error with reading senor-data: '+ err.message);
} }
@@ -4390,7 +4599,8 @@ type PageItem = {
mediaDevice: (string | undefined), mediaDevice: (string | undefined),
targetPage: (string | undefined), targetPage: (string | undefined),
speakerList: (string[] | undefined), speakerList: (string[] | undefined),
hidePassword: (boolean | undefined) hidePassword: (boolean | undefined),
autoCreateALias: (boolean | undefined)
} }
type DimMode = { type DimMode = {