Giter VIP home page Giter VIP logo

energystats-android's Introduction

This project is not endorsed by, directly affiliated with, maintained, authorized, or sponsored by FoxESS

EnergyStats

BuyMeCoffee License

Introduction

Android App for monitoring a simple FoxESS Cloud installation. Written in Kotlin and Jetpack Compose this app is provided for free and is available for download on the Play Store.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

energystats-android's People

Contributors

alpriest avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

energystats-android's Issues

Wording of "battery freeze" charge schedule message

When setting the battery charge schedule to a non-zero time period, but with the "enable charge from grid" toggle disabled, the following message displays:

"Your batteries will not charge or discharge between 12:00 and 16:00. Any house load will come from the grid between these times. Reset the time period to disable this."

In my experience, this wording is incorrect, because the batteries will charge from the solar panels, but not from the grid. Essentially, this setting diverts all the solar power to charging the battery, rather than the house. I'd welcome any independent confirmation of this, in case it's dependent on another setting my system has.

This is a screenshot with it enabled:
Screenshot_2023-11-21-11-09-46-95_4bfa71e7083cdea1ef7828997a9b5f8f

I'd suggest:
"Your batteries will not discharge between 12:00 and 16:00. Any house load will come from the grid between these times. Reset the time period to disable this."
or perhaps something like:
"Your batteries will not discharge between 12:00 and 16:00. Solar power will be diverted to charging the battery. Any house load will come from the grid between these times. Reset the time period to disable this."

The affected strings (in English) are

<string name="both_battery_freeze_periods">Your batteries will not charge or discharge between %1s and %2s. Any house load will come from the grid between these times. Reset time periods to disable this.</string>
<string name="one_battery_freeze_period">Your batteries will not charge or discharge between %1s. Any house load will come from the grid between these times. Reset the time period to disable this.</string>

TIA!

Battery Charge Schedule Messages

If both time periods are used and are not the same type (ie both force charge or both disable discharge/charge), only 1 of the descriptions is shown e.g.

"Your battery will be force charged from the grid between 03:00 to 04:45"

instead of

"Your battery will be force charged from the grid between 03:00 to 04:45 and will not charge or discharge between 04:45 to 05:00"

Report Reisdual on Power Flow?

I tell a few people to dig through the menus into the debug info to check the Residual value of the battery.

I've been tracking this for a few weeks and it always agrees with the BMS kWh Remaining obtained over RS485 in Home Assistant. Personally, I use this more than SoC to track what's in the battery and also to check the battery capacity.

Would it be useful to have a switch in the settings to display Residual on the Power Flow screen in addition to SoC?
Maybe something like 100% (13.82kWh)?

Load power with second inverter

When an other solar inverter is connected to CT2, the load power sent by the inverter, detected by CT1 is incorrect as the second inverter is adding power into the load / grid.

To correct this, you need to add the power reported by CT2 to the load power reported by the inverter to give the correct load power.

You may also want to add the power from CT2 as another solar source and possibly integrate and add this into the total yield to get the overall yield from both inverters.

Power versus Energy and Units for Parameters tab

Sorry if this appears to be pedantic, but probably important to get right?

Power and Energy are different things. Power is the rate of transfer of energy and is measured in watts or kilowatts. Energy is the work or potential work done and is measured in watt-hours or kilowatt-hours. The Stats page in EnergyStats provides a break down of the energy used or stored in a battery and the units are kWh. These are the results of the report queries against the Fox cloud.

The Parameters page in EnergStats provides information about the power available at a specific time and the values and units are obtained from the raw data query of the Fox cloud. This means it is wrong to label a parameter Output Energy in kWh, when the value being presented is the Output Power and is in kW. The same applies to Feed-in, Grid Consumoption, Charge, Discharge and Load - these are all Power values, not Energy values.

The labels and units are correct when viewed in the selection list, these just need to be carried across when the parameter values are being displayed for a specific time selection. So, temperatures should be oC (not kwh). PV1 power should be kW (not kWh), Battery Current should be A, SoC should % etc.

Home usage has incorrect value

Screenshot_20230714-171531_Home Assistant Screenshot_20230714-171604_Energy Stats

Screen shots from HA and Energy Stats have significantly different values for Home Usage.

The difference is because Home Usage is calculated from Output Energy but this includes energy from force charging that is also counted in Grid Consumption Energy. The inverter has Input Energy to keep track of this so it can be subtracted from Output Energy.

The difference is clear when you compare Loads Energy with Home Usage.

As its summer and people are not force charging and mostly looking at monthly data, I don't think many will have noticed yet but I expect more will pick up on this as the days shorten.

Out of range solar generated data

Just a note really, from some data we found calculating the solar generated for PV Output.

It appears there is some rogue data in the Fox Cloud, for example, we got a value for pvPower of 530kW at 06:40 in one person's data.

It's obviously wrong - it's possible at one point, Fox did not recognise signed PV power correctly and entered silly values for -ve values.

So, to stop this, I ignore and kW value I get from the Fox cloud that is greater than 50kW. I also ignore -ve power values as these have no meaning, with one exception. When looking at RPower, I sum +ve and -ve values separately.

The +ve values are Output Energy as you might expect and should add up to Output Energy reported.

The -ve values are Input Energy from when the battery is charging from grid. So, I sum the nergative values separately, take the abs value and store this as Input Energy - this is another approximation you might want to add.

Make sense?

Self-sufficiency estimates descriptions are incorrect

Hi @alpriest - thanks for this app, it's brilliant in so many ways and your work is really appreciated.

On v1.54, the selection of Net and Absolute Self-sufficiency estimates seems to be incorrectly labelled or described - I think they need swapping over.

When I select "Net", the description is (export - import + batCharge - batDischarge)/ houseUsage. However, the estimates shown are being calculated as 1-(grid / houseUsage).

Based on the contents of

class NetSelfSufficiencyCalculator {
fun calculate(loads: Double, grid: Double): Double {
if (loads <= 0) {
return 0.0
}
val result = 1 - (minOf(loads, maxOf(grid, 0.0)) / loads)
return (result * 100.0).roundTo(1)
}
}
I think it is just the descriptions that are incorrect and need swapping.

Perhaps it's just the descriptions need swapping in

<string name="net_self_sufficiency">Assumes if your net consumption is positive then you are self-sufficient.\n\nSufficiency = (export - import + batCharge - batDischarge) / houseUsage</string>
<string name="absolute_self_sufficiency">Assumes any amount taken from the grid reduces your self-sufficiency.\n\nSufficiency = grid / houseUsage</string>
, or perhaps it's the naming of the variables themselves - I haven't been able to quite trace it all through, otherwise I'd open a PR ๐Ÿ˜„

Solar Stats - have a look here?

Hi Al,

Not an issue, but a convenient ways of messaging you... seeing Solar Stats on FB - possibly worth you having a look at https://github.com/TonyM1958/FoxESS-Cloud#charge-needed

You can run this in Colab or any Jupyter Notebook if you want to see what it does with your inverter and battery: https://github.com/TonyM1958/FoxESS-Cloud/wiki/Using-Jupyter-Notebook

This uses the Solcast forecast and battery stats to produce a forecast and then sets the battery charging schedule like this:

image

I run it as a scheduled job in Saturn Cloud every night - but you could do the same thing in your app. Here are some example of the predicted versus actual:

image

image

The code is a bit intense to work all this out but I'm sure you will follow it...

BTW - it appears Solcast may produce forecasts using GMT so I find I need to adjust for BST. Don't know what you will get if you are in Germany, for example. You might think, given the location data that Solcast has, it could do a better job of producing a forecast using local time but I'm not sure that is the case, so something to check out for your app?

Out of range loads data values

Looking at out of range 'loads' values, here's what I'm currently doing to my data in HA. Top is fixed value, bottom is raw value from the inverter:

image

The out of range value appears to affect the top 3 hex digits of the 32-bit value (in my case at least). Here's a code snippet that shows the problem and possibly how you might fix it:

image

Basically - work out if the value has 0 in the top 3 hex digits, mask these off and subtract the result from the out of range number to leave the lower 5 hex digits and divide by 10 to restore the scale. The code goes around the houses to do this so you can see the intermediate results - but I'm sure you get the picture? You could just invert the mask and apply this to the 32-bit value after x 10 and then /10 again...

Min Soc (on grid)

Great app. For most people, the effective min soc is on grid. Is it possible to display / use this instead of min soc, either directly or via a settings switch?

Residual does not display correctly on Power Flow screen

