mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-19 22:24:15 +01:00
@@ -3397,6 +3397,7 @@ get_locales_servicemenu();
|
|||||||
// get_panel_update_data();
|
// get_panel_update_data();
|
||||||
// check_updates();
|
// check_updates();
|
||||||
|
|
||||||
|
renameChannel();
|
||||||
// Updates currently compare and every 12 hours
|
// Updates currently compare and every 12 hours
|
||||||
let scheduleCheckUpdates = adapterSchedule(undefined, 60 * 60 * 12, () => {
|
let scheduleCheckUpdates = adapterSchedule(undefined, 60 * 60 * 12, () => {
|
||||||
get_tasmota_status0();
|
get_tasmota_status0();
|
||||||
@@ -3877,10 +3878,7 @@ function get_current_berry_driver_version() {
|
|||||||
log('Requesting current berry driver version', 'info');
|
log('Requesting current berry driver version', 'info');
|
||||||
}
|
}
|
||||||
|
|
||||||
let urlString = `http://${get_current_tasmota_ip_address()}/cm?cmnd=GetDriverVersion`;
|
let urlString = get_tasmot_url('GetDriverVersion')
|
||||||
if (tasmota_web_admin_password != '') {
|
|
||||||
urlString = `http://${get_current_tasmota_ip_address()}/cm?user=${tasmota_web_admin_user}&password=${tasmota_web_admin_password}&cmnd=GetDriverVersion`;
|
|
||||||
}
|
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.get(urlString, { headers: { 'User-Agent': 'ioBroker' } })
|
.get(urlString, { headers: { 'User-Agent': 'ioBroker' } })
|
||||||
@@ -4046,6 +4044,46 @@ function get_tasmota_status0() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renameChannel() {
|
||||||
|
const urlString = get_tasmot_url('DeviceName');
|
||||||
|
axios
|
||||||
|
.get(urlString, { headers: { 'User-Agent': 'ioBroker' } })
|
||||||
|
.then(async function (response) {
|
||||||
|
if (response.status === 200) {
|
||||||
|
if (Debug) {
|
||||||
|
log(JSON.stringify(response.data), 'info');
|
||||||
|
}
|
||||||
|
if (isSetOptionActive) {
|
||||||
|
try {
|
||||||
|
if (response.data && response.data.DeviceName && response.data.DeviceName !== '') {
|
||||||
|
await extendObjectAsync(NSPanel_Path.slice(0,-1), {common:{name:response.data.DeviceName}})
|
||||||
|
await extendObjectAsync(AliasPath.slice(0,-1), {common:{name:response.data.DeviceName}})
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
if (error.code === 'EHOSTUNREACH') {
|
||||||
|
log(`Can't connect to display!`, 'warn');
|
||||||
|
} else log(error, 'error');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get url to tasmota api
|
||||||
|
* @param cmd tasmota command
|
||||||
|
* @returns url
|
||||||
|
*/
|
||||||
|
function get_tasmot_url(cmd: string): string {
|
||||||
|
if (tasmota_web_admin_password != '') {
|
||||||
|
return `http://${get_current_tasmota_ip_address()}/cm?user=${tasmota_web_admin_user}&password=${tasmota_web_admin_password}&cmnd=${cmd}`;
|
||||||
|
}
|
||||||
|
return `http://${get_current_tasmota_ip_address()}/cm?cmnd=${cmd}`;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the Tasmota firmware.
|
* Updates the Tasmota firmware.
|
||||||
*
|
*
|
||||||
@@ -12599,12 +12637,33 @@ namespace NSPanel {
|
|||||||
export type PageBaseItem = {
|
export type PageBaseItem = {
|
||||||
uniqueName?: string;
|
uniqueName?: string;
|
||||||
role?: string;
|
role?: string;
|
||||||
|
/**
|
||||||
|
* The data point with the data to be used.
|
||||||
|
*/
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
/**
|
||||||
|
* The icon that is used in the standard case or if ID is true
|
||||||
|
*/
|
||||||
icon?: string;
|
icon?: string;
|
||||||
|
/**
|
||||||
|
* The icon that is used when id is false
|
||||||
|
*/
|
||||||
icon2?: string;
|
icon2?: string;
|
||||||
|
/**
|
||||||
|
* The color that is used in the standard case or if ID is true
|
||||||
|
*/
|
||||||
onColor?: RGB;
|
onColor?: RGB;
|
||||||
|
/**
|
||||||
|
* The color that is used when id is false
|
||||||
|
*/
|
||||||
offColor?: RGB;
|
offColor?: RGB;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
useColor?: boolean;
|
useColor?: boolean;
|
||||||
|
/**
|
||||||
|
* Interpolate the icon colour by ID
|
||||||
|
*/
|
||||||
interpolateColor?: boolean;
|
interpolateColor?: boolean;
|
||||||
minValueBrightness?: number;
|
minValueBrightness?: number;
|
||||||
maxValueBrightness?: number;
|
maxValueBrightness?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user