mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-16 09:56:58 +01:00
Compare commits
3 Commits
80e6ffaae1
...
3362a47d4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3362a47d4e | ||
|
|
8c84c1050f | ||
|
|
c3ded4d817 |
@@ -1050,7 +1050,7 @@ async function CheckConfigParameters() {
|
||||
const i = n.shift();
|
||||
|
||||
if (a === 'mqtt' && !isNaN(Number(i))) {
|
||||
sendTo(`${a}.${i}`, 'sendMessage2Client', {topic: n.join('/'), message: 'time~12:00'});
|
||||
sendTo(`${a}.${i}`, 'sendMessage2Client', {topic: n.join('/'), message: buildNSPanelString('time', '12:00')});
|
||||
await sleep(500);
|
||||
}
|
||||
if (await existsObjectAsync(config.panelSendTopic) == false) {
|
||||
@@ -3285,7 +3285,7 @@ function SendTime(): void {
|
||||
const min = (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
|
||||
|
||||
SendToPanel({ payload: 'time~' + hr + ':' + min });*/
|
||||
SendToPanel({ payload: `time~${new Date().toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`, });
|
||||
SendToPanel({ payload: `time~${new Date().toLocaleTimeString('de-DE', { hour: "2-digit", minute: "2-digit" })}`, });
|
||||
} catch (err: any) {
|
||||
log('error at function SendTime: ' + err.message, 'warn');
|
||||
}
|
||||
@@ -9075,23 +9075,25 @@ function HandleScreensaverColors(): void {
|
||||
scrSvrBGCol = rgb_dec565({ red: 100, green: 0, blue: 0 });
|
||||
}
|
||||
|
||||
let payloadString = 'color' + '~' +
|
||||
scrSvrBGCol + '~' + //background
|
||||
rgb_dec565(sctime) + '~' + //time
|
||||
rgb_dec565(sctimeAMPM) + '~' + //timeAMPM~
|
||||
rgb_dec565(scdate) + '~' + //date~
|
||||
rgb_dec565(sctMainText) + '~' + //tMainText~
|
||||
rgb_dec565(sctForecast1) + '~' + //tForecast1~
|
||||
rgb_dec565(sctForecast2) + '~' + //tForecast2~
|
||||
rgb_dec565(sctForecast3) + '~' + //tForecast3~
|
||||
rgb_dec565(sctForecast4) + '~' + //tForecast4~
|
||||
rgb_dec565(sctForecast1Val) + '~' + //tForecast1Val~
|
||||
rgb_dec565(sctForecast2Val) + '~' + //tForecast2Val~
|
||||
rgb_dec565(sctForecast3Val) + '~' + //tForecast3Val~
|
||||
rgb_dec565(sctForecast4Val) + '~' + //tForecast4Val~
|
||||
rgb_dec565(scbar) + '~' + //bar~
|
||||
rgb_dec565(sctMainTextAlt) + '~' + //tMainTextAlt
|
||||
rgb_dec565(sctTimeAdd); //tTimeAdd
|
||||
let payloadString = buildNSPanelString(
|
||||
'color' ,
|
||||
scrSvrBGCol , //background
|
||||
rgb_dec565(sctime) , //time
|
||||
rgb_dec565(sctimeAMPM) , //timeAMPM~
|
||||
rgb_dec565(scdate) , //date~
|
||||
rgb_dec565(sctMainText) , //tMainText~
|
||||
rgb_dec565(sctForecast1) , //tForecast1~
|
||||
rgb_dec565(sctForecast2) , //tForecast2~
|
||||
rgb_dec565(sctForecast3) , //tForecast3~
|
||||
rgb_dec565(sctForecast4) , //tForecast4~
|
||||
rgb_dec565(sctForecast1Val) , //tForecast1Val~
|
||||
rgb_dec565(sctForecast2Val) , //tForecast2Val~
|
||||
rgb_dec565(sctForecast3Val) , //tForecast3Val~
|
||||
rgb_dec565(sctForecast4Val) , //tForecast4Val~
|
||||
rgb_dec565(scbar) , //bar~
|
||||
rgb_dec565(sctMainTextAlt) , //tMainTextAlt
|
||||
rgb_dec565(sctTimeAdd) //tTimeAdd
|
||||
);
|
||||
|
||||
SendToPanel({ payload: payloadString });
|
||||
} catch (err: any) {
|
||||
@@ -9664,6 +9666,14 @@ function spotifyGetDeviceID(vDeviceString: string): string {
|
||||
let strDevID = arrayDeviceListIds[indexPos];
|
||||
return strDevID;
|
||||
}
|
||||
/**
|
||||
* Join arguments with ~ and return the string;
|
||||
* @param tokens unlimited numbers of strings
|
||||
* @returns
|
||||
*/
|
||||
function buildNSPanelString(...tokens: (string|number)[]): string {
|
||||
return tokens.join('~');
|
||||
}
|
||||
|
||||
type RGB = NSPanel.RGB;
|
||||
type PageItem = NSPanel.PageItem;
|
||||
|
||||
Reference in New Issue
Block a user