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

Add support for ESTAR ENERGY url #179

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ secrets.ini
hoymiles.log
.vscode/launch.json
workspace.code-workspace
hoymiles/
bin/
/bin

Expand Down
1 change: 1 addition & 0 deletions edge/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ dev =
setuptools
pytest
pytest-cov
pytest-mock

[options.entry_points]
# Add here console scripts like:
Expand Down
16 changes: 16 additions & 0 deletions edge/src/hoymiles/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import sys

if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for conditional) when `python_requires = >= 3.8`
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
else:
from importlib_metadata import PackageNotFoundError, version # pragma: no cover

try:
# Change here if project is renamed and does not equal the package name
dist_name = __name__
__version__ = version(dist_name)
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"
finally:
del version, PackageNotFoundError
Empty file.
60 changes: 60 additions & 0 deletions edge/src/hoymiles/api_schema/data_count_station_real_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from __future__ import annotations

from datetime import datetime, date
from typing import Optional

from pydantic import BaseModel


class DataCountStation(BaseModel):
status: int
message: str
data: DataDict
systemNotice: Optional[str] = None


class DataDict(BaseModel):
today_eq: float
month_eq: int
year_eq: Optional[int] = None
total_eq: int
real_power: Optional[float] = None
co2_emission_reduction: float
plant_tree: int
data_time: datetime
last_data_time: datetime
capacitor: float
is_balance: int
is_reflux: int
reflux_station_data: Optional[RefluxDataDict] = None


class RefluxDataDict(BaseModel):
start_date: Optional[datetime | str] = ""
end_date: Optional[datetime | str] = ""

pv_power: float
grid_power: float
load_power: float
bms_power: float
bms_soc: float

bms_out_eq: float
bms_in_eq: float

mb_in_eq: MBOut
mb_out_eq: MBIn


class MBOut(BaseModel):
today_eq: float
month_eq: float
year_eq: float
total_eq: float


class MBIn(BaseModel):
today_eq: float
month_eq: float
year_eq: float
total_eq: float
31 changes: 31 additions & 0 deletions edge/src/hoymiles/api_schema/data_find.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from __future__ import annotations

from datetime import datetime, date
from typing import Optional, List

from pydantic import BaseModel


class DataFind(BaseModel):
status: int
message: str
data: DataDict
systemNotice: Optional[str] = None


class DataDict(BaseModel):
mi_sn: Optional[int] = None
net_state: int
warn_list: Optional[list] = []
dbg: bool
warn_shield_set: Optional[List[WarnDict]] = []


class WarnDict(BaseModel):
err_code: int
start_at: datetime
end_at: Optional[datetime | str] = "-"
wdd1: str
wd1: str
wdd2: str
wd2: str
4 changes: 1 addition & 3 deletions edge/src/hoymiles/api_schema/station_find.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from __future__ import annotations

import ctypes
from datetime import datetime
from typing import Optional

from pydantic import BaseModel
from typing_extensions import Literal


class StationFind(BaseModel):
status: str
status: int
message: str
data: DataDict
systemNotice: Optional[str] = None
Expand Down
32 changes: 32 additions & 0 deletions edge/src/hoymiles/api_schema/station_select_device_of_tree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from __future__ import annotations

from datetime import datetime, date
from logging import warn
from typing import Optional, List

from pydantic import BaseModel


class DeviceTree(BaseModel):
status: int
message: str
data: Optional[List[DevicedDict]] = []
systemNotice: Optional[str] = None


class DevicedDict(BaseModel):
id: int
sn: str

dtu_sn: str
type: int
model_no: str
soft_ver: str
hard_ver: str
warn_data: Optional[WarnDict | dict] = {}
children: Optional[List[DevicedDict]] = []


class WarnDict(BaseModel):
connect: bool
warn: bool
Loading