i
Size: a a a
i
i
i
i
/* function alert(text, level, telegram, cb){ }
text - (String) текст сообщения
level: (Number) Важность 0 - низкая, 1 - средняя, 2 - высокая
telegram: (Bool) true/false
cb - (Function) callback
*/
function alert(text, level, telegram, cb){
log('Уведомление {' + text + '} с уровнем важности {' + level + '}, отправка в телеграм: ' + telegram);
var saytext = text;
var hour = (new Date()).getHours();
var Sleep = getState('javascript.0.Scenes.Sleep').val;
var Allgone = getState('javascript.0.Scenes.Allgone').val;
if(~text.indexOf('<speak>')){
text = text.replace(/(\<(\/?[^>]+)>)/g, '');
}
switch (level) {
case 0:
if(!Sleep && hour > 8 && hour < 23 && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '0;' + text + ';5000');
break;
case 1:
if(!Sleep && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '1;' + text + ';5000');
break;
case 2:
if(!Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '2;' + text + ';5000');
break;
default:
log('Function Alert, не известный уровень важности сообщения.');
}
setState('lgtv.0.states.popup', text);
if(telegram == undefined || telegram){
if(level === 1){
text = '⚠️ ' + text;
}
if(level === 2){
text = '❗️ ' + text;
}
sendTo('telegram', {text: text});
}
cb && cb(true);
}
a
/* function alert(text, level, telegram, cb){ }
text - (String) текст сообщения
level: (Number) Важность 0 - низкая, 1 - средняя, 2 - высокая
telegram: (Bool) true/false
cb - (Function) callback
*/
function alert(text, level, telegram, cb){
log('Уведомление {' + text + '} с уровнем важности {' + level + '}, отправка в телеграм: ' + telegram);
var saytext = text;
var hour = (new Date()).getHours();
var Sleep = getState('javascript.0.Scenes.Sleep').val;
var Allgone = getState('javascript.0.Scenes.Allgone').val;
if(~text.indexOf('<speak>')){
text = text.replace(/(\<(\/?[^>]+)>)/g, '');
}
switch (level) {
case 0:
if(!Sleep && hour > 8 && hour < 23 && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '0;' + text + ';5000');
break;
case 1:
if(!Sleep && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '1;' + text + ';5000');
break;
case 2:
if(!Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '2;' + text + ';5000');
break;
default:
log('Function Alert, не известный уровень важности сообщения.');
}
setState('lgtv.0.states.popup', text);
if(telegram == undefined || telegram){
if(level === 1){
text = '⚠️ ' + text;
}
if(level === 2){
text = '❗️ ' + text;
}
sendTo('telegram', {text: text});
}
cb && cb(true);
}
В
/* function alert(text, level, telegram, cb){ }
text - (String) текст сообщения
level: (Number) Важность 0 - низкая, 1 - средняя, 2 - высокая
telegram: (Bool) true/false
cb - (Function) callback
*/
function alert(text, level, telegram, cb){
log('Уведомление {' + text + '} с уровнем важности {' + level + '}, отправка в телеграм: ' + telegram);
var saytext = text;
var hour = (new Date()).getHours();
var Sleep = getState('javascript.0.Scenes.Sleep').val;
var Allgone = getState('javascript.0.Scenes.Allgone').val;
if(~text.indexOf('<speak>')){
text = text.replace(/(\<(\/?[^>]+)>)/g, '');
}
switch (level) {
case 0:
if(!Sleep && hour > 8 && hour < 23 && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '0;' + text + ';5000');
break;
case 1:
if(!Sleep && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '1;' + text + ';5000');
break;
case 2:
if(!Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '2;' + text + ';5000');
break;
default:
log('Function Alert, не известный уровень важности сообщения.');
}
setState('lgtv.0.states.popup', text);
if(telegram == undefined || telegram){
if(level === 1){
text = '⚠️ ' + text;
}
if(level === 2){
text = '❗️ ' + text;
}
sendTo('telegram', {text: text});
}
cb && cb(true);
}
i
i
i
В
AA
/* function alert(text, level, telegram, cb){ }
text - (String) текст сообщения
level: (Number) Важность 0 - низкая, 1 - средняя, 2 - высокая
telegram: (Bool) true/false
cb - (Function) callback
*/
function alert(text, level, telegram, cb){
log('Уведомление {' + text + '} с уровнем важности {' + level + '}, отправка в телеграм: ' + telegram);
var saytext = text;
var hour = (new Date()).getHours();
var Sleep = getState('javascript.0.Scenes.Sleep').val;
var Allgone = getState('javascript.0.Scenes.Allgone').val;
if(~text.indexOf('<speak>')){
text = text.replace(/(\<(\/?[^>]+)>)/g, '');
}
switch (level) {
case 0:
if(!Sleep && hour > 8 && hour < 23 && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '0;' + text + ';5000');
break;
case 1:
if(!Sleep && !Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '1;' + text + ';5000');
break;
case 2:
if(!Allgone){
setState('sayit.0.tts.text', saytext);
}
setState('kodi.0.ShowNotif', '2;' + text + ';5000');
break;
default:
log('Function Alert, не известный уровень важности сообщения.');
}
setState('lgtv.0.states.popup', text);
if(telegram == undefined || telegram){
if(level === 1){
text = '⚠️ ' + text;
}
if(level === 2){
text = '❗️ ' + text;
}
sendTo('telegram', {text: text});
}
cb && cb(true);
}
A
10-16 18:39:11.731 -
debug: lgtv.0 (18348) State change "states.youtube" - VALUE: https://www.youtube.com/watch?v=AjSpMQfRmEo
2019-10-16 18:39:11.944 -
info: ham.0 (673) stateChange ham.0.LG-TV-zal.HDMI2.On {"val":false,"ack":true,"ts":1571240351939,"q":0,"from":"system.adapter.ham.0","user":"system.user.admin","lc":1571240351939}
2019-10-16 18:39:11.945 -
info: ham.0 (673) stateChange ham.0.LG-TV-zal.LG-TV-zal.Active-Identifier {"val":9999999,"ack":true,"ts":1571240351939,"q":0,"from":"system.adapter.ham.0","user":"system.user.admin","lc":1571240351939}
2019-10-16 18:39:15.076 -
debug: lgtv.0 (18348) system.adapter.admin.0: logging true
2019-10-16 18:39:28.245 -
debug: lgtv.0 (18348) Polling channel
2019-10-16 18:39:28.245 -
debug: lgtv.0 (18348) Polling OnlineStatus
2019-10-16 18:39:28.246 -
debug: lgtv.0 (18348) Polling Input and current App
2019-10-16 18:39:28.246 -
debug: lgtv.0 (18348) Polling current sound output
2019-10-16 18:39:28.263 -
debug: lgtv.0 (18348) DEBUGGING pollOnlineStatus: {}
2019-10-16 18:39:28.272 -
debug: lgtv.0 (18348) DEBUGGING pollInputAndCurrentApp: {"appId":"youtube.leanback.v4","returnValue":true,"windowId":"","processId":""}
2019-10-16 18:39:28.290 -
debug: lgtv.0 (18348) DEBUGGING CHANNEL POLLING: {"returnValue":false,"errorCode":-1000,"errorText":"internal error"}
2019-10-16 18:39:28.291 -
debug: lgtv.0 (18348) DEBUGGING pollGetSoundOutput: {"returnValue":true,"soundOutput":"external_arc"}
i
i
10-16 18:39:11.731 -
debug: lgtv.0 (18348) State change "states.youtube" - VALUE: https://www.youtube.com/watch?v=AjSpMQfRmEo
2019-10-16 18:39:11.944 -
info: ham.0 (673) stateChange ham.0.LG-TV-zal.HDMI2.On {"val":false,"ack":true,"ts":1571240351939,"q":0,"from":"system.adapter.ham.0","user":"system.user.admin","lc":1571240351939}
2019-10-16 18:39:11.945 -
info: ham.0 (673) stateChange ham.0.LG-TV-zal.LG-TV-zal.Active-Identifier {"val":9999999,"ack":true,"ts":1571240351939,"q":0,"from":"system.adapter.ham.0","user":"system.user.admin","lc":1571240351939}
2019-10-16 18:39:15.076 -
debug: lgtv.0 (18348) system.adapter.admin.0: logging true
2019-10-16 18:39:28.245 -
debug: lgtv.0 (18348) Polling channel
2019-10-16 18:39:28.245 -
debug: lgtv.0 (18348) Polling OnlineStatus
2019-10-16 18:39:28.246 -
debug: lgtv.0 (18348) Polling Input and current App
2019-10-16 18:39:28.246 -
debug: lgtv.0 (18348) Polling current sound output
2019-10-16 18:39:28.263 -
debug: lgtv.0 (18348) DEBUGGING pollOnlineStatus: {}
2019-10-16 18:39:28.272 -
debug: lgtv.0 (18348) DEBUGGING pollInputAndCurrentApp: {"appId":"youtube.leanback.v4","returnValue":true,"windowId":"","processId":""}
2019-10-16 18:39:28.290 -
debug: lgtv.0 (18348) DEBUGGING CHANNEL POLLING: {"returnValue":false,"errorCode":-1000,"errorText":"internal error"}
2019-10-16 18:39:28.291 -
debug: lgtv.0 (18348) DEBUGGING pollGetSoundOutput: {"returnValue":true,"soundOutput":"external_arc"}
A
i
i
A
i
i