Re: custom page
Publié : 26 mars 2016, 14:48
il n'est pas utile de citer systématiquement le message auquel tu réponds.. 
Reprenez le contrôle de votre domotique
https://easydomoticz.com/forum/
J'ai réussi aussi à récupérer les positions de mes iPhones dans des capteurs texte mais le code ci-dessus ne m'affiche pas la position.vil1driver a écrit :avec les coordonnées en variables ou en capteur texte stockées sous cette forme "48.0761279,-1.7084094" ça donne ça
Code : Tout sélectionner
function initMap() { // define map area var map = new google.maps.Map(document.getElementById('map'), { disableDefaultUI: true, zoom: 14, center: {lat: 48.0761279, lng: -1.7084094} }); // define traffic layer var trafficLayer = new google.maps.TrafficLayer(); trafficLayer.setMap(map); // get olivier gps from variable $.ajax({ url: [$.domoticzurl,'/json.htm?type=command¶m=getuservariable&idx=38'].join('') }).done(function(data) { if (typeof data.result !== 'undefined') { var olivier = new google.maps.LatLng(parseFloat(data.result[0].Value.split(',')[0]),parseFloat(data.result[0].Value.split(',')[1])); console.log('olivier: '+olivier); // define olivier marker var marker_olivier = new google.maps.Marker({ position: olivier, map: map, icon: 'http://maps.google.com/mapfiles/ms/micons/green-dot.png', title: 'olivier' }); // set marker marker_olivier.setMap(map); } }); // get delphine gps from text sensor $.ajax({ url: [$.domoticzurl,'/json.htm?type=devices&rid=21'].join('') }).done(function(data) { if (typeof data.result !== 'undefined') { var delphine= new google.maps.LatLng(parseFloat(data.result[0].Data.split(',')[0]),parseFloat(data.result[0].Data.split(',')[1])); console.log('delphine: '+delphine); // define delphine marker var marker_delphine = new google.maps.Marker({ position: delphine, map: map, icon: 'http://maps.google.com/mapfiles/ms/micons/pink-dot.png', title: 'delphine' }); // set marker marker_delphine.setMap(map); } }); setInterval(initMap, 600000); }
sinon tu te sers de quoi pour envoyer ta position à domoticz ?
Code : Tout sélectionner
// get delphine gps from text sensor
$.ajax({
url: [$.domoticzurl,'/json.htm?type=devices&rid=21'].join('')
}).done(function(data) {
if (typeof data.result !== 'undefined') {
var delphine= new google.maps.LatLng(parseFloat(data.result[0].Data.split(',')[0]),parseFloat(data.result[0].Data.split(',')[1]));
console.log('delphine: '+delphine);
// define delphine marker
var marker_delphine = new google.maps.Marker({
position: delphine,
map: map,
icon: 'http://maps.google.com/mapfiles/ms/micons/pink-dot.png',
title: 'delphine'
});
// set marker
marker_delphine.setMap(map);
}
}); avec les coordonnées en variables ou en capteur texte stockées sous cette forme "48.0761279,-1.7084094" ça donne ça
code
//(...)
// get olivier gps from variable
$.ajax({
url: [$.domoticzurl,'/json.htm?type=command¶m=getuservariable&idx=38'].join('')
//(...)
});
// get delphine gps from text sensor
$.ajax({
url: [$.domoticzurl,'/json.htm?type=devices&rid=21'].join('')
//(...)
});
//(...)
/code
Code : Tout sélectionner
// blinds
if (item.SwitchType === 'Blinds') {
if(vdata === 'Closed') {var down = ['<img src=',$.domoticzurl,'/images/down.png hspace=1 width=20 onclick="SwitchToggle(',item.idx,', \'On\');lightbox_open(\'switch\', ',switch_timeout,', ',txt_blind_down,')"> '].join('');
var up = [' <img src=',$.domoticzurl,'/images/up.png hspace=1 width=20 onclick="SwitchToggle(',item.idx,', \'Off\');lightbox_open(\'switch\', ',switch_timeout,', ',txt_blind_up,')">'].join('');
}
else if (vdata === 'Open' || vdata === 'Stopped') {var down = ['<img src=',$.domoticzurl,'/images/down.png hspace=1 width=20 onclick="SwitchToggle(',item.idx,', \'On\');lightbox_open(\'switch\', ',switch_timeout,', ',txt_blind_down,')"> '].join('');
var up = [' <img src=',$.domoticzurl,'/images/up.png hspace=1 width=20 onclick="SwitchToggle(',item.idx,', \'Off\');lightbox_open(\'switch\', ',switch_timeout,', ',txt_blind_up,')">'].join('');
}
var stop = ['<img src=',$.domoticzurl,'/images/blindsstop.png hspace=1 height=40 onclick="SwitchToggle(',item.idx,', \'Stop\');lightbox_open(\'switch\', ',switch_timeout,', ',txt_blind_stop,')">'].join('');
if(item.Type === 'RFY') {
vdata = [down,stop,up].join('');
}
else {
vdata = [down,vdata,up].join('');
}
Code : Tout sélectionner
['0','Clock', 'meteo_1', '','','','font-family:digital;color:#8BFD1C;font-size:160%',''], // heure et date
['0','Hide', 'meteo_2', ' ','','','',''], // colonne 1
['0','SunBoth', 'ls_meteo_2', '','','','color:#F2DDB3;font-size:19px;font-weight:bold'], // heures soleil dans la description de la cellule 25
['THB','Temp', 'meteo_3', '','','','',''], // colonne 2
['THB','Humidity', 'desc_meteo_3', '','','','',''], // colonne 2
['Vigilance Météo','Level', 'meteo_4', '','','','',''], // colonne 5
['0','Text', 'desc_meteo_4', 'Vigilance Météo','','','',''], // colonne 5
//['0','', 'meteo_4', '','','','',''],
['76','ForecastStr', 'meteo_25', '','1','','',''], // colonne 4
['0','Text', 'desc_meteo_25', 'Demain','','','color:#F2DDB3;font-size:19px;font-weight:bold',''], // colonne 4
['0','Hide', 'meteo_5', '','','','',''],
['Proba Pluie 1h','Data', 'meteo_6', '','','','','x > 65'], // proba pluie dans 1h
['','Text', 'desc_meteo_6', 'Pluie 1h','','','',''],
['Proba Pluie 2h','Data', 'meteo_7', 'Pluie 2h','','','','x > 45'], // proba pluie dans 2h
['','Text', 'desc_meteo_7', 'Pluie 2h','','','',''],
['Proba Pluie 6h','Data', 'meteo_8', '','','','','x > 45'], // proba pluie dans 6h
['','Text', 'desc_meteo_8', 'Pluie 6h','','','',''],
['Proba Pluie 12h','Data', 'meteo_9', '','','','','x > 45'], // proba pluie dans 12h
['','Text', 'desc_meteo_9', 'Pluie 12h','','','',''],
['Proba Pluie 24h','Data', 'meteo_10', '','','','','x > 45'], // proba pluie dans 12h
['','Text', 'desc_meteo_10', 'Pluie 24h','','','',''],