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.
I will try and see if I can get it to work, with the first steps opened by your approach…
I have helpers anyway for the NodeRed version linked in on of my earlier posts, but I would prefer doing it the direct way (never became a friend with NodeRed).
I found out that it is possible to change values using the rest_command integration.
First of all you can read several parameters with the following example (charging mode in this case). Note that you need to also setup the token sensor from my previous example.
Setting a parameter can be done with the rest_command integration. This is an example also for the charging mode. The value is set as a parameter which can be later used in a template, script or automation.
Basically it is possible to set up helpers, automations, template entities, etc., now. But this will be a lot of yaml-code.
We definetely need a dedicated integration.
Thank you so much!
It took a while, but now I added what you shared and it seems to work quite fine!
What I was wondering though, and I could not find an answer to that (sorry, I am really unexperienced with rest, curl and all that stuff): Is it possible to get all json-output into one sensor, so I can see what format the results from the API have and specifically select all the values I need?
I tried it with following code, but that sensor always is “unknown” instead of returning all values:
At least changing values should be easier, since the technical names are listed in the web-GUI of the EV Charger.
But also for that, these numeric values - like the charge mode - show up nowhere except in the API output. Plus, for setting the EV Charger to a charging target, the end time is required, which seems to be stated in seconds. Might have a hard time converting a datetime value into that number. There still are many obstacles to overcome…
I totally agree with you, having an integration or at least modbus support as promised by SMA for years would be so much easier!
Thank you very much @alengwengus, this integration works well.
SMA EV-Charger:
I have made a small change: Power limitation was not working, so I switched from “Wmax” to “WmaxIn” in your number.py. Now it is working.
LedaTronic Integration:
is working now, too. Some CANBus-bytes were mixed in my setup, so I re-engineered them by polling all bytes.
now I only face some HASS-specific problems and I am working on visualisation now
I am struggling with units:
As you can see, power values are not the same: some are kW, some are W. I would also like to show only one digit after “.”…
I still have some problems:
utility-meters:
creation in “helper”-section cannot be edited:
after creation: If you want do delete unit-frefix, you only can change this by editing /homeassistant/-storage/core.config_entries
utility-meters:
is there a “best-practice” to create utility-meters for “Energy”-dashboard?
Aquara ZigBee:
after re-connecting some sensor get lost and have to be re-synced manually. That is really annoying. I will try another ZigBee-stick (at the moment: Sonoff stick)
So, I thought deleting and re-configuring of the helper would be the solution, but some data is stored in background and all helpers come back with same unit and historical data: