This seems to be the right direction, but i have to admit to be lost how to implement it in HA (as there are scripts with curl (which i dont know) and Homematic).
Are there any specific instructions/help for HA? Would you mind to share some of your knowledge?
Thanks a lot!
As some others posted before - I just wanted to add I tried implementing this in Home Assistant as well - but failed. I was able to query the information on the command line, but automating this in Home Assistant was a real nightmare.
@tmeringer: if you could post the configuration you used for the EV charger and maybe a few sentences with a short explanation maybe this should be enough to help all of us
Sure, but keep in mind that I am no php expert at all, so the script provided might not be the best in the universe, plus I am only reading data from the SMA EV Charger (for now) using an Apache webserver that is running on my Home Assistant server, so YMMV.
IOW: my Apache webserver is returning a JSON string that can be consumed by Home Assistant then.
This gave me a working setup, so I could save your script in /var/www/html and open it in a browser. By the way, since the debugging gave me a warning: I changed the line
Sorry, it took a while.
I decided to go for a Home Assistant only route so that there is no need for an external dependency (using Apache).That caused my some headache, but I finally came up with a solution.
Thanks a lot! That worked for me, too!
It might also be possible to change values with this method, extending the script a bit - but this version is a beginning and should be enough for what I want to do at the moment.
And even though they announced it quite a while ago and nothing happened until now, maybe SMA will update the wallbox to support modbus in the near future so all will be easier…
The only thing i am missing is the “Car connected to Wallbox”.
But if i am reading this right, the api only returns the data that is presented via the "webui/monitoring/live view (“Momentanwerte” ), right?
Maybe we find a way for the “connected” status sometime.
I found something here in post #19 - it’s in German, but since SMA does not seem to have huge market shares outside Germany I guess you might understand it
According to the comments in this script, the connection state is represented by this value:
… where
200111 = not connected
200112 = connected
200113 = charging
And by the way, in this thread mentioned above there is a link to another forum (also in German) that contains information about how to read and change settings - obviously with the same method, but the URL
I did find this channel exposed via the api (just missed it due to “200111” and not being something readable ;-).
I can now read out the numeric state and convert it to text with a template:
PS: i wonder if one could put these two sensors into one. I like to keep the sensor count as low as possible…
For the ability to change settings: for me the actual readout of
connection status (nothing connected, car connected, charging)
charging power in kW
total value of charged kWh
is enough, as i always (at least at the moment) use spare solar power to charge the battery.
if i have to go “full throttle” on charging i do have to walk to the wallbox and physically flip the switch anyway.
As my scripting abilities tend to be mostly zero, i sadly cannot make much out of the project you pointed out.
A bit off topic, but still my 2 cents: you can also do this by setting a charge limit in the smartphone app, e.g. 40 kWh to be charged in 2 hours. Then it will start charging at full speed. Big advantage of this approach: after the set time limit it will automatically revert to charging with spare solar power. This might be possible using Home Assistant as well, but since my setup seems to be very similar to yours (charging almost exclusively with solar power) that is no big deal.
You’re absolutely right.
I just tried that a few days ago and it seems to work as expected. (although it seems to drop the charging every now and then for no obvious reason - this don’t happen if i physically flip the switch).
Hi,
I found another solution for the SMA EV Charger just by using the RESTful integration. The idea is to define a sensor to obtain the token in specified intervals.
The other sensors provide the corresponding values. This works better for me as I have full control over each sensor (like the unit of measurement) without the need of any template sensors.
Additional sensors can be added as usual.
Thank you very much for sharing. That’s easier and more flexible than using the script provided earlier.
I have to test it on the weekend with my charger, but do I understand correctly that you only read values with this method? It would be especially interesting to also set values, thus being able to program smart charging for dynamic power prices and things like that.
Up to now it’s only for reading values. There are also RESTful Switch and a RESTful Command integrations which should work similar as the sensor but of course with different endpoints. I haven’t tried it yet.
But I guess it will be a little bit more messy in your configuration as you will need to use helpers and templates to achieve a nice user experience.