Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button to start Manual Loading Process #49

Open
doncuco opened this issue Mar 5, 2024 · 7 comments
Open

Button to start Manual Loading Process #49

doncuco opened this issue Mar 5, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@doncuco
Copy link

doncuco commented Mar 5, 2024

Hey,
would it be possible to integrate a Radio Button to start a manual loading process? With maximum power.
And when disabling going back to self consumption?
That would be really great!

@RustyDust
Copy link
Collaborator

I think a better approach would be to just add functionality to call the charge and discharge API endpoints with arbitrary values (and make sure the value passed doesn't exceed the limit of the inverter). This would allow the user to build their own buttons with adjustable values.

That said, currently there is no exposed function for doing either the max charging or an adjustable charge. The implementation is not really straight forward but if time permits I may have a look at it over the next weeks or so.

@RustyDust RustyDust added the enhancement New feature or request label Mar 5, 2024
@doncuco
Copy link
Author

doncuco commented Mar 18, 2024

That would be awesome!
Basically I am looking for two functions.

  1. Send battery to charge from grid
  2. Toggle the operation state

I am using this nodeRed script to load the battery from grid.
But it has some issues. Solar energy is not detected and added to the price calculation.
And not available variables set the battery to manual mode, which basically blocks the battery from working.

@rcruikshank
Copy link

If you want to charge or discharge a sonnen battery using node red you can use an http request node.

Something like this to discharge:
[{"id":"05d69d4319a0f5d6","type":"http request","z":"65840aa926d9c567","name":"POST","method":"POST","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[],"x":1250,"y":400,"wires":[["0e4ea3476743d2c3","7e7a97b8e68d3389"]]},{"id":"6151ac699f7381c1","type":"function","z":"65840aa926d9c567","name":"Discharge Setup","func":"var pospayload = 0.0\npospayload = Math.abs(msg.payload)\nmsg.headers = {}\nmsg.headers['Auth-Token'] = 'YOUR-BATTERY-AUTH-TOKEN'\nmsg.headers [\"Content-Type\"] = \"application/x-www-form-urlencoded\"\nmsg.url = \"http://YOUR-BATTERY-IP-ADDRESS:80/api/v2/setpoint/discharge/\" + pospayload.toString()\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1090,"y":400,"wires":[["05d69d4319a0f5d6"]]}]

Or this to switch to automatic self consumption mode:
[{"id":"b66c43b2d71ebcfc","type":"http request","z":"65840aa926d9c567","name":"PUT","method":"PUT","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[],"x":1250,"y":220,"wires":[["1736681453a9e3de","81532e458a6da3d1"]]},{"id":"49c07dcad21bb88c","type":"function","z":"65840aa926d9c567","name":"Automatic Mode","func":"msg.payload = \"EM_OperatingMode=2\"\nmsg.headers = {}\nmsg.headers['Auth-Token'] = 'YOUR-BATTERY-AUTH-TOKEN'\nmsg.headers [\"Content-Type\"] = \"application/x-www-form-urlencoded\"\nmsg.url = \"http://YOUR-BATTERY-IP-ADDRESS:80/api/v2/configurations\" \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":220,"wires":[["b66c43b2d71ebcfc"]]}]

Or this to switch to manual mode:
[{"id":"402679171d35e0d2","type":"http request","z":"65840aa926d9c567","name":"PUT","method":"PUT","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[],"x":1250,"y":280,"wires":[["5bd08bcd972153bc","81532e458a6da3d1"]]},{"id":"9efde64dbc00c864","type":"function","z":"65840aa926d9c567","name":"Manual Mode","func":"msg.payload = \"EM_OperatingMode=1\"\nmsg.headers = {}\nmsg.headers['Auth-Token'] = 'YOUR-BATTERY-AUTH-TOKEN'\nmsg.headers [\"Content-Type\"] = \"application/x-www-form-urlencoded\"\nmsg.url = \"http://YOUR-BATTERY-IP-ADDRESS:80/api/v2/configurations\" \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":280,"wires":[["402679171d35e0d2"]]}]

@doncuco
Copy link
Author

doncuco commented Mar 18, 2024

Thanks for your help.
And how can I do that in Home Assistant? NodeRed is working fine and I don't need a button there.

@alsFC
Copy link

alsFC commented Mar 18, 2024

Thanks for your help. And how can I do that in Home Assistant? NodeRed is working fine and I don't need a button there.

Have a look here
You'll find all information on how to configure rest commands in HA for controlling your Sonnenbatterie.

@rcruikshank
Copy link

Yes, you can do the same thing in Home Assistant using RESTful Command or you can simply use the node red home assistant contrib nodes to pass values from HA into node red. This config is native if node red is implemented as a HA add-on as would be the case if you have implemented home assistant using HAOS or supervised (install methods).

I use EMHASS to calculate an energy plan every 60 second and apply the forecast battery SoC to my sonnen battery. I've documented my set up here. You'll find my full node red configuration there in JSON format.

I use a wholesale market energy supplier so my supply tariff and feed-in tariff change constantly inline with the national energy market in Australia and I also manage deferrable loads in the house like pool pump and EV charging using the same system.

Typical daily forecast:
image

@rcruikshank
Copy link

rcruikshank commented Mar 18, 2024

BTW Home Assistant community discussions on EMHASS are here and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants