Giter Site home page Giter Site logo

Comments (7)

RustyDust avatar RustyDust commented on July 24, 2024 4

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.

from ha_sonnenbatterie.

doncuco avatar doncuco commented on July 24, 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.

from ha_sonnenbatterie.

rcruikshank avatar rcruikshank commented on July 24, 2024

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"]]}]

from ha_sonnenbatterie.

doncuco avatar doncuco commented on July 24, 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.

from ha_sonnenbatterie.

alsFC avatar alsFC commented on July 24, 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.

from ha_sonnenbatterie.

rcruikshank avatar rcruikshank commented on July 24, 2024

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

from ha_sonnenbatterie.

rcruikshank avatar rcruikshank commented on July 24, 2024

BTW Home Assistant community discussions on EMHASS are here and here

from ha_sonnenbatterie.

Related Issues (20)

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.