La valeur indiquée par le compteur est correcte (entre 500 et 1000W), mais le graphe n'affiche rien de bien...


Code : Tout sélectionner
if adresse ~= '' then voir_les_logs('--- --- --- Adresse : '..adresse..' --- --- --',debugging) end
local rid = assert(io.popen("/usr/bin/curl -m5 ".. adresse))
local testhtml = rid:read('*all')
rid:close()
for instance in testhtml:gmatch("<body>(.-)</body>") do
div, LifetimeGeneration=instance:match('Lifetime generation(.-)<td>(.-)kWh </td>')
div1, LastSystemPower=instance:match('Last System Power(.-)<td>(.-)W </td>')
div2, GenerationofCurrentDay=instance:match('Generation of Current Day(.-)<td>(.-)kWh </td>')
end Code : Tout sélectionner
<th scope="row">Lifetime generation</th>
<td>632.49 kWh </td>Code : Tout sélectionner
<tbody>
<div>
<tr class='active'>
<td>404000251589-A </td>
<td> 202 W </td>
<td rowspan=2 style='vertical-align: middle;'> 50.0 Hz </td>
<td> 236 V </td>
<td rowspan=2 style='vertical-align: middle;'> 55 °C </td>
<td rowspan=2 style='vertical-align: middle;'> 2018-08-23 13:33:42
</td>
</tr>
<tr class='active'>
<td>404000251589-B </td>
<td> 207 W </td>
<td> 236 V </td>
</tr>
</div>
<div>
<tr >
<td>404000251806-A </td>
<td> 202 W </td>
<td rowspan=2 style='vertical-align: middle;'> 50.0 Hz </td>
<td> 234 V </td>
<td rowspan=2 style='vertical-align: middle;'> 55 °C </td>
<td rowspan=2 style='vertical-align: middle;'> 2018-08-23 13:33:42
</td>
</tr>
<tr >
<td>404000251806-B </td>
<td> 209 W </td>
<td> 234 V </td>
</tr>
</div>
</tbody>Code : Tout sélectionner
if ((time.min-1) % delai) == 0 then -- toutes les xx minutes en commençant par xx:01. xx définissable via la variable delai
voir_les_logs("=========== ".. nom_script .." (v".. version ..") ===========",debugging)
if adresse ~= '' then voir_les_logs('--- --- --- Adresse : '..adresse..' --- --- --',debugging) end
local rid = assert(io.popen("/usr/bin/curl -m5 ".. adresse))
local testhtml = rid:read('*all')
rid:close()
for instance in testhtml:gmatch("<tbody>(.-)</tbody>") do
div, temperaturePanneau=instance:match('404000251589-A (.-)<td>(.-)W </td>')
end
if temperaturePanneau ~= nil then
voir_les_logs("--- --- --- temperature Panneau : ".. temperaturePanneau.."degres --- --- --",debugging)
else
voir_les_logs('--- --- --- temperaturePanneau est vide --- --- --',debugging)
end
--commandArray['UpdateDevice'] = P1compteur.."|0|"..LifetimeGeneration..";0;0;0;"..LastSystemPower..";0"
commandArray['UpdateDevice'] = tempSolaire.."|0|"..temperaturePanneau
voir_les_logs("========= Fin ".. nom_script .." (v".. version ..") =========",debugging)
end -- if time
end
return commandArraygroupe de capture (.-)marcus_54 a écrit : je n'arrive pas à trouver la signification de "(.-)"

