kellerza / pysma

Async library for SMA Solar's WebConnect interface
MIT License
59 stars 51 forks source link

Support for today yield and yesterday yield on Sunny Boy AV-41 models #29

Closed bccrew closed 4 years ago

bccrew commented 4 years ago

Hi @kellerza

My invertor does not have a instantaneous value for the Today Yield and Yesterday Yield. It would come in handy to store these in an influxdb.

Would you be able to add some code that handles this as well? The code on the homepage on the invertor looks like this:

<tbody> 
<!-- ngRepeat: row in tableContent -->
<tr ng-repeat="row in tableContent" class="ng-scope"> 
  <td translate="lYieldToday" class="ng-scope">Today:</td> 
  <td style="text-align: right"> 
    <!-- ngIf: row.key --> 
    <!-- ngIf: row.calcValKey -->
    <span ng-if="row.calcValKey" class="ng-binding ng-scope"> 12.91 kWh </span>
    <!-- end ngIf: row.calcValKey --> 
  </td> 
</tr><!-- end ngRepeat: row in tableContent -->
<tr ng-repeat="row in tableContent" class="ng-scope"> 
   <td translate="lYieldYesterday" class="ng-scope">Yesterday:</td> 
   <td style="text-align: right"> 
   <!-- ngIf: row.key --> 
   <!-- ngIf: row.calcValKey -->
   <span ng-if="row.calcValKey" class="ng-binding ng-scope"> 20.77 kWh </span>
   <!-- end ngIf: row.calcValKey --> 
  </td>
</tr><!-- end ngRepeat: row in tableContent -->
<tr ng-repeat="row in tableContent" class="ng-scope">
   <td translate="lYieldTotal" class="ng-scope">Total:</td> 
   <td style="text-align: right"> <!-- ngIf: row.key --> 
   <!-- ngIf: row.calcValKey -->
   <span ng-if="row.calcValKey" class="ng-binding ng-scope"> 394.3 kWh </span>
   <!-- end ngIf: row.calcValKey -->
  </td> 
</tr><!-- end ngRepeat: row in tableContent --> 
</tbody> 

I will add the page itself + screenshot too.

yield.zip

Capture

kellerza commented 4 years ago

In HomeAssistant I use a “utility meter” on the total yield field, which works quite well. This can also be written to influxdb in hass as well.

These values you see are not directly available from the api & calculated in some way by the sunnyboy page (they do multiple calls to a different history api endpoint) - have not looked into this & no current plans.

With the utility meter we calculate it using the difference of the totals at day’s end, maybe this could work for you?

bccrew commented 4 years ago

Yes, it could! Thanks!

kellerza commented 4 years ago

I’ll put my config on the homepage for future reference..