OpenEnergyMonitor Community

My Solar PV Battery app

I haven’t changed anything overnight, but this morning it is positive. :confounded:

This last one might be de minimis / noise, but there doesn’t seem to be a consistency between the + or - across the two values.

Does anyone have any idea why the battwey SOC jumps from 0 to the current SOC?image

Hi Tristan
Thank-you for posting this setup for the battery CT - logical enough once you see it, but a head scratcher till then. I had no idea how to deal with the positive and negative in a single CT.

What you need is an FAQ for some of these REALLY USEFUL bits of ‘programming’ (well, for us beginners, anyway!)

I’ve been using the Solar Battery App for a few months now since setting up my DIY Powerwall and it is a really great bit of software.
I did spot that when charging and discharging at the same time only the charge rate would appear, which could be confusing, especially if charging at 44w whilst discharging at 600.
This was an easier fix for me and my son than expected, so much so we added a feature I’d been keen on. Showing how long the battery would last based on the current rate of discharge.
A new parameter “Battery Capacity” has been added to the configuration page to support this. Feel free to enjoy if this is of use to you… a pull request has been submitted.

I have a 10kWh battery and only cycle it between 30-80%, so have entered a capacity of 5 to reflect this. The SOC figures reflect this range.

Just a heads up that Tesla have changed the security of their PowerWall API .

A fix is here - Powerwall State of Charge Interfacer stopped working - Tesla updated their software - #2 by johnbanks


I’m not see this after updating the EmonPi. Am I missing something on how to update the App?

The code hasn’t been merged by @TrystanLea yet Max. If you don’t want to wait you can apply the changes directly by opening a ssh session onto your EmonPi and applying the updated file.

1 Like

I’ve done it, thank you!

Thank you for the amazing work that you’ve put through! I a am a newbie here and impressed by your contributions. You’ve discussed about the software but what about the hardware?
If I understood things, a simple EmonPi with 3 CT would do (PV production, Battery charge, grid feed)? What about the state of charge?

Welcome to the community. Personally I use the DIYBMS, so derive the state of charge from the sum of the cell voltages supplied via the MQTT feed. Ideally using a shunt based solution would be better, but this more than meets my needs.

I then process the voltage inputs and create the total voltage and state of charge feeds below. Note I have a battery pack slightly over 10kWh and cycle it between 30-80% SOC, so my displayed 0-100% is within this range hence the -51.7 x18.868 at the end.

Is that working properly? If i disable the feed for SOC when setting up the app, I get the following error:

EmonCMS Error

Message: TypeError: undefined is not an object (evaluating ‘feeds[].value’)
Route: app/view?name=My+Solar+Battery2
Line: 722
Column: 71

Hi Neil,

I’m able to reproduce the issue by disabling the SOC feed too. The issue seems to be due to
if (
still evaluating to true when it has been disabled. For me this then disabled access to the settings view due to the javascript object error.

I raised a ticket on github for you and managed to get access back to the settings view by modifying line 381 in mysolarpvbattery.php to set the optional property to false instead of true.
“battery_soc”:{“optional”:false, “type”:“feed”, “autoname”:“battery_soc”, “engine”:“5”, “description”:“Battery state of charge %”},

I hope this helps.


Thanks Keith - i’m really not familiar with Pi or Linux - how do i go about editing that php?

Hi Trystan - how could this be promoted to the iOS EmonCMS app? Currently the only apps available on there are MyElectric, MySolar, MySolarDivert.

Also, I have the API details (attached) for Alpha ESS to retrieve the SOC. Is the something you could help with? It’s all foreign to me.

AlphaESS Web API V2.120210512004203.pdf (353.4 KB)

Hello @neiloakley adding an app to the iOS app requires essentially writing it from scratch on the iOS platform I believe, so a fair bit of work. @mattjgalloway is the developer of the iOS app (and has kindly contributed it all voluntarily).

It might be worth asking if the battery supplier has any python scripts or other code examples for pulling data in from their API that we could work with as a starting point.

As the time remaining has been added to emoncms, would it be possible for it to be extended to charging too?

Eg time until fully charged?

Hi Graeme - Having been responsible for adding the discharge logic my concern with calculating time until fully charged, is that charging from 90% to 100% is not linear and can vary a lot from one system to another depending on how charge controllers / rectifiers are set up. I’m happy to look at it, but what rules do you think we should have ? Displaying time until charged to 90% is an option?

Im all for keeping it simple, Its an estimate after all.
Maybe at a start just use the same rules as discharge. Then if its not too much hassle an option to 90% can be added?

On the subject of limits, My battery runs from 100-20%. Am I correct in thinking battery time left assumes 0%?
If i set the battery to 8kwh, as its what I actually use would the time calculation be correct, or would the SoC % be confusing it?

I like the feature. At a glance I can see will i make it to the night rate on battery.

I can see this is brilliant but I can’t see a clear statement of how to set up the various inputs, some of which are different to my current ones for Solar only and some of which are new.
Do I have to use the latest postings from this thread or am I just not seeing it in