solis-sensor
solis-sensor copied to clipboard
Battery power value positive for both charge and discharge
I can't see any value in the available sensors for my Solis inverter on the Solis Cloud that indicates the rate at which the battery is charging or discharging.
I can see the inverter_battery_power value, which does show the rate of charge/discharge, but the value is always positive.
I suspect you would have to combine it with “Battery Status” that indicates Charge / Discharge
From: corvus2606 @.> Sent: 16 September 2022 12:10 To: hultenvp/solis-sensor @.> Cc: Subscribed @.***> Subject: [hultenvp/solis-sensor] Battery power value positive for both charge and discharge (Issue #158)
I can't see any value in the available sensors for my Solis inverter on the Solis Cloud that indicates the rate at which the battery is charging or discharging.
I can see the inverter_battery_power value, which does show the rate of charge/discharge, but the value is always positive.
— Reply to this email directly, view it on GitHub https://github.com/hultenvp/solis-sensor/issues/158 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AYRF45Y5TCVQDD33SRGTNHLV6RIRPANCNFSM6AAAAAAQOHMLLU . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/AYRF452HQE6WVD5AKFVYDTDV6RIRPA5CNFSM6AAAAAAQOHMLLWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHFEAH6WE.gif Message ID: @.*** @.***> >
unfortunately I only get battery power and remaining capacity as a measurement. I can't see a battery status value in the API documentation either
if you figure this out, please let me know. Ive actually been trying to get that info all day myself and no closer :)
I've hacked together a workaround for now until I can find something better. I created a Derivative helper based on my battery remaining charge sensor. Then used that value to determine if the battery power value should be negative with the below template sensor:
template:
sensor:
- name: "Battery Rate"
state: >
{% if states("sensor.battery_delta") | float <= 0 -%}
{{ states("sensor.my_solis_inverter_battery_power") | int }}
{%- else -%}
{{ states("sensor.my_solis_inverter_battery_power") | int * -1}}
{%- endif -%}
state_class: measurement
unit_of_measurement: W
device_class: power
I don't see anything explicit in the soliscloud API indicating charging or discharging status.
What you could do is check with the test app if battery current might be useful, but I'm afraid it's just like power only absolute.
I don't have an inverter with battery myself, so I'm relying on the community here ;-). If you find how I can recreate battery state on soliscloud then I'm happy to add it.
Yeah, I spent the better part of yesterday going through the API documentation and there's nothing explicit as you say.
Honestly, the derivative sensor with the template is proving pretty good. there's about a 2 minute lag on it, but the solis api isn't realtime anyway.
I'll give the test app a go and try to find anything further that might indicate status... Either way, thank you for your work on this! The total Charged/Discharged is accurate for the power dashboard, the battery flow is just to satisfy my need for instant gratification :)
So... It looks like the "inverter" endpoint doesnt help much. However the ( "/v1/api/stationDetail" ) endpoint does..
Inverter just gives power.
But the stationDetail gives a negative value when outputting to the house..
So, i now use that endpoint to give me the "total" in/out . I guess some math needs to be used if you query and inverter endpoint directly..
Interesting! So if we know the total of the station then we should be able to figure out whether an individual inverter battery is charging or discharging. Just a matter of making sure the sum adds up.
I'm going to see if I can use the info and make an improvement by adding a battery state.
With @lynxus' comment above seeming to be the answer to where we can get the direction of flow. Is this just a case of moving BAT_POWER: and BAT_POWER_STR: from the INVERTER_DETAIL endpoint into the PLANT_DETAIL one?
all of the other power sensors in hass seem to operate on negative meaning export and positive meaning import, so this would be in-line with general practise so far as I can tell.
I considered trying this, but I am not a python guy and don't have a test instance of hass available to mess with.
Edit: I tried it, of course it wasn't that simple :)
Haha.
Well, you could exchange the inverter_detail values with the plant details if you only have one inverter/battery in your station. Most people will have that, but stations can have multiple inverters registered and I can only assume that the BAT_POWER is then the sum of all inverters' BAT_POWER. And since they have different precision (see -0.015 vs 0.01) it will be interesting to come up with a generic algorithm to figure out which sum of positive and negative inverter BAT_POWER values makes up the station BAT POWER.
By the way, it should be as simple as to move the lines BAT_POWER and BAT_POWER_STR from INVERTER_DETAIL to PLANT_DETAIL.
I simply created a template
sensor for this - whereby if the solar output is greater than the house consumption then it's a positive value (charging), and if the solar output is less than the house consumption then it's a negative value (discharging)
`
Solis battery charge / discharge
battery_power:
friendly_name: Battery Power
unit_of_measurement: W
value_template: >
{% if states('sensor.solis_ac_output_total_power')| int > states('sensor.solis_total_consumption_power')| int %}
{% set battery_power = states('sensor.solis_battery_power')|int %}
{% elif states('sensor.solis_ac_output_total_power')| int < states('sensor.solis_total_consumption_power')| int %}
{% set battery_power = states('sensor.solis_battery_power')|int*-1 %}
{% endif %}
{{ battery_power }}
`
It is strange that you see a positive value for both the charging and discharging. Could it be something with the integration between your battery system and the inverter?
On my system (pylontech batteries), the solis_battery_power entity is negative when discharging.
It is strange that you see a positive value for both the charging and discharging. Could it be something with the integration between your battery system and the inverter?
On my system (pylontech batteries), the solis_battery_power entity is negative when discharging.
out of curiosity, are you using solis cloud, or the older m.ginlong.com portal? I expect this will only affect you if you're on the solis cloud one. It may be moot at this point, as the solis cloud api is now non-functional as of 4am this morning (hopefully by mistake)
I raised a ticket some time ago and just received this message to my many questions
So we have an article which shows a way to access API, however we stopped it because of GDPR
It would appear they may have shutdown the API access on GDPR grounds.
On Tue, 27 Sept 2022, 22:36 corvus2606, @.***> wrote:
It is strange that you see a positive value for both the charging and discharging. Could it be something with the integration between your battery system and the inverter?
On my system (pylontech batteries), the solis_battery_power entity is negative when discharging.
[image: image] https://user-images.githubusercontent.com/2979286/192604939-b912026d-45e7-4c8f-947d-95d428349f4e.png
out of curiosity, are you using solis cloud, or the older m.ginlong.com portal? I expect this will only affect you if you're on the solis cloud one. It may be moot at this point, as the solis cloud api is now non-functional as of 4am this morning (hopefully by mistake)
— Reply to this email directly, view it on GitHub https://github.com/hultenvp/solis-sensor/issues/158#issuecomment-1260079970, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYRF4567VQST7OQXBHVRLVLWANSEFANCNFSM6AAAAAAQOHMLLU . You are receiving this because you commented.Message ID: @.***>
Let's wait till they get back online with a new API version and see if the problem persists
hey folks -- just looking in the current SolisCloud dashboard, on the inverter detail page, and if this is exposed through the API, this value looks like it could give an indication of charging vs discharging:

