macxq / foxess-ha

Home Assistant & FoxESS integration. Monitor you photovoltaic installation directly from HA ☀️ ⚡️
114 stars 36 forks source link

[ feature request ] battery storage - charging management #19

Open chrisbooth1957 opened 2 years ago

chrisbooth1957 commented 2 years ago

not sure if this is the right place to put this . i have a system with battery storage and i am able to turn the charging on and off from my mobile phone app and i do that in winter ... i think it would be a great addition to be able to use the forecast for the next day to charge the batteries at night but leave some storage for the next days sun rather than fully charge on economy 7 every night then on a sunny day just feed it into the grid , or even just set a max level of charge setting so for example can only charge to 50% at night leavening some capacity for the sun in winter

macxq commented 2 years ago

@chrisbooth1957 can you share screenshots of with particular foxesscloud battery storage settings you wold like to manipulate - i do not have battery in my system so it will be helpfull for me

williamjeccles commented 2 years ago

@macxq

image

I would like to be able to change the two charge timing windows and both toggles per charge window as well as both SOC boxes at the bottom of the screen.

chrisbooth1957 commented 2 years ago

beat me to it , also just a thought here would it be possible to set a max state of charge level when charging from the mains at night , it can toggle the 2 settings enable force charging and enable charging from the grid and read the SOC , it does not need to be that faste a control system as typically takes 2 hours to fully charge , i know it will overshoot a bit because of delays in the system but i dont think that will be a problem . the reason for wanting this may not be obvious unless you have used batteries on a system so i will explain my thoughts

, unless you have some room in the batteries the solar is exported and the last 10% of charge into a battery takes ages so most goes into the grid not the batteries after 90% soc , , add to that here in the UK the solar can be very unpredictable . my idea was to only charge the batteries to say 50% leaving room for some solar in the day , so in the summer if the batteries are above 50% at night after being charged all day it will suspend the grid charging at night using just solar , but in winter or dull days will use grid power at night to top up the batteries to the 50% level , all this is assuming you have a fair amount of storage or are mostly home in the evenings

On Wed, Jan 12, 2022 at 5:48 PM William Eccles @.***> wrote:

@macxq https://github.com/macxq

[image: image] https://user-images.githubusercontent.com/6324545/149193932-ae7a6386-854e-42f6-bb01-0c58535732ea.png

I would like to be able to change the two charge timing windows and both toggles per charge window as well as both SOC boxes at the bottom of the screen.

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1011300639, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR3BTEFSTORCXKREMNTUVW5FFANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

williamjeccles commented 2 years ago

I don't believe the MAX SOC is accessible to standard users only agents profiles via the api. of course you can set it manually on the inverter.

I'm in the UK also so I use the time window to control how much power I put into the battery. I have two 20.8kWh systems so I know they can charge at 5kWh each so around 3.5hrs from 10% to 100%. On clear blue days, I just reduce the charge window by an hour or so to give the headroom you speak of for solar generation @chrisbooth1957. These LFP batteries need to be fully charged multiple times a week or they and the BMS gets lazy.

williamjeccles commented 2 years ago

image these are the options I can see on my agent profile @chrisbooth1957 which does allow min and max SOC via the portal but my other account is only a standard end-user profile and I can't access these settings.

chrisbooth1957 commented 2 years ago

thank you i will do the same , are you currently having problems with home assistant being unable to connect to foxess since about 11 am today this is what it says in the log file , i have rebooted the system a few times to see if that helped

2022-01-15 17:56:45 ERROR (MainThread) [custom_components.foxess.sensor] Unexpected error fetching FoxESS data: Expecting value: line 1 column 1 (char 0)

2022-01-15 17:56:45 ERROR (MainThread) [custom_components.foxess.sensor] FoxESS Cloud initializaction failed, fix error and restar ha

i have had problems with the foxcloud app over the last few days so they may be doing something to it

On Sat, Jan 15, 2022 at 1:39 PM William Eccles @.***> wrote:

I don't believe the MAX SOC is accessible to standard users only agents profiles via the api. of course you can set it manually on the inverter.

