Page 1 of 1

Problems restoring my old configuration - selector Switch, button [SOLVED]

Posted: Wednesday 02 December 2020 14:41
by physiker123
Hello everybody!

First of all: dashticz is a great piece of work, I was really happy with it.

I moved my domoticz from a rpi zero to a rpi 4, which is much better in terms of performance. So far, so good. On the old rpi zero, I had a nice visualisation working.

After moving to the rpi4, and after replacing the corresponding domoticz device IDs, I have problems with my selector switch (just a long number of letters and numbers...), and the buttons on the bottom, which should show a message retrieved by domoticz, do not really show up.

pictures:
before, not the selector switches on top and the "Wecker steht auf 7.15 Uhr" on the bottom:

Image

now:

Image

I am not really strong with javascript, so if someone could find an error I would really appreciate it. I think that the error is in the custom.css or the custom.js, so i added them here. Domoticz version: 2020.2 (build 12624), dashticz version: newest beta, git pull does not update (already up to date).

the buttons are almost on top of the custom.css:

Code: Select all

/*
CUSTOM CSS FILE
*/

.transbg[class*="col-xs"] {
	border-radius: 10px;
	/* Rounded corners */
}

.far,
.fas,
.wi {
	font-size: 20px !important;
}


.titlegroups {
	text-align: center;
	min-height: 100px;
}

.button {
	flex-direction: column;
	min-height: 120px !important;
	font-size: 20px;
	text-align: center;
}

[data-id='Variablen'].button {
	font-size: 10px !important;
	min-height: 100px !important;
}

[data-id='Meldungen'].button {
	font-size: 20px !important;
	min-height: 200px !important;
	text-align: left !important;
}

.block_280 {
	font-size: 18px !important;
	height: 100px !important;
}

.block_280 .title {
	font-size: 18px;
}

.block_295 {
	font-size: 18px !important;
}

.block_295 .title {
	font-size: 18px;
}

.block_297 {
	font-size: 18px !important;
}

.block_297 .title {
	font-size: 18px;
}

.block_19 {
	font-size: 18px !important;
}

.block_19 .title {
	font-size: 18px;
}

.block_19 .on {
	color: #FF0000;
}

.block_19 .off {
	color: #fff;
}

.block_21 {
	font-size: 18px !important;

}

.block_21 .title {
	font-size: 18px;
}


.block_359_1 {
	font-size: 18px !important;
}

.block_359_1 .title {
	font-size: 18px;
}

.block_310 {
	font-size: 18px !important;
}

.block_310 .title {
	font-size: 18px;
}

.block_406 {
	font-size: 18px !important;
	height: 100px !important;
}


.block_312 {
	font-size: 14px !important;
}

.block_312 .title {
	font-size: 18px;
}


.block_313 {
	font-size: 18px !important;
}

.block_313 .title {
	font-size: 18px;
}

.block_29 {
	font-size: 18px !important;
}

.block_29 .title {
	font-size: 18px;
}
.warning {
	background-color: red !important;
}

and the custom.js:

here as well: the device 280 is the selector button, and the button "Meldungen" should show the data of the device 317 (text to display):

