je me suis résolu à utiliser le wget... mais dans dzvents.
Malheureusement au lieu d'un résultat (json) il semble que je reçoive du code ?
Le script
Code : Tout sélectionner
return {
active = true,
on = { timer = { 'at 16:42' }
},
execute = function(domoticz, item)
local today=tostring(os.date("%Y-%m-%d"))
local edf_url = "https://particulier.edf.fr/bin/edf_rc/servlets/ejptemponew?Date_a_remonter="..today.."&TypeAlerte=TEMPO"
domoticz.log('url = '..edf_url, domoticz.LOG_INFO)
local fname = "/home/pi/domoticz/tempo.txt"
os.execute("wget -O "..fname.." "..edf_url)
local f = io.open(fname, 'r')
if f then
repeat
lig = f:read("*l")
if not ( lig == nil ) then
domoticz.log('lig = '..lig, domoticz.LOG_INFO)
end
until lig == nil
f:close()
else
domoticz.log('Erreur ouverture de '..fname, domoticz.LOG_INFO)
end
end -- execute function
}Code : Tout sélectionner
<meta name="apple-itunes-app" content="app-id=563799142"/>
<meta name="google-play-app" content="app-id=com.edf.edfetmoi"/>
<script type="text/javascript">
var contenueSmartBanner = "";
$(function () {
if (window.location.href.indexOf('Appli_EDF') < 0 && contenueSmartBanner!='') {
var eltBaneers = $('[id^="bandeau-info"]');
var tempsMaxApparition = parseInt("")*1000;
var contenuSb = "".replace(/<p>/g,"").replace(/<\/p>/g,"");
$.smartbanner({
title: 'EDF & MOI',
author: 'EDF',
inAppStore: 'Sur l\'App Store',
inGooglePlay: 'Sur Google Play',
contenuBanner: contenuSb,
appStoreLanguage: 'fr',
buttonIOS: "",
buttonAndroid: "",
price: 'Gratuit',
daysHidden: 15,
daysReminder: 15,
layer: true
});
$("#smartbanner").addClass("");
$(window).scroll(function () {
if ($(document).scrollTop() >= 10) {
if ($headerMenu.data("headertype") != "stickyHeader") {
$("html").addClass("scrolled");
$.each(eltBaneers, function(i, banner) {
var textContent = $.trim($(banner).find('.information-banner__text').html());
if(textContent !== ""){
if ($("#smartbanner").css("display") != "none"){
$(banner).addClass('top80');
}
}
});
}
$("#smartbanner").css("position", "fixed");
if ($('#smartbanner').length && $('#smartbanner').css('display') !== 'none') {
$("#bar_top").css("top", $('#smartbanner').outerHeight(true) + "px");
}
} else {
if ($headerMenu.data("headertype") != "stickyHeader") {
$("html").removeClass("scrolled");
}
$("#smartbanner").css("position", "absolute");
$.each(eltBaneers, function(i, banner) {
var textContent = $.trim($(banner).find('.information-banner__text').html());
if(textContent !== ""){
$(banner).removeClass("top80");
}
});
}
});
if ($("#smartbanner").length) {
$("#smartbanner").show();
}
$(".sb-close").click(function() {
$.each(eltBaneers, function(i, banner) {
var textContent = $.trim($(banner).find('.information-banner__text').html());
if(textContent !== ""){
$(banner).removeClass("top80");
}
});
});
// Si plus de 2 pages ont été visité alors la bannière ne s'affiche plus
if(getCookie('nbpageVisit') && parseInt(getCookie('nbpageVisit'))>2){
fermerLaBanniere();
}
//Lors de l'écoulement du timmer
if(tempsMaxApparition){
setTimeout('fermerLaBanniere()', tempsMaxApparition);
}
}
});
// Fonction de fermeture de la bannière
function fermerLaBanniere(){
setCookie('sb-closed', 'true', $.smartbanner.defaults.daysHidden);
$("#smartbanner").hide();
}
// Fonction d'insertion d'un cookies bloquant l'affichage de la bannière
function setCookie(name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
value = encodeURIComponent(value) + ((exdays =
Toute aide sera bienvenue.
The Datawolf