I'm in the UK also so I use the time window to control how much power I put into the battery. I have two 20.8kWh systems so I know they can charge at 5kWh each so around 3.5hrs from 10% to 100%. On clear blue days, I just reduce the charge window by an hour or so to give the headroom you speak of for solar generation @chrisbooth1957 https://github.com/chrisbooth1957. These LFP batteries need to be fully charged multiple times a week or they and the BMS gets lazy.

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1013684098, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR7LQV5RAGRKCGV7O5DUWF2HHANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

chrisbooth1957 commented 2 years ago

re foxess website ,just for your information i noticed there website link from there facebook page is showing a database error as does the teck support link , so pretty sure they are having some it problem , so just need to wait for them to fix it

On Sat, Jan 15, 2022 at 1:39 PM William Eccles @.***> wrote:

I don't believe the MAX SOC is accessible to standard users only agents profiles via the api. of course you can set it manually on the inverter.

I'm in the UK also so I use the time window to control how much power I put into the battery. I have two 20.8kWh systems so I know they can charge at 5kWh each so around 3.5hrs from 10% to 100%. On clear blue days, I just reduce the charge window by an hour or so to give the headroom you speak of for solar generation @chrisbooth1957 https://github.com/chrisbooth1957. These LFP batteries need to be fully charged multiple times a week or they and the BMS gets lazy.

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1013684098, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR7LQV5RAGRKCGV7O5DUWF2HHANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

williamjeccles commented 2 years ago

@macxq do you need anything else to help with your development of these settings being surfaced into HA?

macxq commented 2 years ago

@williamjeccles I would appreciate if you have a formula how to increase number of hours in the day 😅 Speaking seriously - GET and POST request that are sent by the browser while viewing and saving those setting when you do this from agent profile - foxesscloud has really bad fine grained access control so maybe it will work.

And i cannot promise when i will be able to implement is , if anyone would like to do it feel free -I will appreciate it a lot!

chrisbooth1957 commented 2 years ago

hi i just had some very strange data posted on the 26 and 27 jan both at 9 am , this does not show up on the foxess cloud page

On Wed, Jan 26, 2022 at 8:37 PM macxq @.***> wrote:

@williamjeccles https://github.com/williamjeccles I would appreciate if you have a formula how to increase number of hours in the day :P Speaking seriously - GET and POST request that are sent by the browser while viewing and saving those setting when you do this from agent profile - foxesscloud has really bad fine grained access control so maybe it will work.

And i cannot promise when i will be able to implement is , if anyone would like to do it feel free -I will appreciate it a lot!

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1022581400, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGRY3LZ7C2PU2O6CDX5DUYBLPFANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

williamjeccles commented 2 years ago

@macxq

I think it should be implemented for the standard profile end-user, agent access isn't really needed as standard user has access to this via the web gui.

There appear to be two calls, one for timings and one for battery soc settings. Timing appears to be: https://www.foxesscloud.com/c/v0/device/battery/time/get?sn=66BC502T137D054 in my example Battery SOC: https://www.foxesscloud.com/c/v0/device/battery/soc/get?sn=66BC502T137D054 in my example

Configured like this: image image

Payload for timing and soc looks to be just the serial id - image

here is the response for timing {"errno":0,"result":{"sn":"66BC502T137D054","times":[{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":0,"minute":31},"endTime":{"hour":4,"minute":30}},{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":12,"minute":0},"endTime":{"hour":13,"minute":30}}]}}

here is the response for soc {"errno":0,"result":{"minSoc":10,"minSocTip":"","minGridSoc":10,"minGridSocTip":""}} image

Here are the set Posts when I click save next to each of these, Timing: {"sn":"66BC502T137D054","times":[{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":"00","minute":"31"},"endTime":{"hour":"04","minute":"30"}},{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":"12","minute":"00"},"endTime":{"hour":"13","minute":"30"}}]}

SOC: {"minGridSoc":10,"minSoc":10,"sn":"66BC502T137D054"}

chrisbooth1957 commented 2 years ago

hi i just received this strange message from foxess after they blocked my access "Hello Chris,

Sorry for the delay, because you use ‘home assist’ this technology causes your IP to be blocked. The technology connects to our server and tries to download information without permission.

