NEW frontpage.html - request comments

Moderator: leecollings

brugje
Posts: 8
Joined: Monday 13 February 2023 19:36
Target OS: Windows
Domoticz version: 2024.4
Location: NL (Echtenerbrug)
Contact:

Re: NEW frontpage.html - request comments

Post by brugje »

That should not be related. I think you also updated Domoticz to a new version and new Domoticz version have gone through some API changes. See the warning in the wiki https://www.domoticz.com/wiki/Domoticz_ ... d_newer.29
Yes I'm on version 2024-4. So there are some changes. I changed the frontpage json to the new getdevices call.

Code: Select all

function RefreshData()
{
	clearInterval($.refreshTimer);
	var jurl=$.domoticzurl+"/json.htm?type=command&param=getdevices&plan="+$.roomplan+"&lastupdate="+$.LastUpdateTime;
	$.getJSON(jurl,
	{
		format: "json"
	},
	function(data) {
		if (typeof data.result != 'undefined') {
			
			$.each(data.result, function(i,item){
				for( var ii = 0, len = $.PageArray.length; ii < len; ii++ ) {
					if( $.PageArray[ii][0] === item.idx ) {		// Domoticz idx number
						var vtype=	$.PageArray[ii][1]; 		// Domotitcz type (like Temp, Humidity)
						var vlabel=	$.PageArray[ii][2];			// vak number from HTML layout
						var vdesc=	$.PageArray[ii][3];			// description 
						var vattr=	$.PageArray[ii][4];			// extra css attributes
						var valarm=	$.PageArray[ii][5]; 		// alarm value to turn text to red
						var vdata=	item[vtype];				// current value
						if (typeof vdata == 'undefined') {
							vdata="???";
						} else {
							// remove too much text
							vdata=new String(vdata).split("Watt",1)[0];
							vdata=new String(vdata).split("kWh",1)[0];
							vdata=new String(vdata).split("km/h",1)[0];
							vdata=new String(vdata).split("W/m2",1)[0];
							vdata=new String(vdata).split("graden C",1)[0];
							vdata=new String(vdata).split("mm",1)[0];
							vdata=new String(vdata).split("/555",1)[0];
							vdata=new String(vdata).split("C",1)[0];
							vdata=new String(vdata).split("m3",1)[0];
							vdata=new String(vdata).split("m3",1)[0];
							vdata=new String(vdata).split(" ",1)[0];
						}
					
But now I need the solution to my problem

Groet Jan
praet mar frysk
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: NEW frontpage.html - request comments

Post by waltervl »

You probably made an error somewhere else when changing the script.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests