[RESOLU] Pbe sur Page Perso

Forum dédié aux relookings de DomoticZ : Thèmes, styles ...
Le coin du design, c'est ici.
bruch05
Messages : 47
Inscription : 27 févr. 2016, 21:06

[RESOLU] Pbe sur Page Perso

Message par bruch05 »

Bonsoir,

Je rencontre un comportement que je n'arrive pas m'expliquer.
Dans la page html suivante, (dans \www\template\, accéder ensuite via l'onglet Perso) la valeur du device Virtuel ci-dessous ne s'affiche pas avec le type "SetPoint", j'ai essayé avec
"Data" sans plus de succès.

Si vous avez une idée, je suis preneur :)

Merci par avance
Tof

"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "19.0",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 5,
"HardwareName" : "VIRTUAL HARDWARE ",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "00140B8",
"LastUpdate" : "2016-05-17 23:43:36",
"Name" : "Consigne Temp.",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"SetPoint" : "19.0",
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "SetPoint",
"Timers" : "false",
"Type" : "Thermostat",
"TypeImg" : "override_mini",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "105"

Code : Tout sélectionner

<link href="http://fonts.googleapis.com/css?family=Orbitron:700" rel="stylesheet" type="text/css">
<style>
body {
	background: #000;
}

div#cnt {
	background: #FF00FF;
	width: 990px;
    margin: 0 auto;
    text-align: center;
}

a, a:visited { text-decoration: none; color: #336699; }
a:hover { text-decoration: none; color: #003366; }

#frame {
	float: left;
	margin: 0px;
	padding: 0px 2px 0px 2px;
}

#label_lg {
	font-family: arial;
	font-weight: normal;
	color: #999;
	font-size: 17px;
	margin-top: -20px;
	height: 25px;
	line-height: 10px;
}

#itsalon {
	font-family: Orbitron, serif;
	font-weight: bold;
	width: 570px;
	padding: 5px;
	border: 1px solid #666;
	height: 217px;
	line-height: 210px;
	font-size: 180px;
	color: darkorange;
	margin: 0px ;
}

#itpc, #itext, #iuv, #ihumint, #iairparif, #ibaro, #itch, #crte,
#iuv, #ipluie, #itchr, #ocld, #iforecast, #ctime, #itcm, #itgc, #itcl,
#itss, #icot, #tmpc, #crte, #ihext, #ivent, #itcp,
#iedfc, #igaz, #ipluiej, #iedf {
	font-family: Orbitron, serif;
	font-weight: bold;
	width: 162px;
	padding: 10px;
	border: 1px solid #666;
	height: 90px;
	line-height: 75px;
	font-size: 90px;
	color: #999;
}

#ctime, #itcm, #itcl, #itss, #icot, #tmpc, #crte, #ihext, #iuv,
#ipluie, #itchr, #ocld, #iforecast, #itch, #ivent, #iairparif, #awatt,
#ibaro, #itcp, #iedf, #iedfc, #igaz, #ipluiej {
	height: 65px;
	line-height: 55px;
	color: #999;
}

#itcp, #iedf, #crte, #ivent {
	width: 184px;
}

#iforecast {
	width: 560px;
	font-size: 40px;
	line-height: 55px;
	color: darkorange;
}

#al {
	margin-left: -35px;
	margin-top: 55px;
	width: 1050px;height: 570px;
}
</style>

<div id="cnt" class="ng-scope">
	<div style="margin-bottom:5px;">
		<div>
			<div>
				<div id="frame">
					<div id="itext" style="color:lightblue;font-size:50px;">16</div>
					<div id="label_lg">Temp Ext (º<span class="degsign">C</span>)</div>
					<div id="ihumint" style="color:lightblue;font-size:50px;">--</div>
					<div id="label_lg">Humidité INT (%)</div>
				</div>
				<div id="frame">
					<div id="itsalon">99.9</div>
					<div id="label_lg" style="font-size:25px;margin-top:-30px;">Température Salon (º<span class="degsign">C</span>)</div>
				</div>
				<div id="frame">
					<div id="itpc" style="color:teal;font-size:50px;">99.9</div>
					<div id="label_lg">Temp Petit Congel (º<span class="degsign">C</span>)</div>
					<div id="itgc" style="color:#6666FF;font-size:50px;">99.9</div>
					<div id="label_lg">Temp Gros Congel (º<span class="degsign">C</span>)</div>
					</div>
				</div>

				<div>
					<div id="frame">
						<div id="itcm" style="font-size:40px;">99.9</div>
						<div id="label_lg">Temp Ch Marie (º<span class="degsign">C</span>)</div>
					</div>
					<div id="frame">
						<div id="itcl" style="font-size:40px;">99.9</div>
						<div id="label_lg">Temp Ch Léa (º<span class="degsign">C</span>)</div>
					</div>
						<div id="frame">
						<div id="itcp" style="font-size:40px;">99.9</div>
						<div id="label_lg">Temp Ch Parents (º<span class="degsign">C</span>)</div>
					</div>
					<div id="frame">
						<div id="itss" style="font-size:40px;">99.9</div>
						<div id="label_lg">Temp Consolidée (º<span class="degsign">C</span>)</div>
					</div>
					<div id="frame">
						<div id="icot" style="font-size:40px;">99.9</div>
						<div id="label_lg">Consigne Temp (º<span class="degsign">C</span>)</div>
					</div>
				</div>

				<div>
					<div id="frame">
						<div id="ipluie" style="font-size:40px;;color:#3333cc;">0.0</div>
						<div id="label_lg">Pluie (ltr)</div>
					</div>
					<div id="frame">
						<div id="iedfc" style="font-size:40px;color:#ff3333;">--</div>
						<div id="label_lg">Conso. Courante (watt)</div>
					</div>
					<div id="frame">
						<div id="iedf" style="font-size:40px;color:#ff3333;">--</div>
						<div id="label_lg">Electicité (kW)</div>
					</div>
					<div id="frame">
						<div id="igaz" style="font-size:40px;color:#009933;">9.999</div>
						<div id="label_lg">Gaz (m³)</div>
					</div>
					<div id="frame">
						<div id="itch" style="font-size:40px;color:#ff3333;">99.9</div>
						<div id="label_lg">Temp Chaud. Dep. (º<span class="degsign">C</span>)</div>
					</div>
				</div>

			<div>
				<div id="frame">
					<div id="ipluiej" style="font-size:40px;;color:#3333cc;">0.0</div>
					<div id="label_lg">Pluie Jour (mm)</div>
				</div>
				<div id="frame">
					<div id="iuv" style="font-size:40px;color:#C34A2C;">8.0</div>
					<div id="label_lg">UV</div>
				</div>
				<div id="frame">
					<div id="ivent" style="font-size:40px;">9.9</div>
					<div id="label_lg">Vent (<span class="iventsign">km/h</span>)</div>
				</div>
				<div id="frame">
					<div id="ihext" style="font-size:40px;color:darkorange;">99</div>
					<div id="label_lg">Humidity Ext (%)</div>
				</div>
				<div id="frame">
					<div id="itchr" style="font-size:40px;color:#3333cc;">00.0</div>
					<div id="label_lg">yyyyyy (º<span class="degsign">C</span>)</div>
				</div>
			</div>

			<div>
				<div id="frame">
					<div id="iairparif" style="font-size:40px;">99.99%</div>
					<div id="label_lg">Pollution (%)</div>
				</div>
				<div id="frame">
					<div id="iforecast">Partly</div>
					<div id="label_lg">Prévision Météo</div>
				</div>
				<div id="frame">
					<div id="ibaro" style="font-size:40px;">9999</div>
					<div id="label_lg">Baromètre (hPa)</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript" charset="utf-8" class="ng-scope">
function RefreshData()
{
	clearInterval($.refreshTimer);
	var jurl=$.domoticzurl+"/json.htm?type=devices&plan="+$.roomplan+"&lastupdate="+$.LastUpdateTime+"&jsoncallback=?";
	$.getJSON(jurl,
	{
		format: "json"
	},
	function(data) {
		if (typeof data.ActTime != 'undefined') {
			$.LastUpdateTime=parseInt(data.ActTime);
		}
		if (typeof data.result != 'undefined') {
			if (typeof data.WindSign != 'undefined') {
				$('.iventsign').html(data.WindSign);
			}
			if (typeof data.TempSign != 'undefined') {
				$('.degsign').html(data.TempSign);
			}
			$.each(data.result, function(i,item){
				for( var ii = 0, len = $.PageArray.length; ii < len; ii++ ) {
					if( $.PageArray[ii][0] === item.idx ) {
						var vtype=$.PageArray[ii][1];
						var vlabel=$.PageArray[ii][2];
						var vdata=item[vtype];
						if (typeof vdata == 'undefined') {
							vdata="??";
						}
						else {
							if (vlabel == 'iairparif') { 
							vdata=new String(vdata).split(".",1)[0];						
							}
							else
							{
							vdata=new String(vdata).split(" ",1)[0];
							}							
						}
						$('#'+vlabel).html(vdata);
					}
				}
			});
		}
	});
	$.refreshTimer = setInterval(RefreshData, 10000);
}

$(document).ready(function() {
	$.LastUpdateTime=parseInt(0);
	$.roomplan=7;
	$.domoticzurl="";//"http://192.168.0.252:8084";
	//format: idx, value, label, comment
	$.PageArray = [
		['47','Humidity','ihext','woonkamer'],
		['96','Temp','itext','woonkamer'],
		['102','Temp','itsalon','woonkamer'],
		['101','Temp','itpc','woonkamer'],
		['95','Temp','itgc','woonkamer'],
		['94','Temp','itcm','woonkamer'],
		['93','Temp','itcl','woonkamer'],
		['103','Temp','itcp','woonkamer'],
		['80','Temp','itss','woonkamer'],
		['105','SetPoint','icot','woonkamer'],   // C'est ici que cela se passe
		['50','Rain','ipluie','woonkamer'],
		['46','CounterToday','igaz','woonkamer'],
		['99','CounterToday','iedf','woonkamer'],
		['99','Usage','iedfc','woonkamer'],
		['99','Temp','itchr','woonkamer'],
		['50','RainRate','ipluiej','woonkamer'],
		['49','UVI','iuv','woonkamer'],
		['48','Speed','ivent','woonkamer'],
		['100','Temp','itch','woonkamer'],
		['99','Humidity','ihumint','woonkamer'],
		['57','Data','iairparif','woonkamer'],
		['47','ForecastStr','iforecast','woonkamer'],
		['47','Barometer','ibaro','woonkamer'],


	];

    RefreshData();
});
</script>
Dernière modification par bruch05 le 18 mai 2016, 22:23, modifié 1 fois.
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: Pbe sur Page Perso

Message par vil1driver »

Salut,

il te faudrait pour commencer déjà renseigner les variables

Code : Tout sélectionner

$.roomplan
$.domoticzurl
mais avant que tu t'embourbe dans ce genre de page..
viewtopic.php?f=17&t=331
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
bruch05
Messages : 47
Inscription : 27 févr. 2016, 21:06

[RESOLU] Re: Pbe sur Page Perso

Message par bruch05 »

Bonsoir,

Après une nuit de sommeil, je me suis aperçu que j'avais oublié d'intégrer le nouveau device virtuel dans le roomplan utilisé pour la page perso.

Cela m'apprendra à faire de la domotique à "pas d'heure" :shock:

Merci pour ton aide

Tof
Répondre