I'll try running the test script tomorrow (assuming my battery gets some use!) and see if that value goes negative when discharging...
The battery is currently charging and I can see this in the inverterDetail API response:
"storageBatteryCurrent": 9.3,
"storageBatteryCurrentStr": "A",
"storageBatteryVoltage": 53.4,
"storageBatteryVoltageStr": "V",
which matches this:
And here's what it looks like while discharging:
"storageBatteryCurrent": -2.7,
"storageBatteryCurrentStr": "A",
"storageBatteryVoltage": 51.7,
"storageBatteryVoltageStr": "V",
this is really weird ... my battery power is signed (positive for charging and negative for discharging) and always has been as far as I can remember. (using soliscloud)
Mine is the same @LucidityCrash, negative for discharging and positive for charging. I am looking to create a sensor that says if it's zero, then battery state is idle, if it's -0.1 or lower then it's discharging, if it's greater than 0 then it's charging
Yeah that's really weird. solis_battery_power (and the source data, "Battery Power" in the soliscloud.com UI) are always positive for me -- "Battery Current" goes positive/negative.
Just checked tonight and weirdly, now I'm getting a positive value for a discharge when it should be a negative one. Bit late for me to start investigating but will update tomorrow. Need to see what the api is spitting out in it's raw form.
Curiouser and Curiouser, mine is still negative.
On Tue, 29 Nov 2022, 23:45 viking2010, @.***> wrote:
Just checked tonight and weirdly, now I'm getting a positive value for a discharge when it should be a negative one. Bit late for me to start investigating but will update tomorrow. Need to see what the api is spitting out in it's raw form.
— Reply to this email directly, view it on GitHub https://github.com/hultenvp/solis-sensor/issues/158#issuecomment-1331462675, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALWZJKZR37GZR4ZSANZLDYDWK2IQHANCNFSM6AAAAAAQOHMLLU . You are receiving this because you were mentioned.Message ID: @.***>
ok, so tested today and if I look back at my history for the battery sensor, it clearly shows that it was going negative at one point.
...but since sometime on the 28th, that's when it stopped providing the negative number and now shows it as positive when charging or discharging. Looking over the output of the .py test script, the number in there is positive too. As @lynxus mentioned further back in this thread, the Station Detail shows a negative number: "batteryPower": -0.375, whereas the inverter detail shows: "batteryPower": 0.375.
@LucidityCrash, if the inverter detail for you is providing a negative number, do you see the same in the station detail?
I presume we're all using the newer Solis Cloud site and not the original Ginlong one? Could that be the difference?
StationDetail : "batteryPower": -0.093,
InverterDetail ; "batteryPower": -0.093,
And yes ... I'm using SolisCloud :)
Mind blown! 🤯
@lynxus & @LucidityCrash just another thought, do you have the newer or older style Data Logging stick? I have recently swapped to the new one with the LED's on the front, and it occurred to me that the dates when my stats changed from showing the negative number was on the same day I swapped to the new logger. That's the only other change I can think of that could be why things are different. If not, I give up lol!!
@lynxus & @LucidityCrash just another thought, do you have the newer or older style Data Logging stick? I have recently swapped to the new one with the LED's on the front, and it occurred to me that the dates when my stats changed from showing the negative number was on the same day I swapped to the new logger. That's the only other change I can think of that could be why things are different. If not, I give up lol!!
I do have the newer one I guess. LEDs on front. My install is very new.
I've found so many oddities within the Solis API it's painful.