Page 1 of 1

Battery storage

Posted: Wed Jan 15, 2020 6:22 pm
by jeanmarc
I am thinking about adding battery storage but i don't know yet how to get it right. It should obviously visualize in dashboard energy flow but maybe show other information, like amount/remaining storage..

My first thoughts if about making a meter "Elect" "Storage" type and if you want more details (remaining storage,..) it could be shown as plain indicators.
How behave the main gauge.. (Consumption - (Production + Storage)) A nice battery gauge would be nice as well... :think:

Well if some of you have such devices, i am interested to know what values it returns.

Re: Battery storage

Posted: Thu Jan 30, 2020 8:47 am
by mstuetz
I'm a long time user of 123solar and metern (started in 2013). Off course I would like to have storage covered better with meterN.
Since a couple of years I run a battery storage, here a pic of how I added it to meterN:
To have a quick overview, I added this java-script on the main side of my house's "website":
Off course efficency of this battery would be cool as well and a project planned for this year.

Re: Battery storage

Posted: Sat Feb 01, 2020 5:45 pm
by jeanmarc
thanks for your feedback. Can you re link your code ?

Re: Battery storage

Posted: Tue Feb 11, 2020 8:50 am
by mstuetz
Do you mean the battery graphic?
It's basically coded in js:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="refresh" content="10">
    <title>Infini Batterie Status</title>
    <script type="text/javascript" src="js/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="js/battery.js"></script>
    <link rel='stylesheet' type='text/css' href='css/battery.css'>
<div id="box">
    <div id="header">
    <span style="display: block;margin-bottom:5px;font-size: large;"><strong>Batterie Daten</strong></span>
    <div id="battery"></div>
    <div id="text">
        <span style="display: block" id="level">Ladezustand: unknown</span>
        <span style="display: block" id="voltage">Spannung: unknown</span>
        <span style="display: block" id="status">Status: unknown</span>
        <span style="display: block" id="current">Ladestrom: unknown</span>
<script type="text/javascript">
// setup the image
        var b = new Battery("assets/bat_empty.png", "assets/bat_full.png", 96, 168);
// get the battery information from system
        var $capacity = <?php echo (file_get_contents('/tmp/iBATTCAP.txt')/100); ?>;
        var $voltage = <?php echo file_get_contents('/tmp/iBATTV.txt'); ?>;
        var $chargestate = "<?php echo trim(file_get_contents('/tmp/iBATTCODE.txt')); ?>";
        var $chargecurr1 =  <?php echo file_get_contents('/tmp/iBATTCHAMP.txt'); ?>;
        var $chargecurr2 =  <?php echo file_get_contents('/tmp/i2BATTCHAMP.txt'); ?>;
        var $chargecurr =  $chargecurr1 + $chargecurr2;

// get the battery information to be displayed
        $('#level').text("Ladezustand: " + Math.round($capacity * 100) + "%");
        $('#voltage').text("Spannung: " + $voltage + " V");
// Show charging state
        if ($chargestate == "D") $('#status').text("Status: Entladen");
        if ($chargestate == "A") $('#status').text("Status: Laden Konst.A");
        if ($chargestate == "B") $('#status').text("Status: Laden Konst.V");
        if ($chargestate == "F") $('#status').text("Status: Erhaltungsl.");

//    b.updateBattery(battery.level * 100); // Diese 100 sind die Prozent!!!
        b.updateBattery($capacity * 100);
        $('#current').text("Ladestrom: " + $chargecurr + " A");

Re: Battery storage

Posted: Wed Apr 22, 2020 4:59 am
by mstuetz
Sorry for the late repy - been caught in other projects. Working in health care keeps you quite bc nowadays. :shock:
Yes, that's right - it's JS. But the battery symbol is not the point.
In fact, meterN needs to know battery charge power and house consumption (during night = battery discharge). A (hybrid-)inverter can deliver this values: Charge + discharge amps and voltage at the current time. At least live values that can be taken into account.
A "new" meter covering both, charging+discharging, voltage and maybe efficiency (how many kwh's get charged into the batt, how many "out) would be awesome.
Do you have any idea, how that could be implemented best?

Re: Battery storage

Posted: Wed Apr 22, 2020 5:53 am
by jeanmarc
Hi mstuetz,
First my respect for your work in health care, i hope we'll get it through soon :|
I haven't yet been working much on that (busy will other things too) :)

I thought to add a new electrical "storage type", simply retruning negative power is charging battery, positive is giving energy then adapting the main gauge and dashboard. I'am not sure to add more details as they can be set as "Indicators".
Does the (hybrid-)inverter kWh counter goes back ? Or does it have separated counters (production/battery supply) which always increase ?

Re: Battery storage

Posted: Wed Apr 22, 2020 7:42 pm
by mstuetz
Sounds good.
My infinisolar hybrid inverters do not "count" kWh's that get charged/discharged into the battery.
But I poll all kind of (live-) data from the inverter every 2 secs. I could imagein writing a piece of code calculating 2 new values for charged and dis-charged Wh.
Don't know if it would be better to start from zero and count up or start counting new every day.
Off course I could also install a PZEM017 to log that. But I'm not quite sure which solution would be more accurate.

Re: Battery storage

Posted: Thu Apr 23, 2020 6:15 am
by jeanmarc
Ok, i will work on that but later on. I will make the "storage" type with non-mandatory main counter pooling.