Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate sensors (issue #89) #91

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions custom_components/sems/const.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Constants for the sems integration."""

DOMAIN = "sems"

import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, CONF_SCAN_INTERVAL
from datetime import timedelta

DOMAIN = "sems"

CONF_STATION_ID = "powerstation_id"

Expand All @@ -22,3 +19,21 @@
): int, # , default=DEFAULT_SCAN_INTERVAL
}
)

API_UPDATE_ERROR_MSG = "Error communicating with API, probably token could not be fetched, see debug logs"

AC_EMPTY = 6553.5
AC_CURRENT_EMPTY = 6553.5
AC_FEQ_EMPTY = 655.35


class GOODWE_SPELLING:
battery = "bettery"
batteryStatus = "betteryStatus"
homeKit = "homKit"
temperature = "tempperature"
hasEnergyStatisticsCharts = "hasEnergeStatisticsCharts"
energyStatisticsCharts = "energeStatisticsCharts"
energyStatisticsTotals = "energeStatisticsTotals"
thisMonthTotalE = "thismonthetotle"
lastMonthTotalE = "lastmonthetotle"
7 changes: 4 additions & 3 deletions custom_components/sems/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"config_flow": true,
"documentation": "https://github.com/TimSoethout/goodwe-sems-home-assistant",
"issue_tracker": "https://github.com/TimSoethout/goodwe-sems-home-assistant/issues",
"iot_class": "cloud_polling",
"integration_type": "hub",
"iot_class": "cloud_polling",
"requirements": [],
"dependencies": [],
"codeowners": ["@TimSoethout"],
"version": "3.7.3"
"codeowners": ["@TimSoethout", "@L-four"],
"version": "4.0.0"
}
9 changes: 3 additions & 6 deletions custom_components/sems/sems_api.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import json
import logging

import json
import requests

from homeassistant import exceptions

_LOGGER = logging.getLogger(__name__)

# _LoginURL = "https://eu.semsportal.com/api/v2/Common/CrossLogin"
_LoginURL = "https://www.semsportal.com/api/v2/Common/CrossLogin"
_PowerStationURLPart = "/v2/PowerStation/GetMonitorDetailByPowerstationId"
_PowerStationURLPart = "/v3/PowerStation/GetMonitorDetailByPowerstationId"
_RequestTimeout = 30 # seconds

_DefaultHeaders = {
Expand All @@ -35,7 +32,7 @@ def test_authentication(self) -> bool:
self._token = self.getLoginToken(self._username, self._password)
return self._token is not None
except Exception as exception:
_LOGGER.exception("SEMS Authentication exception " + exception)
_LOGGER.exception("SEMS Authentication exception " + exception.__str__())
return False

def getLoginToken(self, userName, password):
Expand Down
Loading