Code: Select all

 //add custom javascript in here
 function afterGetDevices() {

	if (alldevices[280].Data == 'Off') {
		$('div[data-id="Meldungen"] .dt_title').html(alldevices[317].Data);

	} 
	else {
		$('div[data-id="Meldungen"] .dt_title').html(alldevices[317].Data);

	}

	if (alldevices[299].Data == 'Open') {
		$('.block_299 .title').addClass('warning');
		$('.block_299 .state').addClass('warning');
		$('.block_299').addClass('warning');

	} else {
		$('.block_299 .title').removeClass('warning');
		$('.block_299 .state').removeClass('warning');
		$('.block_299').removeClass('warning');

	}



	if (alldevices[378].Data == 'Open') {
		$('.block_378 .title').addClass('warning');
		$('.block_378 .state').addClass('warning');
		$('.block_378').addClass('warning');

	} else {
		$('.block_378 .title').removeClass('warning');
		$('.block_378 .state').removeClass('warning');
		$('.block_378').removeClass('warning');

	}


	if (alldevices[340].Data == 'Open') {
		$('.block_340 .title').addClass('warning');
		$('.block_340 .state').addClass('warning');
		$('.block_340').addClass('warning');

	} else {
		$('.block_340 .title').removeClass('warning');
		$('.block_340 .state').removeClass('warning');
		$('.block_340').removeClass('warning');

	}


	if (alldevices[438].Data == 'Open') {
		$('.block_438 .title').addClass('warning');
		$('.block_438 .state').addClass('warning');
		$('.block_438').addClass('warning');

	} else {
		$('.block_438 .title').removeClass('warning');
		$('.block_438 .state').removeClass('warning');
		$('.block_438').removeClass('warning');
	}

	if (alldevices[367].Data == 'Open') {
		$('.block_367 .title').addClass('warning');
		$('.block_367 .state').addClass('warning');
		$('.block_367').addClass('warning');

	} else {
		$('.block_367 .title').removeClass('warning');
		$('.block_367 .state').removeClass('warning');
		$('.block_367').removeClass('warning');

	}



	if (alldevices[406].Data == 'Open') {
		$('.block_406 .title').addClass('warning');
		$('.block_406 .state').addClass('warning');
		$('.block_406').addClass('warning');

	} else {
		$('.block_406 .title').removeClass('warning');
		$('.block_406 .state').removeClass('warning');
		$('.block_406').removeClass('warning');

	}

	if (alldevices[358].Data == 'Open') {
		$('.block_358 .title').addClass('warning');
		$('.block_358 .state').addClass('warning');
		$('.block_358').addClass('warning');

	} else {
		$('.block_358 .title').removeClass('warning');
		$('.block_358 .state').removeClass('warning');
		$('.block_358').removeClass('warning');

	}

	if (alldevices[364].Data == 'Open') {
		$('.block_364 .title').addClass('warning');
		$('.block_364 .state').addClass('warning');
		$('.block_364').addClass('warning');

	} else {
		$('.block_364 .title').removeClass('warning');
		$('.block_364 .state').removeClass('warning');
		$('.block_364').removeClass('warning');

	}


	if (alldevices[312].Data == 'On') {


		if (parseInt(alldevices[314].Data) > 4) {
			$('div[data-id="Fenster"] .dt_title').html(alldevices[314].Data + ' Fenster sind offen!');
		} else {
			$('div[data-id="Fenster"] .dt_title').html(alldevices[314].Data + ' Fenster offen: ' + alldevices[315].Data);

		}
		$('div[data-id="Fenster"]').addClass('warning');
	} else {

		$('div[data-id="Fenster"] .dt_title').html('Alle Fenster sind zu');
		$('div[data-id="Fenster"]').removeClass('warning');


	}

}

function getExtendedBlockTypes(blocktypes) {
	//blocktypes.Type['Lighting 2'] = { icon: 'fa fa-lightbulb-o', title: '<Name>', value: 'ds' }
	return blocktypes;
}
json output of the important devices, for example the selector switch:

Code: Select all

{
			"AddjMulti" : 1.0,
			"AddjMulti2" : 1.0,
			"AddjValue" : 0.0,
			"AddjValue2" : 0.0,
			"BatteryLevel" : 255,
			"CustomImage" : 0,
			"Data" : "Off",
			"Description" : "",
			"DimmerType" : "none",
			"Favorite" : 1,
			"HardwareID" : 4,
			"HardwareName" : "dummy",
			"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
			"HardwareTypeVal" : 15,
			"HaveDimmer" : true,
			"HaveGroupCmd" : true,
			"HaveTimeout" : false,
			"ID" : "00014168",
			"Image" : "Light",
			"IsSubDevice" : false,
			"LastUpdate" : "2020-12-02 06:45:00",
			"Level" : 0,
			"LevelActions" : "fHx8",
			"LevelInt" : 0,
			"LevelNames" : "SG9tZXxBd2F5fE5pZ2h0fFZhY2F0aW9u",
			"LevelOffHidden" : false,
			"MaxDimLevel" : 100,
			"Name" : "HouseMode",
			"Notifications" : "false",
			"PlanID" : "0",
			"PlanIDs" : 
			[
				0
			],
			"Protected" : false,
			"SelectorStyle" : 0,
			"ShowNotifications" : true,
			"SignalLevel" : "-",
			"Status" : "Off",
			"StrParam1" : "",
			"StrParam2" : "",
			"SubType" : "Selector Switch",
			"SwitchType" : "Selector",
			"SwitchTypeVal" : 18,
			"Timers" : "false",
			"Type" : "Light/Switch",
			"TypeImg" : "Light",
			"Unit" : 1,
			"Used" : 1,
			"UsedByCamera" : false,
			"XOffset" : "0",
			"YOffset" : "0",
			"idx" : "280"
		},
