Couldn't find any drivers for the Sonnen Core battery, so I built one. Pretty basic, just retrieves the status from a locally connected battery. It will likely work with other Sonnen battery models, since I used the Eco API docs as a reference to build this driver.
GitHub - ke7lvb/sonnen_battery: Hubitat Driver for Sonnen Battery
Turns out the API docs are stored locally on the battery:
This works well with the Eco series as well.
thanks, I find the Sonnen software cumbersome at best!
I've got two Questions.
I'l like to swap the sign (+/-) of charge/discharge... to me negative is draining the battery, and the flow tile shows it negative when the battery is charging....
Can you suggest the right place to reverse that? i.e. the polling part of the code, or the flow tile?... I'm not a programmer, but seems like a fairly straight forward adjustment....
I have a bunch of automations to run when we hit backup power mode... but haven't figured out how to have the battery tell Hubitat that's whats happened... Hubitat will turn off a bunch of non-essentials, but only when I tell it. Since testing is a pain given the live nature of it, what's the best polling attribute to trigger rules, I'd imagine it's "powerSource" but I don't know if that's a real world event or.... Sonnen has a habit of telling the 'user interface' BS. Do you have any experience with kicking off some events when battery mode engages?
The battery Charge/discharge rate is Pac_total_W. I've just been grabbing the raw number from the JSON, but you can invert the sign by multiplying by -1 on line 156.
state.Pac_total_W = respData.Pac_total_W*-1
I have been leveraging SystemStatus != OnGrid to trigger automations. I have noticed that it will also trigger when the battery goes into maintenance mode, but it works better than powerSource. Maybe a combination of SystemStatus and powerSource would work.
Cheers. And thanks for sharing your nice code. Your tile is nice, improves the graphics of what Sonnen provides in their own software. Was just about to tackle this project when I thought I'd check again to see if anyone else has done it... procrastination wins again!
So I've made a couple changes to your code so I can see what I'm interested in one modified "large" tile, I call it a 'sausage tile' because I stuff in as much as I can... see below.
Question, Operating Mode is reported as a number... per the api, but "10" doesn't mean much to mere humans, so wonder if you could help me 'convert the operating mode # to "TOU", "Back-up", or "Self-Consumption"? ... I'm not a programmer as mentioned before, but I'm willing...
Seems reasonable. Unfortunately I have not seen a list of what each number means, but these are the ones I could find by trial and error on my own battery. You can add this inside of
operating_mode = [
7: "Backup Power - US",
om = state.OperatingMode.toInteger()
//write the mode as text using operating_mode[om]
if(logEnable) log.info operating_mode[om]
It's Soo obvious when someone else does it for me! Dumb monkey appreciates the help mucho grande.