We are installing some further technology to protect our server by the end of this week, which will ensure IP addresses are not blocked.

Please refrain from using home assist with the fox server.

Thank you.

Kind Regards

Craig

Fox-ESS Support

On Mon, Jan 31, 2022 at 2:07 PM William Eccles @.***> wrote:

@macxq https://github.com/macxq

I think it should be implemented for the standard profile end-user, agent access isn't really needed as standard user has access to this via the web gui.

There appear to be two calls, one for timings and one for battery soc settings. Timing appears to be: https://www.foxesscloud.com/c/v0/device/battery/time/get?sn=66BC502T137D054 in my example Battery SOC: https://www.foxesscloud.com/c/v0/device/battery/soc/get?sn=66BC502T137D054 in my example

Configured like this: [image: image] https://user-images.githubusercontent.com/6324545/151806641-c00b2dcd-5f82-46cd-a703-47e57e1a6f56.png [image: image] https://user-images.githubusercontent.com/6324545/151806759-b3a81de4-8aa5-45c4-95b3-6d0d5f26f0db.png

Payload for timing and soc looks to be just the serial id - [image: image] https://user-images.githubusercontent.com/6324545/151807308-68e8097f-ab2c-4858-b8f0-d4b5fc689646.png

here is the response for timing

{"errno":0,"result":{"sn":"66BC502T137D054","times":[{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":0,"minute":31},"endTime":{"hour":4,"minute":30}},{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":12,"minute":0},"endTime":{"hour":13,"minute":30}}]}}

here is the response for soc

{"errno":0,"result":{"minSoc":10,"minSocTip":"","minGridSoc":10,"minGridSocTip":""}} [image: image] https://user-images.githubusercontent.com/6324545/151807471-48e6d2b3-d411-4f15-8db2-07b23c3cc0eb.png

Here are the set Posts when I click save next to each of these, Timing:

{"sn":"66BC502T137D054","times":[{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":"00","minute":"31"},"endTime":{"hour":"04","minute":"30"}},{"tip":"","enableCharge":true,"enableGrid":true,"startTime":{"hour":"12","minute":"00"},"endTime":{"hour":"13","minute":"30"}}]}

SOC: {"minGridSoc":10,"minSoc":10,"sn":"66BC502T137D054"}

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1025773616, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR3F42O6ANJ4LMKMRA3UY2JQTANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

macxq commented 2 years ago

We are installing some further technology to protect our server by the end of this week, which will ensure IP addresses are not blocked.

Please refrain from using home assist with the fox server.

I find these two sentences contradictory for me 🤷‍♂️

btw. for such discussions please use this thread https://github.com/macxq/foxess-ha/issues/28

williamjeccles commented 2 years ago

@macxq sounds like they might be scaling their platform to support our data integration or implementing another pointless block. I hope they provide solutions not roadblocks. fingers crossed.

BigManDave commented 2 years ago

Am I the only one who the statement "tries to download information from our server without permission" really grates on? lol Doesn't sound to me like they're scaling up. Sounds more like they're going to change how the site works so our endpoints are no longer valid, or maybe some rate-limiting at the very least :(

bsg-marvin commented 2 years ago

hi i just received this strange message from foxess after they blocked my access "Hello Chris, Sorry for the delay, because you use ‘home assist’ this technology causes your IP to be blocked. The technology connects to our server and tries to download information without permission. We are installing some further technology to protect our server by the end of this week, which will ensure IP addresses are not blocked. Please refrain from using home assist with the fox server. Thank you. Kind Regards Craig Fox-ESS Support

Hi, have you managed to get your IP unblocked? Mine is blocked from today too. :)

chrisbooth1957 commented 2 years ago

hi, yes i did by switching my router off for 20 mins so i got a new IP address but the current issue is not that simple if you manage to connect using the web interface ( https://www.foxesscloud.com/) there is a warning they are doing work on the site and you may have random connection issues until some date in march ,i can't connect as i write this email using chrome on my pc but can on my mobile using wifi so my IP cant be blocked so can't give you the date ) , but it appears home assistant it totally blocked , all we can do is wait until march but i fear they intend to block home assistant rather than the IP , does the app work on your mobile ?

chris

On Tue, Feb 15, 2022 at 10:49 PM Filip Jurik @.***> wrote:

hi i just received this strange message from foxess after they blocked my access "Hello Chris, Sorry for the delay, because you use ‘home assist’ this technology causes your IP to be blocked. The technology connects to our server and tries to download information without permission. We are installing some further technology to protect our server by the end of this week, which will ensure IP addresses are not blocked. Please refrain from using home assist with the fox server. Thank you. Kind Regards Craig Fox-ESS Support … <#m7325278193722124069>

Hi, have you managed to get your IP unblocked? Mine is blocked from today too. :)

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1040875177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR7A7GUAFMSINTWG3V3U3LJ6HANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

chrisbooth1957 commented 2 years ago

this is a screenshot taken at 3 am 16/2/22 read the red at the top [image: Ashampoo_Snap_16 February 2022_03h07m37s002.png]

On Tue, Feb 15, 2022 at 10:49 PM Filip Jurik @.***> wrote:

hi i just received this strange message from foxess after they blocked my access "Hello Chris, Sorry for the delay, because you use ‘home assist’ this technology causes your IP to be blocked. The technology connects to our server and tries to download information without permission. We are installing some further technology to protect our server by the end of this week, which will ensure IP addresses are not blocked. Please refrain from using home assist with the fox server. Thank you. Kind Regards Craig Fox-ESS Support … <#m630578937345018457>

Hi, have you managed to get your IP unblocked? Mine is blocked from today too. :)

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1040875177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR7A7GUAFMSINTWG3V3U3LJ6HANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

bsg-marvin commented 2 years ago

My app doesn’t work unless on 5G or different wi-fi. [Image.jpeg] [Image.jpeg]


From: chrisbooth1957 @.> Sent: Wednesday, February 16, 2022 3:15:23 AM To: macxq/foxess-ha @.> Cc: Filip Jurik @.>; Comment @.> Subject: Re: [macxq/foxess-ha] [ feature request ] battery storage - charging management (Issue #19)

this is a screenshot taken at 3 am 16/2/22 read the red at the top [image: Ashampoo_Snap_16 February 2022_03h07m37s002.png]

On Tue, Feb 15, 2022 at 10:49 PM Filip Jurik @.***> wrote:

hi i just received this strange message from foxess after they blocked my access "Hello Chris, Sorry for the delay, because you use ‘home assist’ this technology causes your IP to be blocked. The technology connects to our server and tries to download information without permission. We are installing some further technology to protect our server by the end of this week, which will ensure IP addresses are not blocked. Please refrain from using home assist with the fox server. Thank you. Kind Regards Craig Fox-ESS Support … <#m630578937345018457>

Hi, have you managed to get your IP unblocked? Mine is blocked from today too. :)

— Reply to this email directly, view it on GitHub https://github.com/macxq/foxess-ha/issues/19#issuecomment-1040875177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIWGR7A7GUAFMSINTWG3V3U3LJ6HANCNFSM5LEIVJOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/macxq/foxess-ha/issues/19#issuecomment-1041052552, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGGF375MOINWESTHJECOIV3U3MJEXANCNFSM5LEIVJOA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>

BigManDave commented 2 years ago

@macxq Just seen that someone might have achieved this functionality. Could be easy to copy? https://github.com/dmarjoram/Roses.SolarAPI

macxq commented 2 years ago

@BigManDave thx ;) I'm actually struggling with internal HA configuration so maybe in futer this will be use-full 🙇‍♂️

NeilRickards commented 1 year ago

Inspired by the Roses.SolarAPI code, I was able to set my battery with a pair of curl commands:

HASH=$(md5 -qs $PASSWORD)
TOKEN=$(curl -H "Content-Type: application/json" -d "{\"user\":\"$USER\",\"password\":\"$HASH\"}" https://www.foxesscloud.com/c/v0/user/login | jq -r .result.token)
curl -H "Content-Type: application/json" -H "Token: $TOKEN" -d "{\"sn\":\"$SERIAL\",\"minGridSoc\":\"80\",\"minSoc\":\"80\"}" https://www.foxesscloud.com/c/v0/device/battery/soc/set