Not sure what changed in the last update re: Residual kWh display on the power flow page.

The % and kWh used to match what I was seeing in Home Assistant. Now, the SoC % matches but the Residual does not with Android app version 1.27:

  • Current display in HA is 96% and 13.36kWh
  • Debug data in EnergyStats says SOC 96 and Residual 13360.0, so matches HA
  • Power flow screen says 96% and 13.17kWh.

Shouldn't it also say 13.36kWh on the power flow screen?

Scheduled operations in Fox cloud

I've done a first pass of adding the API calls to configure scheduled changes of work mode, min soc and force charging into my API library today.

The basics are there and working to get_schedule() and set_schedule() - but the calls depend on the inverter firmware - there are flags for whether schedules are supported / enabled. By the look of it, you can add as many schedule periods as you want, in the form of a list of settings. Note that Content-Type in the header is required or set_schedule() will fail with a server exception.

Work modes include SelfUse, Feedin, Backup and ForceCharge.

You might want to check for schedules in EnergyStats as the ability to change min soc, change work modes and set charge times are locked out when schedules are enabled and calls to change settings return errno 44096.

https://github.com/TonyM1958/FoxESS-Cloud

month selection in stats

Minor issue with v1.46

If you select Month in Stats and then select a month e.g. June, the data for June is returned.
When you press the month again, instead of June, May is ticked in the list picker.
June is displayed on the button and data for June is being shown.

PV Power Now

Hi Al,

Noticed a post on the group where you said current PV Power was not available for the power flow?

There is a variable pvPower that you use to get raw data and this returns the current PV Power being generated. Here's an example of the response:

image

Is this what you need to match the Fox app?

Rate limiting for Fox ESS Cloud

Don't know if this is new, but I've started to get errno 41809 when accessing the Fox cloud.

It looks like they may have implemented rate limiting - not sure if this is related to logins or calls.

Just something to watch out for in case you also start seeing this?

Raw data from 04/11/2023

Just a quick heads up - with the cloud outage last night, some of the raw data samples are AWOL today.

For example, some of the samples are 10 minutes apart instead of 5 minutes.

Depending how you generate your X co-ord for plotting, this may throw out some of the data - in case any notices or queries this?

Stats month does not display correctly

Select Stats and Month. Browse months, the order is January, March, March, May, May. February and April sometimes appear in the drop down but are not displayed when selected.

This is February:

Screenshot_20230531-073733_Energy Stats

Screenshot_20230531-073742_Energy Stats

This is April:

Screenshot_20230531-073755_Energy Stats

Screenshot_20230531-073724_Energy Stats

Screenshot_20230531-073708_Energy Stats

Screenshot_20230531-074748_Energy Stats

Change settings for battery / work mode

Hi Al,

Don't know if this is of interest, but I'll put it here anyway...

I've updated my python sample code with a set of calls that allow you to set the charge times, min soc and work modes if required using the Fox cloud API: https://github.com/TonyM1958/FoxESS-Cloud

Not going to claim any prizes - my coding is pretty basic synchronus REST API calls but the URLs, parameters and data structures are all there embedded in the code and tested via some examples of use in Jupyter Lab.

This might be something you already looked at and discounted for Energy Stats?

Load Energy Report

Hi,

Is there a reason for not fetching the report variable 'loads'?

I think this should provide the house load in addition to the feedin, generation, gridConsumption, chargeEnergyToTal and dischargeEnergyToTal that you are displaying in the Parameters tab.

Group charts in Parameters by units

I think you said it was early days for Parameters, so you may already be working on things... just let me know if you have enough ideas and suggestions already! None of these are urgent.

When you select a variety of parameters, the vertical axis of the chart currently mixes values. Suggestions:

  1. add the units to the selection list to make it a bit obvious which items work together
  2. group the parameters selected by units and display on different charts with the unit displayed on the axis

So, if you select PV1/PV2 Voltage, PV1/PV2 Current (for example), each parameter is displayed with an appropriately scaled vertical axis. Or, if you select a range of power values and temperatures, the temps appear on a separate chart with C. The horizontal axis of the charts are synchronised, of course.

Off the top of my head, I think there are 5 potential charts based on %, voltage, current, power and temperature?

Also when selecting 'Compare Strings' include PV Power as well as PV1, PV2, PV3 and PV4 power so you get the total power as well as the individual contributions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.