Re: Gestion Poéle à pellets Rika
Publié : 27 nov. 2016, 12:10
il faut que tu regardes le script de Celtic80 car moi je n'utilise pas domoticz
Reprenez le contrôle de votre domotique
https://easydomoticz.com/forum/
Code : Tout sélectionner
$Extract_Format_JSON = file_get_contents($Fichier_Status);
$JSON_PARSE = json_decode($Extract_Format_JSON, true);
$MultiAirActif = $JSON_PARSE['controls']['convectionFan1Active'];
$PoeleOnOff = $JSON_PARSE['controls']['onOff'];
$Status_Chauf_Main = $JSON_PARSE['sensors']['statusMainState'];
$Status_Chauf_Sub = $JSON_PARSE['sensors']['statusSubState'];
$Conso_Pelet_Total = $JSON_PARSE['sensors']['parameterFeedRateTotal'];
$Temp_Consigne = $JSON_PARSE['controls']['targetTemperature'];Code : Tout sélectionner
$Url = 'http://192.168.0.1:8080/json.htm?type=command¶m=updateuservariable&idx=21&vname=POELE_SOUSETAT&vtype=0&vvalue='.$Status_Chauf_Sub;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $Url);
$result1 = curl_exec($curl);
curl_close($curl);
$Url = 'http://192.168.0.1:8080/json.htm? type=command¶m=updateuservariable&idx=20&vname=POELE_ETAT&vtype=0&vvalue='.$Status_Chauf_Main;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $Url);
$result1 = curl_exec($curl);
curl_close($curl);
$Url = 'http://192.168.0.1:8080/json.htm?type=command¶m=updateuservariable&idx=25&vname=POELE_ONOFF&vtype=0&vvalue='.$PoeleOnOff;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $Url);
$result1 = curl_exec($curl);
curl_close($curl);
$Url = 'http://192.168.0.1:8080/json.htm?type=command¶m=updateuservariable&idx=22&vname=POELE_MULTIAIR&vtype=0&vvalue='.$MultiAirActif;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $Url);
$result1 = curl_exec($curl);
curl_close($curl);
$Url = 'http://192.168.0.1:8080/json.htm?type=command¶m=updateuservariable&idx=23&vname=POELE_CONSOTOTALE&vtype=0&vvalue='.$Conso_Pelet_Total;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $Url);
$result1 = curl_exec($curl);
curl_close($curl);
$Url = 'http://192.168.0.1:8080/json.htm?type=command¶m=updateuservariable&idx=24&vname=POELE_CONSIGNE&vtype=0&vvalue='.$Temp_Consigne;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $Url);
$result1 = curl_exec($curl);
curl_close($curl);
Code : Tout sélectionner
commandArray = {}
NOM_INTERRUPTEUR_PILOTAGE_EXTRACTEURAIR = 'Extracteur-Air'
-- ----------------------------------------------------------------------------------
-- --Récupération de toutes les variables Domoticz servant au script et remise à 0 --
-- ----------------------------------------------------------------------------------
POELE_ONOFF = tonumber(uservariables['POELE_ONOFF'])
POELE_CONSIGNE = tonumber(uservariables['POELE_CONSIGNE'])
POELE_CONSOTOTALE = tonumber(uservariables['POELE_CONSOTOTALE'])
POELE_MULTIAIR = tonumber(uservariables['POELE_MULTIAIR'])
POELE_SOUSETAT = tonumber(uservariables['POELE_SOUSETAT'])
POELE_ETAT = tonumber(uservariables['POELE_ETAT'])
if POELE_ONOFF == 0 then
print('Poele Eteint')
else
print('Poele allume')
if POELE_ETAT == 1 then
if POELE_SOUSETAT == 0 then
print('... en cours d extinction')
end
if POELE_SOUSETAT == 3 then
print('... en veille')
end
end
if POELE_ETAT == 2 then
if POELE_SOUSETAT == 6 then
print('... en cours d allumage')
end
end
if POELE_ETAT == 3 then
if POELE_SOUSETAT == 1 then
print('... en cours de demarrage')
end
end
if POELE_ETAT == 4 then
if POELE_SOUSETAT == 4 then
print('... en chauffe - controle')
end
end
if POELE_ETAT == 6 then
print('Fin de combustion')
end
end
print('POELE_ONOFF : ' ..POELE_ONOFF)
print('POELE_ETAT : ' ..POELE_ETAT)
print('POELE_SOUSETAT : ' ..POELE_SOUSETAT)
if (POELE_ONOFF ==1 and POELE_ETAT == 4 and (POELE_SOUSETAT == 4 or POELE_SOUSETAT == 3)) then
print('Poele en fonctionnement - activation de l extracteur d air')
commandArray[NOM_INTERRUPTEUR_PILOTAGE_EXTRACTEURAIR] = 'On'
else
print('Poele inactif - desactivation de l extracteur d air')
commandArray[NOM_INTERRUPTEUR_PILOTAGE_EXTRACTEURAIR] = 'Off'
end
return commandArray