Skip to content

Commit

Permalink
cleanup + correction readme
Browse files Browse the repository at this point in the history
  • Loading branch information
djansen1987 committed Aug 13, 2021
1 parent fe95153 commit 51cb9ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 44 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ sensor:
- selfConsumedEnergy2
- plantTreeNum
- reduceCo2
- totalGridPower
- totalLoadPower
- totalPvgenPower
```
If you have a Saj Sec module add the following config under platform:
Expand Down Expand Up @@ -95,6 +98,9 @@ Optional sensors when using an Saj Sec Module:
- selfConsumedEnergy2
- plantTreeNum
- reduceCo2
- totalGridPower
- totalLoadPower
- totalPvgenPower
```
Expand Down
45 changes: 1 addition & 44 deletions custom_components/saj_esolar/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,6 @@ def add_years(d, years):
unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
),




SensorEntityDescription(
key="pvElec",
name="pvElec",
Expand Down Expand Up @@ -302,8 +298,6 @@ def add_years(d, years):
name="reduceCo2",
icon="mdi:molecule-co2",
),


SensorEntityDescription(
key="totalGridPower",
name="totalGridPower",
Expand Down Expand Up @@ -355,7 +349,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(entities, True)
return True

# pylint: disable=abstract-method
class SAJeSolarMeterData(object):
"""Handle eSolar object and limit updates."""

Expand Down Expand Up @@ -638,42 +631,6 @@ async def async_update(self):
getPlantMeterChartData = await response_getPlantMeterChartData.json()
plantDetails.update(getPlantMeterChartData)


# # # Get Sec Meter details 1/2

# url_getMeterModuleHistoryDataList = "https://fop.saj-electric.com/saj/cloudmonitor/plantMeterModule/getMeterModuleHistoryDataList"

# payload_getMeterModuleHistoryDataList = "pageNo=1&pageSize=&plantUid={}&moduleSn={}&chartDateType=1&clientDate={}&chartDay={}&chartMonth={}&chartYear={}".format(plantuid,moduleSn,clientDate,chartDay,chartMonth,chartYear)
# headers_getMeterModuleHistoryDataList = {
# 'Connection': 'keep-alive',
# 'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
# 'Accept': 'application/json, text/javascript, */*; q=0.01',
# 'DNT': '1',
# 'X-Requested-With': 'XMLHttpRequest',
# 'sec-ch-ua-mobile': '?0',
# 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
# 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
# 'Origin': 'https://fop.saj-electric.com',
# 'Sec-Fetch-Site': 'same-origin',
# 'Sec-Fetch-Mode': 'cors',
# 'Sec-Fetch-Dest': 'empty',
# 'Accept-Language': 'nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7'
# }

# response_getMeterModuleHistoryDataList = await self._session.post(url_getMeterModuleHistoryDataList, headers=headers_getMeterModuleHistoryDataList, data=payload_getMeterModuleHistoryDataList)

# _LOGGER.debug(response_getMeterModuleHistoryDataList.json())
# _LOGGER.debug(response_getMeterModuleHistoryDataList.text())

# if response_getMeterModuleHistoryDataList.status != 200:
# _LOGGER.error(f"{response_getMeterModuleHistoryDataList.url} returned {response_getMeterModuleHistoryDataList.status}")
# return


# getMeterModuleHistoryDataList = await response_getMeterModuleHistoryDataList.json()
# plantDetails.update(getMeterModuleHistoryDataList)


self._data = plantDetails
_LOGGER.debug(self._data)
# _LOGGER.debug(self._session.cookie_jar.filter_cookies("https://fop.saj-electric.com"))
Expand Down Expand Up @@ -878,7 +835,7 @@ async def async_update(self):
self._state = float(energy['viewBean']["reduceCo2"])


# dataCountLis
# dataCountList
if self._type == 'totalGridPower':
self._state = float(energy['dataCountList'][4][-1])

Expand Down

0 comments on commit 51cb9ec

Please sign in to comment.