Code : Tout sélectionner
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 兼容IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 支持国产浏览器高速模式 -->
<meta name="renderer" content="webkit">
<!-- 响应式布局 -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Altenergy Power Control Software</title>
<link type="image/x-icon" href="http://192.168.0.6/resources/images/favicon.ico" rel="shortcut icon">
<link href="http://192.168.0.6/resources/css/bootstrap.min.css" rel="stylesheet">
<link href="http://192.168.0.6/resources/css/ecu-style.css" rel="stylesheet">
<link href="http://192.168.0.6/resources/css/bootstrapValidator.css" rel="stylesheet">
<!--[if lt IE 8]>
<link href="http://192.168.0.6/resources/css/bootstrap-ie7.css" rel="stylesheet">
<![endif]-->
<script src="http://192.168.0.6/resources/js/jquery-1.8.2.min.js"></script>
<script src="http://192.168.0.6/resources/js/bootstrap.min.js"></script>
<script src="http://192.168.0.6/resources/js/bootstrapValidator.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn"t work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- 顶部导航栏 -->
<header>
<div class="navbar navbar-default navbar-top">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-target="#navbar-header" data-toggle="collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.altenergy-power.com">
<img src="http://192.168.0.6/resources/images/logo.png">
</a>
</div>
<div class="navbar-collapse collapse" id="navbar-header">
<ul class="nav navbar-nav navbar-title">
<li><a id="ecu_title">ENERGY COMMUNICATION UNIT</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<a class="btn chlang" id="english" >English</a>|
<a class="btn chlang" id="chinese" >Chinese</a>
</ul>
</div>
</div>
</div>
</header><!-- 菜单导航栏 -->
<nav>
<div class="navbar navbar-default navbar-menu">
<div class="container">
<p class="navbar-menu-title">Real Time Data</p>
<div class="navbar-header">
<button class="navbar-toggle" data-target="#navbar-menu" data-toggle="collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbar-menu">
<ul class="nav navbar-nav ">
<li><a href="http://192.168.0.6/index.php/home">Home</a></li>
<li><a href="http://192.168.0.6/index.php/realtimedata" class="active">Real Time Data</a><span> </span></li>
<!--
<li><a href="http://192.168.0.6/index.php/meter/meter_power_graph">Meter</a><span> </span></li>
-->
<li><a href="http://192.168.0.6/index.php/management">Administration</a><span> </span></li>
</ul>
</div>
</div>
</div>
</nav>
<section>
<div class="container container-main">
<!-- 侧边导航栏 -->
<aside class="col-md-3 col-md-push-9">
<div class="list-group">
<a href="http://192.168.0.6/index.php/realtimedata" class="list-group-item active">Real Time Data</a>
<a href="http://192.168.0.6/index.php/realtimedata/power_graph" class="list-group-item ">Power</a>
<a href="http://192.168.0.6/index.php/realtimedata/energy_graph" class="list-group-item ">Energy</a>
</div>
</aside>
<!-- 正文 -->
<article class="col-md-9 col-md-pull-3">
<div class="panel panel-default">
<div class="panel-heading">
Real Time Data <div class="btn-group pull-right visible-xs">
<button type="button" class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown">More <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<a href="http://192.168.0.6/index.php/realtimedata" class="list-group-item active">Real Time Data</a>
<a href="http://192.168.0.6/index.php/realtimedata/power_graph" class="list-group-item ">Power</a>
<a href="http://192.168.0.6/index.php/realtimedata/energy_graph" class="list-group-item ">Energy</a>
</ul>
</div>
</div>
<div class="panel-body"><div class="table-responsive">
<table class="table table-condensed table-bordered">
<thead>
<tr>
<th scope="col">Inverter ID</th>
<th scope="col">Current Power</th>
<th scope="col">Grid Frequency</th>
<th scope="col">Grid Voltage</th>
<th scope="col">Temperature</th>
<th scope="col">Reporting Time</th>
</tr>
</thead>
<tbody>
<div>
<tr class='active'>
<td>404000251589-A </td>
<td> 14 W </td>
<td rowspan=2 style='vertical-align: middle;'> 50.1 Hz </td>
<td> 234 V </td>
<td rowspan=2 style='vertical-align: middle;'> 28 °C </td>
<td rowspan=2 style='vertical-align: middle;'> 2018-08-26 19:28:39
</td>
</tr>
<tr class='active'>
<td>404000251589-B </td>
<td> 13 W </td>
<td> 234 V </td>
</tr>
</div>
<div>
<tr >
<td>404000251806-A </td>
<td> 12 W </td>
<td rowspan=2 style='vertical-align: middle;'> 50.0 Hz </td>
<td> 233 V </td>
<td rowspan=2 style='vertical-align: middle;'> 28 °C </td>
<td rowspan=2 style='vertical-align: middle;'> 2018-08-26 19:28:39
</td>
</tr>
<tr >
<td>404000251806-B </td>
<td> 13 W </td>
<td> 233 V </td>
</tr>
</div>
</tbody>
</table>
</div> </div>
</div>
</article>
</div>
</section>
<footer class="footer">© 2015 Altenergy Power System Inc.</footer>
<script>
/* 指定5分钟刷新一次 */
function myrefresh() {
window.location.reload();
}
setTimeout('myrefresh()',300000);
/* 切换语言 */
$(".chlang").click(function(){
$.ajax({
url : "http://192.168.0.6/index.php/management/set_language",
type : "post",
dataType : "json",
data: "language=" + $(this).attr("id"),
})
setTimeout("location.reload();",500);//刷新页面
});
</script>
</body>
</html>Code : Tout sélectionner
--[[
name : script_time_energy_communication_unit.lua
auteur : papoo
Mise à jour : 26/08/2018
date : 26/08/2018
]]--
--------------------------------------------
------------ Variables à éditer ------------
--------------------------------------------
local debugging = true -- true pour voir les logs dans la console log Dz ou false pour ne pas les voir
local script_actif = true -- active (true) ou désactive (false) ce script simplement
local delai = 1 -- délai d'exécution de ce script en minutes de 1 à 59
local adresse = "https://pon.fr/test.html"
--------------------------------------------
----------- Fin variables à éditer ---------
--------------------------------------------
local nom_script = 'Energy Communication Unit'
local version = '0.1'
--------------------------------------------
---------------- Fonctions -----------------
--------------------------------------------
function voir_les_logs (s, debugging) -- nécessite la variable local debugging
if (debugging) then
if s ~= nil then
print (s)
else
print ("aucune valeur affichable")
end
end
end -- usage voir_les_logs("=========== ".. nom_script .." (v".. version ..") ===========",debugging)
--------------------------------------------
-------------- Fin Fonctions ---------------
--------------------------------------------
commandArray = {}
time = os.date("*t")
if script_actif == true then
--if (time.hour == 00 and time.min == 20) then -- tout les matins à 00h20
--if (time.min == 20 and ((time.hour == 7) or (time.hour == 13) or (time.hour == 18))) then -- 3 exécutions du script par jour à 7H20, 13h20 et 18H20
-- if time.hour % 2 == 0 then -- toutes les deux heures
-- if (time.hour%1 == 0 and time.min == 10) then -- Toutes les heures et 10 minutes
-- if time.min% 2 == 0 then
if ((time.min-1) % delai) == 0 then -- toutes les xx minutes en commençant par xx:01. xx définissable via la variable delai
voir_les_logs("=========== ".. nom_script .." (v".. version ..") ===========",debugging)
if adresse ~= '' then voir_les_logs('--- --- --- Adresse : '..adresse..' --- --- --',debugging) end
local rid = assert(io.popen("/usr/bin/curl -m5 ".. adresse))
local testhtml = rid:read('*all')
rid:close()
for instance in testhtml:gmatch('<body>(.-)</body>') do
pattern1=instance:match("404000251589%-A </td>.-<td>(.-) W </td>")
pattern2=instance:match("404000251589%-A </td>.-middle;'%>(.-) Hz </td>")
pattern3=instance:match("404000251589%-A </td>.-Hz.-<td>(.-) V </td>")
pattern4=instance:match("404000251589%-A </td>.-middle;'%>.-Hz </td>.-middle;'%>(.-) °C </td>")
pattern11=instance:match("404000251589%-B </td>.-<td>(.-) W </td>")
pattern12=instance:match("404000251589%-B </td>.-Hz.-<td>(.-) V </td>")
pattern21=instance:match("404000251806%-A </td>.-<td>(.-) W </td>")
pattern22=instance:match("404000251806%-A </td>.-middle;'%>(.-) Hz </td>")
pattern23=instance:match("404000251806%-A </td>.-Hz.-<td>(.-) V </td>")
pattern24=instance:match("404000251806%-A </td>.-middle;'%>.-Hz </td>.-middle;'%>(.-) °C </td>")
pattern31=instance:match("404000251806%-B </td>.-<td>(.-) W </td>")
pattern32=instance:match("404000251806%-B </td>.-Hz.-<td>(.-) V </td>")
end
if pattern1 ~= nil then
voir_les_logs("--- --- --- pattern1 : ".. pattern1.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern1 est vide --- --- --',debugging)
end
if pattern2 ~= nil then
voir_les_logs("--- --- --- pattern2 : ".. pattern2.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern2 est vide --- --- --',debugging)
end
if pattern3 ~= nil then
voir_les_logs("--- --- --- pattern3 : ".. pattern3.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern3 est vide --- --- --',debugging)
end
if pattern4 ~= nil then
voir_les_logs("--- --- --- pattern4 : ".. pattern4.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern4 est vide --- --- --',debugging)
end
if pattern11 ~= nil then
voir_les_logs("--- --- --- pattern11 : ".. pattern11.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern11 est vide --- --- --',debugging)
end
if pattern12 ~= nil then
voir_les_logs("--- --- --- pattern12 : ".. pattern12.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern12 est vide --- --- --',debugging)
end
if pattern21 ~= nil then
voir_les_logs("--- --- --- pattern21 : ".. pattern21.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern21 est vide --- --- --',debugging)
end
if pattern22 ~= nil then
voir_les_logs("--- --- --- pattern22 : ".. pattern22.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern22 est vide --- --- --',debugging)
end
if pattern23 ~= nil then
voir_les_logs("--- --- --- pattern23 : ".. pattern23.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern23 est vide --- --- --',debugging)
end
if pattern24 ~= nil then
voir_les_logs("--- --- --- pattern24 : ".. pattern24.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern24 est vide --- --- --',debugging)
end
if pattern31 ~= nil then
voir_les_logs("--- --- --- pattern31 : ".. pattern31.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern31 est vide --- --- --',debugging)
end
if pattern32 ~= nil then
voir_les_logs("--- --- --- pattern32 : ".. pattern32.." --- --- --",debugging)
else
voir_les_logs('--- --- --- pattern32 est vide --- --- --',debugging)
end
voir_les_logs("========= Fin ".. nom_script .." (v".. version ..") =========",debugging)
end -- if time
end
return commandArrayCode : Tout sélectionner
--[[
name : script_time_Altenergy_U_reseau.lua
auteur : papoo
date : 26/08/2018
Principe :
26/08/2018
]]--
--------------------------------------------
------------ Variables à éditer ------------
--------------------------------------------
local nom_script = "Altenergy_U_t"
local debugging = false -- true pour voir les logs dans la console log Dz ou false pour ne pas les voir
local script_actif = true -- active (true) ou désactive (false) ce script simplement
local delai = 5 -- délai d'exécution de ce script en minutes de 1 à 59
local CapteurVirtuel_temp = 756
local CapteurVirtuel_tension = 757
local adresse = "http://192.168.0.6/index.php/realtimedata"
--------------------------------------------
----------- Fin variables à éditer ---------
--------------------------------------------
local nom_script = 'Altenergy_U_t'
local version = '1'
--------------------------------------------
---------------- Fonctions -----------------
--------------------------------------------
function voir_les_logs (s, debugging) -- nécessite la variable local debugging
if (debugging) then
if s ~= nil then
print (s)
else
print ("aucune valeur affichable")
end
end
end -- usage voir_les_logs("=========== ".. nom_script .." (v".. version ..") ===========",debugging)
--------------------------------------------
-------------- Fin Fonctions ---------------
--------------------------------------------
commandArray = {}
time = os.date("*t")
if script_actif == true then
--if (time.hour == 00 and time.min == 20) then -- tout les matins à 00h20
--if (time.min == 20 and ((time.hour == 7) or (time.hour == 13) or (time.hour == 18))) then -- 3 exécutions du script par jour à 7H20, 13h20 et 18H20
--if time.hour % 2 == 0 then -- toutes les deux heures
--if (time.hour%1 == 0 and time.min == 10) then -- Toutes les heures et 10 minutes
--if time.min% 2 == 0 then
if ((time.min-1) % delai) == 0 then -- toutes les xx minutes en commençant par xx:01. xx définissable via la variable delai
voir_les_logs("=========== ".. nom_script .." (v".. version ..") ===========",debugging)
if adresse ~= '' then voir_les_logs('--- --- --- Adresse : '..adresse..' --- --- --',debugging) end
local rid = assert(io.popen("/usr/bin/curl -m5 ".. adresse))
local testhtml = rid:read('*all')
rid:close()
for instance in testhtml:gmatch("<tbody>(.-)</tbody>") do
tensionOnduleur=instance:match("404000251589%-A </td>.-Hz.-<td>(.-) V </td>")
tempOnduleur=instance:match("404000251589%-A </td>.-middle;'%>.-Hz </td>.-middle;'%>(.-) °C </td>")
end
if pattern1 ~= nil then
voir_les_logs("--- --- --- Tension reseau : ".. pattern1.." --- --- --",debugging)
else
voir_les_logs('--- --- --- Tension reseau est vide --- --- --',debugging)
end
if pattern2 ~= nil then
voir_les_logs("--- --- --- Temperature onduleur : ".. tempOnduleur.." --- --- --",debugging)
else
voir_les_logs('--- --- --- Temperature onduleur --- --- --',debugging)
end
local CmdIdx=1
commandArray[CmdIdx] = {['UpdateDevice'] = CapteurVirtuel_temp.."|0|"..tempOnduleur}
CmdIdx=CmdIdx+1
commandArray[CmdIdx] = {['UpdateDevice'] = CapteurVirtuel_tension.."|0|"..tensionOnduleur}
CmdIdx=CmdIdx+1
voir_les_logs("========= Fin ".. nom_script .." (v".. version ..") =========",debugging)
end -- if time
end
return commandArray