Hi,
I want monitor the used time of my heating. There are any dummy device to do it?
I speak about see in log details the total time used per day like you can do with total Watts per day...
Best regards!
Time of use per day in statics
Moderators: leecollings, remb0
-
- Posts: 66
- Joined: Tuesday 19 April 2016 23:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Time of use per day in statics
Fronius plugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Time of use per day in statics
Some example code:
It grabs the history of idx 131 (my gas burner) and loops thru the result to calculate the total hours on in the last day.
Code: Select all
echo '<table>';
$datas = json_decode(file_get_contents($domoticzurl.'json.htm?type=lightlog&idx=131',true,$ctx),true);
$status = '';$tijdprev = $time;$totalon = 0;
if(!empty($datas['result'])) {
foreach($datas['result'] as $data) {
if($status!=$data['Status']) {
$status=$data['Status'];
$level=$data['Level'];
$tijd = strtotime($data['Date']);
if($tijd<$eendag) break;
$period = ($tijdprev - $tijd);
if($status=='On') $totalon = $totalon + $period;
$tijdprev = $tijd;
echo '<tr align="right"><td>'.$data['Date'].'</td><td> '.$status.' </td><td> '.convertToHoursMins($period/60).'</td></tr>';
}
}
}
echo '</table>';
function convertToHoursMins($time, $format = '%01d u %02d min') {if ($time < 1) return;$hours = floor($time / 60);$minutes = ($time % 60);return sprintf($format, $hours, $minutes);}
-
- Posts: 66
- Joined: Tuesday 19 April 2016 23:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Time of use per day in statics
Thanks for your script
But your script is to generate a table out of domoticz web interface.
Add these feature into domoticz will be fantastic!
But your script is to generate a table out of domoticz web interface.
Add these feature into domoticz will be fantastic!
Fronius plugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Time of use per day in statics
That's true, the best way to have things exactly as you want it.
-
- Posts: 66
- Joined: Tuesday 19 April 2016 23:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Time of use per day in statics
Where must be put your code??
Regards
Regards
Fronius plugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Time of use per day in statics
It's PHP code so you need a php enabled web server like Apache2 or nginx.
Who is online
Users browsing this forum: No registered users and 1 guest