Kleinrotti / py-senertec

Senertec energy system gen2 interface.
MIT License
1 stars 1 forks source link

Adjustable time period for the getChart() function #13

Open MarAlze opened 7 months ago

MarAlze commented 7 months ago

Since in the current configuration only the values from "Fri Jan 07 2022" to "Sat Jan 08 2022" are retrieved during chart retrieval, I suggest that you can also add the start and end time.

Proposal: File: senertec.client

 def getChart(self, chartname: str,starttime: int= 1641596400000 ,endtime: int= 1641682800000):
    """Get a history chart of the connected unit.
    """
    sn = self.__connectedUnit__["seriennummer"]
    response = self.__post__(
        f"/rest/charts/{sn}/data", json.dumps(
            {"start": starttime, "end": endtime, "parameters": {}, "chartName": chartname, "sn": sn}))
            # {"start": 1641596400000, "end": None, "parameters": {}, "chartName": chartname, "sn": sn}))
Kleinrotti commented 7 months ago

I will add this in a new release.