or my "mitteilungen" text device:

Code: Select all

{
			"AddjMulti" : 1.0,
			"AddjMulti2" : 1.0,
			"AddjValue" : 0.0,
			"AddjValue2" : 0.0,
			"BatteryLevel" : 255,
			"CustomImage" : 0,
			"Data" : "Keine Meldungen :) ",
			"Description" : "",
			"Favorite" : 1,
			"HardwareID" : 4,
			"HardwareName" : "dummy",
			"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
			"HardwareTypeVal" : 15,
			"HaveTimeout" : false,
			"ID" : "00082317",
			"LastUpdate" : "2020-12-02 14:39:00",
			"Name" : "Meldungen",
			"Notifications" : "false",
			"PlanID" : "0",
			"PlanIDs" : 
			[
				0
			],
			"Protected" : false,
			"ShowNotifications" : false,
			"SignalLevel" : "-",
			"SubType" : "Text",
			"Timers" : "false",
			"Type" : "General",
			"TypeImg" : "text",
			"Unit" : 1,
			"Used" : 1,
			"XOffset" : "0",
			"YOffset" : "0",
			"idx" : "317"
		},
to be complete: the config.js:
(i removed the OWM parameters and the domoticz IP)

Code: Select all

var config = {}

config['login_timeout'] = '60';
config['user_name'] = '';
config['pass_word'] = '';
config['app_title'] = 'Dashticz Smart Home';
config['hide_topbar'] = '1';
config['auto_positioning'] = 0;
config['auto_swipe_back_to'] = 2;
config['auto_swipe_back_after'] = 30;
config['start_page'] = 2;
config['language'] = 'de_DE'; //or: en_US, de_DE, fr_FR, hu_HU, it_IT, pt_PT, sv_SE
config['domoticz_refresh'] = '5';
config['dashticz_refresh'] = '60';
config['use_favorites'] = 0;  //Request all Domoticz Devices, not only favorites


//
config['default_news_url'] = 'https://www.tagesschau.de/xml/rss2';



buttons = {} //only once!!
buttons.page1 = {
    width: 8,
    title: 'Fenster',
    slide: 1,
    key: 'Fenster',
};
buttons.page2 = {
    width: 12,
    title: 'Hauptseite',
    slide: 2,
};
buttons.page3 = {
    width: 4,
    title: 'Rollladen',
    slide: 3,
};
buttons.page4 = {
    width: 2,
    title: 'Variablen',
    slide: 4,
    key: 'Variablen',
};
buttons.page5 = {
    width: 12,
    title: 'Meldungen',
    slide: 4,
    key: 'Meldungen',
};

//Definition of blocks
blocks = {}

blocks['myblocktitle'] = {
    type: 'blocktitle',
    title: '',
}

blocks[280] = { //HouseMode
    width: 6,
    last_update: false,
    icon: 'fas fa-home',


}

blocks[295] = { //Gästemodus
    width: 4,
    last_update: false,
    icon: 'fas fa-home',


}
blocks[19] = { //Kaffeemaschine
    width: 5,
    last_update: false,
    icon: 'fas fa-coffee',
    title: 'Kaffeemaschine',
}


blocks[21] = { //Eierkocher
    width: 3,
    last_update: false,
    icon: 'fas fa-egg',
    title: 'Eierkocher',


}

blocks[313] = { //Chromecast
    width: 4,
    last_update: false,
    iconOn: 'fas fa-volume-up',
    iconOff: 'fas fa-volume-mute',
    title: 'Chromecast',

}

blocks[310] = { //VMC Aktiv
    width: 6,
    last_update: false,
}
blocks[406] = { //vmc manuell
    width: 6,
    last_update: false,
}
blocks[297] = { //Sommermodus
    width: 6,
    last_update: false,
}


blocks[292] = { // Handyjens
    width: 2,
    last_update: false,
    title: 'Jens',
    iconOn: 'fas fa-mobile-alt',
    iconOff: 'fas fa-times-circle',

}

blocks[293] = { //Handynessa
    width: 2,
    last_update: false,
    title: 'Nessa',

    iconOn: 'fas fa-mobile-alt',
    iconOff: 'fas fa-times-circle',
}
blocks[311] = { //Alle Rollläden
    width: 12,
    last_update: false,
}

blocks[29] = { //Außen Grillsteckdose
    width: 4,
    last_update: false,
    title: 'Grill',

}
//Fenster
blocks[358] = { //Büro
    width: 6,
    last_update: false,
}

blocks[365] = { //Badezimmer
    width: 6,
    last_update: false,
}
blocks[299] = { //Esszimmer
    width: 6,
    last_update: false,
}

blocks[378] = { //Haustür
    width: 6,
    last_update: false,
}
blocks[367] = { //Kinderzimmer
    width: 6,
    last_update: false,
}
blocks[340] = { //Küche
    width: 6,
    last_update: false,
}
blocks[364] = { //Schlafzimmer
    width: 6,
    last_update: false,
}
blocks[438] = { //Spielzimmer
    width: 6,
    last_update: false,
}
//Rollläden
blocks[109] = { //Badezimmer
    width: 6,
    last_update: false,
}
blocks[105] = { //Büro
    width: 6,
    last_update: false,
}
blocks[120] = {  //Esszimmer
    width: 6,
    last_update: false,
}

blocks[123] = {  //Küche
    width: 6,
    last_update: false,
}
blocks[117] = { //Spielzimmer
    width: 6,
    last_update: false,
}
 
blocks[112] = { //Kinderzimmer
    width: 6,
    last_update: false,
}


blocks[302] = { //Kaffeewecker
    width: 2,
    last_update: false,
    title: 'Kaffee Wecker',
}
blocks[316] = { //Eier Wecker
    width: 2,
    last_update: false,
    title: 'Eier Wecker',
}

blocks['359_1'] = {
    last_update: false,
    title: 'Außentemperatur',
}
blocks['133_1'] = {
    last_update: false,
    title: 'Leistung',

}
//Definition of columns
columns = {}
//Fenster




columns[1] = {}
columns[1]['blocks'] = [358, 365,299, 378, 367, 340, 364, 438, 'myblocktitle', buttons.page2]
columns[1]['width'] = 12;
//Hauptseite

//
columns[2] = {}
columns[2]['blocks'] = ['clock', 280, 406, 295, 313, 29,19, 302, 21, 316, '359_1', 292, 293, '133_1',buttons.page1, buttons.page3, 'weather_owm', buttons.page5]
columns[2]['width'] = 12;



//Rollläden


columns[3] = {}
columns[3]['blocks'] = [109, 105, 120, 112,123, 117, 'myblocktitle', 311, 'myblocktitle', buttons.page2]
columns[3]['width'] = 12;


columns[4] = {}
columns[4]['blocks'] = [297, 310, 'myblocktitle', buttons.page2]
columns[4]['width'] = 12;



var screens = {}
screens[1] = {}
screens[1]['background'] = 'background.jpg';
screens[1]['columns'] = [1]

screens[2] = {}
screens[2]['background'] = 'background.jpg';
screens[2]['columns'] = [2]


screens[3] = {}
screens[3]['background'] = 'background.jpg';
screens[3]['columns'] = [3]


screens[4] = {}
screens[4]['background'] = 'background.jpg';
screens[4]['columns'] = [4]

Best regards,
Jens

Re: Problems restoring my old configuration - selector Switch, button

Posted: Wednesday 02 December 2020 20:25
by Lokonli
physiker123 wrote: Wednesday 02 December 2020 14:41 Hello everybody!

Best regards,
Jens
It looks like base64 encoded level names. Domoticz switched to base64 encoded level names some time ago (1 year?)

So I guess you updated Domoticz, but not Dashticz.

Try the latest Dashticz version (master or beta).

Probably you have to tune your configuration files afterwards ...

Most info can be found on dashticz.readthedocs.io

Re: Problems restoring my old configuration - selector Switch, button

Posted: Wednesday 02 December 2020 20:44
by physiker123
Strange... I thought I was on the latest dashticz, and also git pull did not update. I uninstalled and manually reinstalled the beta, and now it works! The error with the button is also gone, everything is as it was before. Thank you very much for your help!!!