SolarManager unter Versionsverwaltung
Erster Stand der Hintergrundprozesse, die auf der Synology unter /volume1/homes/wagner/SolarManager laufen: der Manager selbst, die Sammler je Geraet, die MQTT-Bruecke, der Wecker und - neu hinzugezogen - der AutoAction-Runner, der als Hintergrundprozess hierher gehoert und nicht ins Web-Verzeichnis. Zugangsdaten stehen nicht mehr im Quelltext, sondern in config.ini, die nicht mit eingecheckt wird. Vorlage ist config.ini.example, gelesen wird sie von konfig.py. Betroffen waren solarManager.py (Datenbank und Wattpilot), zeit.py, gatherWaterData.py, wecker.py und skoda_testdaten.py, das sich das Passwort bisher aus dem Quelltext eines anderen Moduls herausgesucht hat. Die Kia-Anbindung ist mit dem Fahrzeug entfallen: kiaTest.py, gatherCarData.py und hyundai_kia_connect_api sind nicht mehr dabei, ebenso gatherInverterData.py, auf das nur noch eine auskommentierte Zeile zeigte. Die mitgelieferten Bibliotheken bleiben im Repository - die NAS hat kein pip, sie muessen neben den Skripten liegen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
"""Init file for hoymiles_wifi package."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
LOGLEVEL = os.environ.get("LOGLEVEL", "INFO").upper()
|
||||
logging.basicConfig(level=LOGLEVEL)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -0,0 +1,398 @@
|
||||
"""Contains the main functionality of the hoymiles_wifi package."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
from dataclasses import asdict, dataclass
|
||||
|
||||
from google.protobuf.json_format import MessageToJson
|
||||
from google.protobuf.message import Message
|
||||
|
||||
from hoymiles_wifi.const import DTU_FIRMWARE_URL_00_01_11, MAX_POWER_LIMIT
|
||||
from hoymiles_wifi.dtu import DTU
|
||||
from hoymiles_wifi.hoymiles import (
|
||||
generate_dtu_version_string,
|
||||
generate_inverter_serial_number,
|
||||
generate_sw_version_string,
|
||||
generate_version_string,
|
||||
get_dtu_model_name,
|
||||
get_inverter_model_name,
|
||||
)
|
||||
from hoymiles_wifi.protobuf import (
|
||||
AppGetHistPower_pb2,
|
||||
APPHeartbeatPB_pb2,
|
||||
APPInfomationData_pb2,
|
||||
CommandPB_pb2,
|
||||
GetConfig_pb2,
|
||||
InfomationData_pb2,
|
||||
NetworkInfo_pb2,
|
||||
RealData_pb2,
|
||||
RealDataNew_pb2,
|
||||
)
|
||||
|
||||
RED = "\033[91m"
|
||||
END = "\033[0m"
|
||||
|
||||
|
||||
@dataclass
|
||||
class VersionInfo:
|
||||
"""Represents version information for the hoymiles_wifi package."""
|
||||
|
||||
dtu_hw_version: str
|
||||
dtu_sw_version: str
|
||||
inverter_hw_version: str
|
||||
inverter_sw_version: str
|
||||
|
||||
def __str__(self: VersionInfo) -> str:
|
||||
"""Return a string representation of the VersionInfo object."""
|
||||
|
||||
return (
|
||||
f'dtu_hw_version: "{self.dtu_hw_version}"\n'
|
||||
f'dtu_sw_version: "{self.dtu_sw_version}"\n'
|
||||
f'inverter_hw_version: "{self.inverter_hw_version}"\n'
|
||||
f'inverter_sw_version: "{self.inverter_sw_version}"\n'
|
||||
)
|
||||
|
||||
def to_dict(self: VersionInfo) -> dict:
|
||||
"""Convert the VersionInfo object to a dictionary."""
|
||||
|
||||
return asdict(self)
|
||||
|
||||
|
||||
# Inverter commands
|
||||
async def async_get_real_data_new(
|
||||
dtu: DTU,
|
||||
) -> RealDataNew_pb2.RealDataNewResDTO | None:
|
||||
"""Get real data from the inverter asynchronously."""
|
||||
|
||||
return await dtu.async_get_real_data_new()
|
||||
|
||||
|
||||
async def async_get_real_data(dtu: DTU) -> RealData_pb2.RealDataResDTO | None:
|
||||
"""Get real data from the inverter asynchronously."""
|
||||
|
||||
return await dtu.async_get_real_data()
|
||||
|
||||
|
||||
async def async_get_config(dtu: DTU) -> GetConfig_pb2.GetConfigResDTO | None:
|
||||
"""Get the config from the inverter asynchronously."""
|
||||
|
||||
return await dtu.async_get_config()
|
||||
|
||||
|
||||
async def async_network_info(
|
||||
dtu: DTU,
|
||||
) -> NetworkInfo_pb2.NetworkInfoResDTO | None:
|
||||
"""Get network information from the inverter asynchronously."""
|
||||
|
||||
return await dtu.async_network_info()
|
||||
|
||||
|
||||
async def async_app_information_data(
|
||||
dtu: DTU,
|
||||
) -> APPInfomationData_pb2.AppInfomationDataResDTO | None:
|
||||
"""Get application information data from the inverter asynchronously."""
|
||||
|
||||
return await dtu.async_app_information_data()
|
||||
|
||||
|
||||
async def async_app_get_hist_power(
|
||||
dtu: DTU,
|
||||
) -> AppGetHistPower_pb2.AppGetHistPowerResDTO:
|
||||
"""Get historical power data from the inverter asynchronously."""
|
||||
|
||||
return await dtu.async_app_get_hist_power()
|
||||
|
||||
|
||||
async def async_set_power_limit(
|
||||
dtu: DTU,
|
||||
) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Set the power limit of the inverter asynchronously."""
|
||||
|
||||
print( # noqa: T201
|
||||
RED
|
||||
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||
+ "!!! Danger zone! This will change the power limit of the dtu. !!!\n"
|
||||
+ "!!! Please be careful and make sure you know what you are doing. !!!\n"
|
||||
+ "!!! Only proceed if you know what you are doing. !!!\n"
|
||||
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||
+ END,
|
||||
)
|
||||
|
||||
cont = input("Do you want to continue? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
power_limit = int(input("Enter the new power limit (0-100): "))
|
||||
|
||||
if power_limit < 0 or power_limit > MAX_POWER_LIMIT:
|
||||
print("Error. Invalid power limit!") # noqa: T201
|
||||
return None
|
||||
|
||||
print(f"Setting power limit to {power_limit}%") # noqa: T201
|
||||
cont = input("Are you sure? (y/n): ")
|
||||
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
return await dtu.async_set_power_limit(power_limit)
|
||||
|
||||
|
||||
async def async_set_wifi(dtu: DTU) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Set the wifi SSID and password of the inverter asynchronously."""
|
||||
|
||||
wifi_ssid = input("Enter the new wifi SSID: ").strip()
|
||||
wifi_password = input("Enter the new wifi password: ").strip()
|
||||
print(f'Setting wifi to "{wifi_ssid}"') # noqa: T201
|
||||
print(f'Setting wifi password to "{wifi_password}"') # noqa: T201
|
||||
cont = input("Are you sure? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
return await dtu.async_set_wifi(wifi_ssid, wifi_password)
|
||||
|
||||
|
||||
async def async_firmware_update(dtu: DTU) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Update the firmware of the DTU asynchronously."""
|
||||
|
||||
print( # noqa: T201
|
||||
RED
|
||||
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||
+ "!!! Danger zone! This will update the firmeware of the DTU. !!!\n"
|
||||
+ "!!! Please be careful and make sure you know what you are doing. !!!\n"
|
||||
+ "!!! Only proceed if you know what you are doing. !!!\n"
|
||||
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||
+ END,
|
||||
)
|
||||
|
||||
cont = input("Do you want to continue? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
print("Please select a firmware version:") # noqa: T201
|
||||
print("1.) V00.01.11") # noqa: T201
|
||||
print("2.) Custom URL") # noqa: T201
|
||||
|
||||
while True:
|
||||
selection = input("Enter your selection (1 or 2): ")
|
||||
|
||||
if selection == "1":
|
||||
url = DTU_FIRMWARE_URL_00_01_11
|
||||
break
|
||||
if selection == "2":
|
||||
url = input("Enter the custom URL: ").strip()
|
||||
break
|
||||
|
||||
print("Invalid selection. Please enter 1 or 2.") # noqa: T201
|
||||
|
||||
print() # noqa: T201
|
||||
print(f'Firmware update URL: "{url}"') # noqa: T201
|
||||
print() # noqa: T201
|
||||
|
||||
cont = input("Do you want to continue? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
return await dtu.async_update_dtu_firmware()
|
||||
|
||||
|
||||
async def async_restart_dtu(dtu: DTU) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Restart the DTU asynchronously."""
|
||||
|
||||
cont = input("Do you want to restart the DTU? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
return await dtu.async_restart_dtu()
|
||||
|
||||
|
||||
async def async_turn_on_inverter(dtu: DTU) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Turn on the inverter asynchronously."""
|
||||
|
||||
inverter_serial = input("Enter the inverter serial number to turn *ON*: ")
|
||||
|
||||
cont = input(f"Do you want to turn *ON* the Inverter {inverter_serial}? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
return await dtu.async_turn_on_inverter(inverter_serial)
|
||||
|
||||
|
||||
async def async_turn_off_inverter(dtu: DTU) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Turn off the inverter asynchronously."""
|
||||
|
||||
inverter_serial = input("Enter the inverter serial number to turn *OFF*: ")
|
||||
|
||||
cont = input(f"Do you want to turn *OFF* the Inverter {inverter_serial}? (y/n): ")
|
||||
if cont != "y":
|
||||
return None
|
||||
|
||||
return await dtu.async_turn_off_inverter(inverter_serial)
|
||||
|
||||
|
||||
async def async_get_information_data(
|
||||
dtu: DTU,
|
||||
) -> InfomationData_pb2.InfomationDataResDTO:
|
||||
"""Get information data from the dtu asynchronously."""
|
||||
|
||||
return await dtu.async_get_information_data()
|
||||
|
||||
|
||||
async def async_get_version_info(dtu: DTU) -> VersionInfo | None:
|
||||
"""Get version information from the dtu asynchronously."""
|
||||
|
||||
response = await async_app_information_data(dtu)
|
||||
|
||||
if not response:
|
||||
return None
|
||||
|
||||
return VersionInfo(
|
||||
dtu_hw_version="H"
|
||||
+ generate_dtu_version_string(response.dtu_info.dtu_hw_version),
|
||||
dtu_sw_version="V"
|
||||
+ generate_dtu_version_string(response.dtu_info.dtu_sw_version),
|
||||
inverter_hw_version="H"
|
||||
+ generate_version_string(response.pv_info[0].pv_hw_version),
|
||||
inverter_sw_version="V"
|
||||
+ generate_sw_version_string(response.pv_info[0].pv_sw_version),
|
||||
)
|
||||
|
||||
|
||||
async def async_heatbeat(dtu: DTU) -> APPHeartbeatPB_pb2.APPHeartbeatResDTO | None:
|
||||
"""Request a heartbeat from the dtu asynchronously."""
|
||||
|
||||
return await dtu.async_heartbeat()
|
||||
|
||||
|
||||
async def async_identify_dtu(dtu: DTU) -> str:
|
||||
"""Identify the DTU asynchronously."""
|
||||
|
||||
real_data = await async_get_real_data_new(dtu)
|
||||
return get_dtu_model_name(real_data.device_serial_number)
|
||||
|
||||
|
||||
async def async_identify_inverters(dtu: DTU) -> list[str]:
|
||||
"""Identify the DTU asynchronously."""
|
||||
|
||||
inverter_models = []
|
||||
real_data = await async_get_real_data_new(dtu)
|
||||
if real_data:
|
||||
for sgs_data in real_data.sgs_data:
|
||||
serial_number = generate_inverter_serial_number(sgs_data.serial_number)
|
||||
inverter_model = get_inverter_model_name(serial_number)
|
||||
inverter_models.append(inverter_model)
|
||||
|
||||
for tgs_data in real_data.tgs_data:
|
||||
serial_number = generate_inverter_serial_number(tgs_data.serial_number)
|
||||
inverter_model = get_inverter_model_name(serial_number)
|
||||
inverter_models.append(inverter_model)
|
||||
|
||||
return inverter_models
|
||||
|
||||
|
||||
async def async_get_alarm_list(dtu: DTU) -> None:
|
||||
"""Get alarm list from the dtu asynchronously."""
|
||||
|
||||
return await dtu.async_get_alarm_list()
|
||||
|
||||
|
||||
def print_invalid_command(command: str) -> None:
|
||||
"""Print an invalid command message."""
|
||||
|
||||
print(f"Invalid command: {command}") # noqa: T201
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
"""Execute the main function for the hoymiles_wifi package."""
|
||||
|
||||
parser = argparse.ArgumentParser(description="Hoymiles DTU Monitoring")
|
||||
parser.add_argument(
|
||||
"--host", type=str, required=True, help="IP address or hostname of the DTU"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--as-json",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Format the output as JSON",
|
||||
)
|
||||
parser.add_argument(
|
||||
"command",
|
||||
type=str,
|
||||
choices=[
|
||||
"get-real-data-new",
|
||||
"get-real-data",
|
||||
"get-config",
|
||||
"network-info",
|
||||
"app-information-data",
|
||||
"app-get-hist-power",
|
||||
"set-power-limit",
|
||||
"set-wifi",
|
||||
"firmware-update",
|
||||
"restart-dtu",
|
||||
"turn-on-inverter",
|
||||
"turn-off-inverter",
|
||||
"get-information-data",
|
||||
"get-version-info",
|
||||
"heartbeat",
|
||||
"identify-dtu",
|
||||
"identify-inverters",
|
||||
"get-alarm-list",
|
||||
],
|
||||
help="Command to execute",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
dtu = DTU(args.host)
|
||||
|
||||
# Execute the specified command using a switch case
|
||||
switch = {
|
||||
"get-real-data-new": async_get_real_data_new,
|
||||
"get-real-data": async_get_real_data,
|
||||
"get-config": async_get_config,
|
||||
"network-info": async_network_info,
|
||||
"app-information-data": async_app_information_data,
|
||||
"app-get-hist-power": async_app_get_hist_power,
|
||||
"set-power-limit": async_set_power_limit,
|
||||
"set-wifi": async_set_wifi,
|
||||
"firmware-update": async_firmware_update,
|
||||
"restart-dtu": async_restart_dtu,
|
||||
"turn-on-inverter": async_turn_on_inverter,
|
||||
"turn-off-inverter": async_turn_off_inverter,
|
||||
"get-information-data": async_get_information_data,
|
||||
"get-version-info": async_get_version_info,
|
||||
"heartbeat": async_heatbeat,
|
||||
"identify-dtu": async_identify_dtu,
|
||||
"identify-inverters": async_identify_inverters,
|
||||
"get-alarm-list": async_get_alarm_list,
|
||||
}
|
||||
|
||||
command_func = switch.get(args.command, print_invalid_command)
|
||||
response = await command_func(dtu)
|
||||
|
||||
if response:
|
||||
if args.as_json:
|
||||
if isinstance(response, Message):
|
||||
print(MessageToJson(response)) # noqa: T201
|
||||
else:
|
||||
print(json.dumps(asdict(response), indent=4)) # noqa: T201
|
||||
else:
|
||||
print(f"{args.command.capitalize()} Response: \n{response}") # noqa: T201
|
||||
else:
|
||||
print( # noqa: T201
|
||||
f"No response or unable to retrieve response for "
|
||||
f"{args.command.replace('_', ' ')}",
|
||||
)
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
def run_main() -> None:
|
||||
"""Run the main function for the hoymiles_wifi package."""
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_main()
|
||||
@@ -0,0 +1,118 @@
|
||||
"""Constants for the Hoymiles WiFi integration."""
|
||||
|
||||
DTU_PORT = 10081
|
||||
|
||||
# App -> DTU start with 0xa3, responses start 0xa2
|
||||
CMD_HEADER = b"HM"
|
||||
CMD_APP_INFO_DATA_RES_DTO = b"\xa3\x01"
|
||||
CMD_HB_RES_DTO = b"\xa3\x02"
|
||||
CMD_REAL_DATA_RES_DTO = b"\xa3\x03"
|
||||
CMD_W_INFO_RES_DTO = b"\xa3\x04"
|
||||
CMD_COMMAND_RES_DTO = b"\xa3\x05"
|
||||
CMD_COMMAND_STATUS_RES_DTO = b"\xa3\x06"
|
||||
CMD_DEV_CONFIG_FETCH_RES_DTO = b"\xa3\x07"
|
||||
CMD_DEV_CONFIG_PUT_RES_DTO = b"\xa3\x08"
|
||||
CMD_GET_CONFIG = b"\xa3\x09"
|
||||
CMD_SET_CONFIG = b"\xa3\x10"
|
||||
CMD_REAL_RES_DTO = b"\xa3\x11"
|
||||
CMD_GPST_RES_DTO = b"\xa3\x12"
|
||||
CMD_AUTO_SEARCH = b"\xa3\x13"
|
||||
CMD_NETWORK_INFO_RES = b"\xa3\x14"
|
||||
CMD_APP_GET_HIST_POWER_RES = b"\xa3\x15"
|
||||
CMD_APP_GET_HIST_ED_RES = b"\xa3\x16"
|
||||
CMD_HB_RES_DTO_ALT = b"\x83\x01"
|
||||
CMD_REGISTER_RES_DTO = b"\x83\x02"
|
||||
CMD_STORAGE_DATA_RES = b"\x83\x03"
|
||||
CMD_COMMAND_RES_DTO_2 = b"\x83\x05"
|
||||
CMD_COMMAND_STATUS_RES_DTO_2 = b"\x83\x06"
|
||||
CMD_DEV_CONFIG_FETCH_RES_DTO_2 = b"\x83\x07"
|
||||
CMD_DEV_CONFIG_PUT_RES_DTO_2 = b"\x83\x08"
|
||||
CMD_GET_CONFIG_RES = b"\xdb\x08"
|
||||
CMD_SET_CONFIG_RES = b"\xdb\x07"
|
||||
|
||||
CMD_CLOUD_INFO_DATA_RES_DTO = b"\x23\x01"
|
||||
CMD_CLOUD_COMMAND_RES_DTO = b"\x23\x05"
|
||||
|
||||
CMD_ACTION_MICRO_DEFAULT = 0
|
||||
CMD_ACTION_DTU_REBOOT = 1
|
||||
CMD_ACTION_DTU_UPGRADE = 2
|
||||
CMD_ACTION_MI_REBOOT = 3
|
||||
CMD_ACTION_COLLECT_VERSION = 4
|
||||
CMD_ACTION_ANTI_THEFT_SETTING = 5
|
||||
CMD_ACTION_MI_START = 6
|
||||
CMD_ACTION_MI_SHUTDOWN = 7
|
||||
CMD_ACTION_LIMIT_POWER = 8
|
||||
CMD_ACTION_REFLUX_CONTROL = 9
|
||||
CMD_ACTION_CLEAN_GROUNDING_FAULT = 10
|
||||
CMD_ACTION_CT_SET = 11
|
||||
CMD_ACTION_MI_LOCK = 12
|
||||
CMD_ACTION_MI_UNLOCK = 13
|
||||
CMD_ACTION_SET_GRID_FILE = 14
|
||||
CMD_ACTION_UPGRADE_MI = 15
|
||||
CMD_ACTION_ID_NETWORKING = 16
|
||||
CMD_ACTION_REFLUX_NETWORKING = 17
|
||||
CMD_ACTION_STOP_CONTROLLER_CMD = 18
|
||||
CMD_ACTION_SET_WIFI_PASS = 19
|
||||
CMD_ACTION_SET_SVR_DNS_PORT = 20
|
||||
CMD_ACTION_SET_GPRS_APN = 21
|
||||
CMD_ACTION_ANTI_THEFT_CONTROL = 22
|
||||
CMD_ACTION_REPEATER_NETWORKING = 0
|
||||
CMD_ACTION_DTU_DEFAULT = 0
|
||||
CMD_ACTION_GATEWAY_DEFAULT = 0
|
||||
CMD_ACTION_METER_REVERSE = 49
|
||||
CMD_ACTION_ALARM_LIST = 50
|
||||
CMD_ACTION_GW_REBOOT = 4096
|
||||
CMD_ACTION_GW_RESET = 4097
|
||||
CMD_ACTION_GW_STOP_RUN = 4098
|
||||
CMD_ACTION_GW_COLLECT_REAL_DATA = 4099
|
||||
CMD_ACTION_GW_COLLECT_VER = 4100
|
||||
CMD_ACTION_GW_AUTO_NETWORKING = 4101
|
||||
CMD_ACTION_GW_UPGRADE = 4102
|
||||
CMD_ACTION_MICRO_MEMORY_SNAPSHOT = 53
|
||||
CMD_ACTION_MICRO_DATA_WAVE = 54
|
||||
CMD_ACTION_SET_485_PORT = 36
|
||||
CMD_ACTION_THREE_BALANCE_SET = 37
|
||||
CMD_ACTION_MI_GRID_PROTECT_SELF = 38
|
||||
CMD_ACTION_SUN_SPEC_CONFIG = 39
|
||||
CMD_ACTION_POWER_GENERATION_CORRECT = 40
|
||||
CMD_ACTION_GRID_FILE_READ = 41
|
||||
CMD_ACTION_CLEAN_WARN = 42
|
||||
CMD_ACTION_DRM_SETTING = 43
|
||||
CMD_ACTION_ES_CONFIG_MANAGER = 0
|
||||
CMD_ACTION_ES_USER_SETTING = 0
|
||||
CMD_ACTION_READ_MI_HU_WARN = 46
|
||||
CMD_ACTION_LIMIT_POWER_PF = 47
|
||||
CMD_ACTION_LIMIT_POWER_REACTIVE = 48
|
||||
CMD_ACTION_INV_BOOT_UP = 8193
|
||||
CMD_ACTION_INV_SHUTDOWN = 8194
|
||||
CMD_ACTION_INV_REBOOT = 8195
|
||||
CMD_ACTION_INV_RESET = 8196
|
||||
CMD_ACTION_INV_CLEAN_WARN = 8197
|
||||
CMD_ACTION_INV_CLEAN_HIS_DATA = 8198
|
||||
CMD_ACTION_INV_UPLOAD_REAL_DATA = 8199
|
||||
CMD_ACTION_INV_FIND_DEV = 8200
|
||||
CMD_ACTION_INV_BATTERY_MODE_CONFIG = 0
|
||||
CMD_ACTION_BMS_REBOOT = 8224
|
||||
CMD_ACTION_BMS_URGENT_CHARGING = 8225
|
||||
CMD_ACTION_BMS_BALANCE = 8208
|
||||
CMD_ACTION_INV_UPGRADE = 4112
|
||||
CMD_ACTION_BMS_UPGRADE = 4112
|
||||
|
||||
|
||||
DEV_DTU = 1
|
||||
DEV_REPEATER = 2
|
||||
DEV_MICRO = 3
|
||||
DEV_MODEL = 4
|
||||
DEV_METER = 5
|
||||
DEV_INV = 6
|
||||
DEV_RSD = 7
|
||||
DEV_OP = 8
|
||||
DEV_GATEWAY = 9
|
||||
DEV_BMS = 10
|
||||
|
||||
DTU_FIRMWARE_URL_00_01_11 = (
|
||||
"http://fwupdate.hoymiles.com/cfs/bin/2311/06/,1488725943932555264.bin"
|
||||
)
|
||||
|
||||
MAX_POWER_LIMIT = 100
|
||||
OFFSET = 28800
|
||||
@@ -0,0 +1,422 @@
|
||||
"""DTU communication implementation for Hoymiles WiFi."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import struct
|
||||
import time
|
||||
from datetime import datetime
|
||||
from enum import Enum, IntEnum
|
||||
from typing import Any
|
||||
|
||||
from crcmod import mkCrcFun
|
||||
|
||||
from hoymiles_wifi import logger
|
||||
from hoymiles_wifi.const import (
|
||||
CMD_ACTION_ALARM_LIST,
|
||||
CMD_ACTION_DTU_REBOOT,
|
||||
CMD_ACTION_DTU_UPGRADE,
|
||||
CMD_ACTION_LIMIT_POWER,
|
||||
CMD_ACTION_MI_SHUTDOWN,
|
||||
CMD_ACTION_MI_START,
|
||||
CMD_APP_GET_HIST_POWER_RES,
|
||||
CMD_APP_INFO_DATA_RES_DTO,
|
||||
CMD_CLOUD_COMMAND_RES_DTO,
|
||||
CMD_COMMAND_RES_DTO,
|
||||
CMD_GET_CONFIG,
|
||||
CMD_HB_RES_DTO,
|
||||
CMD_HEADER,
|
||||
CMD_NETWORK_INFO_RES,
|
||||
CMD_REAL_DATA_RES_DTO,
|
||||
CMD_REAL_RES_DTO,
|
||||
CMD_SET_CONFIG,
|
||||
DEV_DTU,
|
||||
DTU_FIRMWARE_URL_00_01_11,
|
||||
DTU_PORT,
|
||||
OFFSET,
|
||||
)
|
||||
from hoymiles_wifi.hoymiles import convert_inverter_serial_number
|
||||
from hoymiles_wifi.protobuf import (
|
||||
AppGetHistPower_pb2,
|
||||
APPHeartbeatPB_pb2,
|
||||
APPInfomationData_pb2,
|
||||
CommandPB_pb2,
|
||||
GetConfig_pb2,
|
||||
InfomationData_pb2,
|
||||
NetworkInfo_pb2,
|
||||
RealData_pb2,
|
||||
RealDataNew_pb2,
|
||||
SetConfig_pb2,
|
||||
)
|
||||
from hoymiles_wifi.utils import initialize_set_config
|
||||
|
||||
|
||||
class NetmodeSelect(IntEnum):
|
||||
"""Network mode selection."""
|
||||
|
||||
WIFI = 1
|
||||
SIM = 2
|
||||
LAN = 3
|
||||
|
||||
|
||||
class NetworkState(Enum):
|
||||
"""Network state."""
|
||||
|
||||
Unknown = 0
|
||||
Online = 1
|
||||
Offline = 2
|
||||
|
||||
|
||||
class DTU:
|
||||
"""DTU class."""
|
||||
|
||||
def __init__(self, host: str):
|
||||
"""Initialize DTU class."""
|
||||
|
||||
self.host = host
|
||||
self.state = NetworkState.Unknown
|
||||
self.sequence = 0
|
||||
self.mutex = asyncio.Lock()
|
||||
|
||||
def get_state(self) -> NetworkState:
|
||||
"""Get DTU state."""
|
||||
|
||||
return self.state
|
||||
|
||||
def set_state(self, new_state: NetworkState):
|
||||
"""Set DTU state."""
|
||||
|
||||
if self.state != new_state:
|
||||
self.state = new_state
|
||||
logger.debug(f"DTU is {new_state}")
|
||||
|
||||
async def async_get_real_data(self) -> RealData_pb2.RealDataResDTO | None:
|
||||
"""Get real data."""
|
||||
|
||||
request = RealData_pb2.RealDataResDTO()
|
||||
request.time_ymd_hms = (
|
||||
datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode("utf-8")
|
||||
)
|
||||
request.time = int(time.time())
|
||||
request.offset = OFFSET
|
||||
request.error_code = 0
|
||||
|
||||
command = CMD_REAL_DATA_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, RealData_pb2.RealDataReqDTO
|
||||
)
|
||||
|
||||
async def async_get_real_data_new(self) -> RealDataNew_pb2.RealDataNewResDTO | None:
|
||||
"""Get real data new."""
|
||||
|
||||
request = RealDataNew_pb2.RealDataNewResDTO()
|
||||
request.time_ymd_hms = (
|
||||
datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode("utf-8")
|
||||
)
|
||||
request.offset = OFFSET
|
||||
request.time = int(time.time())
|
||||
command = CMD_REAL_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, RealDataNew_pb2.RealDataNewReqDTO
|
||||
)
|
||||
|
||||
async def async_get_config(self) -> GetConfig_pb2.GetConfigResDTO | None:
|
||||
"""Get config."""
|
||||
|
||||
request = GetConfig_pb2.GetConfigResDTO()
|
||||
request.offset = OFFSET
|
||||
request.time = int(time.time()) - 60
|
||||
command = CMD_GET_CONFIG
|
||||
return await self.async_send_request(
|
||||
command,
|
||||
request,
|
||||
GetConfig_pb2.GetConfigReqDTO,
|
||||
)
|
||||
|
||||
async def async_network_info(self) -> NetworkInfo_pb2.NetworkInfoResDTO | None:
|
||||
"""Get network info."""
|
||||
|
||||
request = NetworkInfo_pb2.NetworkInfoResDTO()
|
||||
request.offset = OFFSET
|
||||
request.time = int(time.time())
|
||||
command = CMD_NETWORK_INFO_RES
|
||||
return await self.async_send_request(
|
||||
command, request, NetworkInfo_pb2.NetworkInfoReqDTO
|
||||
)
|
||||
|
||||
async def async_app_information_data(
|
||||
self,
|
||||
) -> APPInfomationData_pb2.APPInfoDataResDTO:
|
||||
"""Get app information data."""
|
||||
request = APPInfomationData_pb2.APPInfoDataResDTO()
|
||||
request.time_ymd_hms = (
|
||||
datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode("utf-8")
|
||||
)
|
||||
request.offset = OFFSET
|
||||
request.time = int(time.time())
|
||||
command = CMD_APP_INFO_DATA_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, APPInfomationData_pb2.APPInfoDataReqDTO
|
||||
)
|
||||
|
||||
async def async_app_get_hist_power(
|
||||
self,
|
||||
) -> AppGetHistPower_pb2.AppGetHistPowerResDTO | None:
|
||||
"""Get historical power."""
|
||||
|
||||
request = AppGetHistPower_pb2.AppGetHistPowerResDTO()
|
||||
request.control_point = 0
|
||||
request.offset = OFFSET
|
||||
request.requested_time = int(time.time())
|
||||
request.requested_day = 0
|
||||
command = CMD_APP_GET_HIST_POWER_RES
|
||||
return await self.async_send_request(
|
||||
command,
|
||||
request,
|
||||
AppGetHistPower_pb2.AppGetHistPowerReqDTO,
|
||||
)
|
||||
|
||||
async def async_set_power_limit(
|
||||
self,
|
||||
power_limit: int,
|
||||
) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Set power limit."""
|
||||
if power_limit < 0 or power_limit > 100:
|
||||
logger.error("Error. Invalid power limit!")
|
||||
return
|
||||
|
||||
power_limit = power_limit * 10
|
||||
|
||||
request = CommandPB_pb2.CommandResDTO()
|
||||
request.time = int(time.time())
|
||||
request.action = CMD_ACTION_LIMIT_POWER
|
||||
request.package_nub = 1
|
||||
request.tid = int(time.time())
|
||||
request.data = f"A:{power_limit},B:0,C:0\r".encode()
|
||||
|
||||
command = CMD_COMMAND_RES_DTO
|
||||
|
||||
return await self.async_send_request(
|
||||
command, request, CommandPB_pb2.CommandReqDTO
|
||||
)
|
||||
|
||||
async def async_set_wifi(
|
||||
self, ssid: str, password: str
|
||||
) -> SetConfig_pb2.SetConfigResDTO | None:
|
||||
"""Set wifi."""
|
||||
|
||||
get_config_req = await self.async_get_config()
|
||||
|
||||
if get_config_req is None:
|
||||
logger.error("Failed to get config")
|
||||
return None
|
||||
|
||||
request = initialize_set_config(get_config_req)
|
||||
|
||||
request.time = int(time.time())
|
||||
request.offset = OFFSET
|
||||
request.app_page = 1
|
||||
request.netmode_select = NetmodeSelect.WIFI
|
||||
request.wifi_ssid = ssid.encode("utf-8")
|
||||
request.wifi_password = password.encode("utf-8")
|
||||
|
||||
command = CMD_SET_CONFIG
|
||||
return await self.async_send_request(
|
||||
command, request, SetConfig_pb2.SetConfigReqDTO
|
||||
)
|
||||
|
||||
async def async_update_dtu_firmware(
|
||||
self,
|
||||
firmware_url: str = DTU_FIRMWARE_URL_00_01_11,
|
||||
) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Update DTU firmware."""
|
||||
|
||||
request = CommandPB_pb2.CommandResDTO()
|
||||
request.action = CMD_ACTION_DTU_UPGRADE
|
||||
request.package_nub = 1
|
||||
request.tid = int(time.time())
|
||||
request.data = (firmware_url + "\r").encode("utf-8")
|
||||
|
||||
command = CMD_CLOUD_COMMAND_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, CommandPB_pb2.CommandReqDTO
|
||||
)
|
||||
|
||||
async def async_restart_dtu(self) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Restart DTU."""
|
||||
|
||||
request = CommandPB_pb2.CommandResDTO()
|
||||
request.action = CMD_ACTION_DTU_REBOOT
|
||||
request.package_nub = 1
|
||||
request.tid = int(time.time())
|
||||
|
||||
command = CMD_CLOUD_COMMAND_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, CommandPB_pb2.CommandReqDTO
|
||||
)
|
||||
|
||||
async def async_turn_on_inverter(
|
||||
self, inverter_serial: str
|
||||
) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Turn on Inverter."""
|
||||
|
||||
inverter_serial_int = convert_inverter_serial_number(inverter_serial)
|
||||
|
||||
request = CommandPB_pb2.CommandResDTO()
|
||||
request.action = CMD_ACTION_MI_START
|
||||
request.package_nub = 1
|
||||
request.dev_kind = DEV_DTU
|
||||
request.tid = int(time.time())
|
||||
request.mi_to_sn.extend([inverter_serial_int])
|
||||
|
||||
command = CMD_CLOUD_COMMAND_RES_DTO
|
||||
|
||||
return await self.async_send_request(
|
||||
command, request, CommandPB_pb2.CommandReqDTO
|
||||
)
|
||||
|
||||
async def async_turn_off_inverter(
|
||||
self, inverter_serial: str
|
||||
) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Turn off Inverter."""
|
||||
|
||||
inverter_serial_int = convert_inverter_serial_number(inverter_serial)
|
||||
|
||||
request = CommandPB_pb2.CommandResDTO()
|
||||
request.action = CMD_ACTION_MI_SHUTDOWN
|
||||
request.package_nub = 1
|
||||
request.dev_kind = DEV_DTU
|
||||
request.tid = int(time.time())
|
||||
request.mi_to_sn.extend([inverter_serial_int])
|
||||
|
||||
command = CMD_CLOUD_COMMAND_RES_DTO
|
||||
|
||||
return await self.async_send_request(
|
||||
command, request, CommandPB_pb2.CommandReqDTO
|
||||
)
|
||||
|
||||
async def async_get_information_data(
|
||||
self,
|
||||
) -> InfomationData_pb2.InfoDataResDTO | None:
|
||||
"""Get information data."""
|
||||
|
||||
request = InfomationData_pb2.InfoDataResDTO()
|
||||
request.time_ymd_hms = (
|
||||
datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode("utf-8")
|
||||
)
|
||||
request.offset = OFFSET
|
||||
request.time = int(time.time())
|
||||
command = CMD_APP_INFO_DATA_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, InfomationData_pb2.InfoDataReqDTO
|
||||
)
|
||||
|
||||
async def async_heartbeat(self) -> APPHeartbeatPB_pb2.HBReqDTO | None:
|
||||
"""Request heartbeat."""
|
||||
|
||||
request = APPHeartbeatPB_pb2.HBResDTO()
|
||||
request.time_ymd_hms = (
|
||||
datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode("utf-8")
|
||||
)
|
||||
request.offset = OFFSET
|
||||
request.time = int(time.time())
|
||||
|
||||
command = CMD_HB_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, APPHeartbeatPB_pb2.HBReqDTO
|
||||
)
|
||||
|
||||
async def async_get_alarm_list(self) -> CommandPB_pb2.CommandResDTO | None:
|
||||
"""Turn off DTU."""
|
||||
|
||||
request = CommandPB_pb2.CommandResDTO()
|
||||
request.action = CMD_ACTION_ALARM_LIST
|
||||
request.package_nub = 1
|
||||
request.dev_kind = 0
|
||||
request.tid = int(time.time())
|
||||
|
||||
command = CMD_COMMAND_RES_DTO
|
||||
return await self.async_send_request(
|
||||
command, request, CommandPB_pb2.CommandReqDTO
|
||||
)
|
||||
|
||||
async def async_send_request(
|
||||
self,
|
||||
command: bytes,
|
||||
request: Any,
|
||||
response_type: Any,
|
||||
dtu_port: int = DTU_PORT,
|
||||
):
|
||||
"""Send request to DTU."""
|
||||
|
||||
self.sequence = (self.sequence + 1) & 0xFFFF
|
||||
|
||||
request_as_bytes = request.SerializeToString()
|
||||
crc16 = mkCrcFun(0x18005, rev=True, initCrc=0xFFFF, xorOut=0x0000)(
|
||||
request_as_bytes
|
||||
)
|
||||
length = len(request_as_bytes) + 10
|
||||
|
||||
# compose request message
|
||||
header = CMD_HEADER + command
|
||||
message = (
|
||||
header
|
||||
+ struct.pack(">HHH", self.sequence, crc16, length)
|
||||
+ request_as_bytes
|
||||
)
|
||||
|
||||
address = (self.host, dtu_port)
|
||||
|
||||
async with self.mutex:
|
||||
try:
|
||||
reader, writer = await asyncio.open_connection(*address)
|
||||
|
||||
writer.write(message)
|
||||
await writer.drain()
|
||||
|
||||
buf = await asyncio.wait_for(reader.read(1024), timeout=5)
|
||||
except (OSError, asyncio.TimeoutError) as e:
|
||||
logger.debug(f"{e}")
|
||||
self.set_state(NetworkState.Offline)
|
||||
return None
|
||||
finally:
|
||||
try:
|
||||
writer.close()
|
||||
await writer.wait_closed()
|
||||
except Exception as e:
|
||||
logger.debug(f"Error closing writer: {e}")
|
||||
|
||||
try:
|
||||
if len(buf) < 10:
|
||||
raise ValueError("Buffer is too short for unpacking")
|
||||
|
||||
crc16_target, read_length = struct.unpack(">HH", buf[6:10])
|
||||
|
||||
logger.debug(f"Read length: {read_length}")
|
||||
|
||||
if len(buf) != read_length:
|
||||
raise ValueError("Buffer is incomplete")
|
||||
|
||||
response_as_bytes = buf[10:read_length]
|
||||
|
||||
crc16_response = mkCrcFun(0x18005, rev=True, initCrc=0xFFFF, xorOut=0x0000)(
|
||||
response_as_bytes
|
||||
)
|
||||
|
||||
if crc16_response != crc16_target:
|
||||
logger.debug(
|
||||
f"CRC16 mismatch: {hex(crc16_response)} != {hex(crc16_target)}"
|
||||
)
|
||||
raise ValueError("CRC16 mismatch")
|
||||
|
||||
parsed = response_type.FromString(response_as_bytes)
|
||||
|
||||
if not parsed:
|
||||
raise ValueError("Parsing resulted in an empty or falsy value")
|
||||
except Exception as e:
|
||||
logger.debug(f"Failed to parse response: {e}")
|
||||
self.set_state(NetworkState.Unknown)
|
||||
return None
|
||||
|
||||
self.set_state(NetworkState.Online)
|
||||
return parsed
|
||||
@@ -0,0 +1,304 @@
|
||||
"""Hoymiles quirks for inverters and DTU."""
|
||||
|
||||
import struct
|
||||
from enum import Enum
|
||||
|
||||
from hoymiles_wifi import logger
|
||||
|
||||
|
||||
class InverterType(Enum):
|
||||
"""Inverter type."""
|
||||
|
||||
ONE = "1T"
|
||||
TWO = "2T"
|
||||
FOUR = "4T"
|
||||
SIX = "6T"
|
||||
|
||||
|
||||
class InverterSeries(Enum):
|
||||
"""Inverter series."""
|
||||
|
||||
HM = "HM"
|
||||
HMS = "HMS"
|
||||
HMT = "HMT"
|
||||
|
||||
|
||||
class InverterPower(Enum):
|
||||
"""Inverter power."""
|
||||
|
||||
P_100 = "100"
|
||||
P_250 = "250"
|
||||
P_300_350_400 = "300/350/400"
|
||||
P_400 = "400"
|
||||
P_500 = "500"
|
||||
P_600_700_800 = "600/700/800"
|
||||
P_800W = "800W"
|
||||
P_1000 = "1000"
|
||||
P_1000W = "1000W"
|
||||
P_800W_1000W = "800W/1000W"
|
||||
P_1000_1200_1500 = "1000/1200/1500"
|
||||
P_1200_1500 = "1200/1500"
|
||||
P_1600 = "1600"
|
||||
P_2000 = "2000"
|
||||
P_2250 = "2250"
|
||||
|
||||
|
||||
power_mapping = {
|
||||
0x1011: InverterPower.P_100,
|
||||
0x1020: InverterPower.P_250,
|
||||
0x1021: InverterPower.P_300_350_400,
|
||||
0x1121: InverterPower.P_300_350_400,
|
||||
0x1125: InverterPower.P_400,
|
||||
0x1040: InverterPower.P_500,
|
||||
0x1041: InverterPower.P_600_700_800,
|
||||
0x1042: InverterPower.P_600_700_800,
|
||||
0x1141: InverterPower.P_600_700_800,
|
||||
0x1060: InverterPower.P_1000,
|
||||
0x1061: InverterPower.P_1200_1500,
|
||||
0x1161: InverterPower.P_1000_1200_1500,
|
||||
0x1164: InverterPower.P_1600,
|
||||
0x1412: InverterPower.P_800W_1000W,
|
||||
0x1382: InverterPower.P_2250,
|
||||
}
|
||||
|
||||
|
||||
class DTUType(Enum):
|
||||
"""DTU type."""
|
||||
|
||||
DTU_G100 = "DTU-G100"
|
||||
DTU_W100 = "DTU-W100"
|
||||
DTU_LITE_S = "DTU-Lite-S"
|
||||
DTU_LITE = "DTU-Lite"
|
||||
DTU_PRO = "DTU-PRO"
|
||||
DTU_PRO_S = "DTU-PRO-S"
|
||||
DTUBI = "DTUBI"
|
||||
DTU_W100_LITE_S = "DTU-W100/DTU-Lite-S"
|
||||
DTU_W_LITE = "DTU-WLite"
|
||||
|
||||
|
||||
type_mapping = {
|
||||
0x10F7: DTUType.DTU_PRO,
|
||||
0x10FB: DTUType.DTU_PRO,
|
||||
0x4101: DTUType.DTU_PRO,
|
||||
0x10FC: DTUType.DTU_PRO,
|
||||
0x4120: DTUType.DTU_PRO,
|
||||
0x10F8: DTUType.DTU_PRO,
|
||||
0x4100: DTUType.DTU_PRO,
|
||||
0x10FD: DTUType.DTU_PRO,
|
||||
0x4121: DTUType.DTU_PRO,
|
||||
0x10D3: DTUType.DTU_W100_LITE_S,
|
||||
0x4110: DTUType.DTU_W100_LITE_S,
|
||||
0x10D8: DTUType.DTU_W100_LITE_S,
|
||||
0x4130: DTUType.DTU_W100_LITE_S,
|
||||
0x4132: DTUType.DTU_W100_LITE_S,
|
||||
0x4133: DTUType.DTU_W100_LITE_S,
|
||||
0x10D9: DTUType.DTU_W100_LITE_S,
|
||||
0x4111: DTUType.DTU_W100_LITE_S,
|
||||
0x10D2: DTUType.DTU_G100,
|
||||
0x10D6: DTUType.DTU_LITE,
|
||||
0x10D7: DTUType.DTU_LITE,
|
||||
0x4131: DTUType.DTU_LITE,
|
||||
0x1124: DTUType.DTUBI,
|
||||
0x1125: DTUType.DTUBI,
|
||||
0x1403: DTUType.DTUBI,
|
||||
0x1144: DTUType.DTUBI,
|
||||
0x1143: DTUType.DTUBI,
|
||||
0x1145: DTUType.DTUBI,
|
||||
0x1412: DTUType.DTUBI,
|
||||
0x1164: DTUType.DTUBI,
|
||||
0x1165: DTUType.DTUBI,
|
||||
0x1166: DTUType.DTUBI,
|
||||
0x1167: DTUType.DTUBI,
|
||||
0x1222: DTUType.DTUBI,
|
||||
0x1422: DTUType.DTUBI,
|
||||
0x1423: DTUType.DTUBI,
|
||||
0x1361: DTUType.DTUBI,
|
||||
0x1362: DTUType.DTUBI,
|
||||
0x1381: DTUType.DTUBI,
|
||||
0x1382: DTUType.DTUBI,
|
||||
0x4143: DTUType.DTUBI,
|
||||
}
|
||||
|
||||
|
||||
def format_number(number: int) -> str:
|
||||
"""Format number to two digits."""
|
||||
|
||||
return f"{number:02d}"
|
||||
|
||||
|
||||
def generate_version_string(version_number: int) -> str:
|
||||
"""Generate version string."""
|
||||
|
||||
version_string = (
|
||||
format_number(version_number // 2048)
|
||||
+ "."
|
||||
+ format_number((version_number // 64) % 32)
|
||||
+ "."
|
||||
+ format_number(version_number % 64)
|
||||
)
|
||||
return version_string
|
||||
|
||||
|
||||
def generate_sw_version_string(version_number: int) -> str:
|
||||
"""Generate software version string."""
|
||||
|
||||
version_number2 = version_number // 10000
|
||||
version_number3 = (version_number - (version_number2 * 10000)) // 100
|
||||
version_number4 = (version_number - (version_number2 * 10000)) - (
|
||||
version_number3 * 100
|
||||
)
|
||||
|
||||
version_string = (
|
||||
format_number(version_number2)
|
||||
+ "."
|
||||
+ format_number(version_number3)
|
||||
+ "."
|
||||
+ format_number(version_number4)
|
||||
)
|
||||
return version_string
|
||||
|
||||
|
||||
def generate_dtu_version_string(version_number: int, type: str = "") -> str:
|
||||
"""Generate DTU version string."""
|
||||
|
||||
version_string = ""
|
||||
version_number2 = version_number % 256
|
||||
version_number3 = (version_number // 256) % 16
|
||||
|
||||
if type == "SRF":
|
||||
version_string += f"{format_number(version_number // 1048576)}.{format_number((version_number % 65536) // 4096)}.{format_number(version_number3)}.{format_number(version_number2)}"
|
||||
elif type == "HRF":
|
||||
version_string += f"{format_number(version_number // 65536)}.{format_number((version_number % 65536) // 4096)}.{format_number(version_number3)}.{format_number(version_number2)}"
|
||||
else:
|
||||
version_string += f"{format_number(version_number // 4096)}.{format_number(version_number3)}.{format_number(version_number2)}"
|
||||
|
||||
return version_string
|
||||
|
||||
|
||||
def generate_inverter_serial_number(serial_number: int) -> str:
|
||||
"""Generate inverter serial number."""
|
||||
|
||||
return hex(serial_number)[2:]
|
||||
|
||||
|
||||
def convert_inverter_serial_number(serial_number_str: str) -> int:
|
||||
"""Get inverter serial number from string."""
|
||||
|
||||
return int(serial_number_str, 16)
|
||||
|
||||
|
||||
def get_inverter_type(serial_bytes: bytes) -> InverterType:
|
||||
"""Get inverter type."""
|
||||
|
||||
inverter_type = None
|
||||
# Access individual bytes
|
||||
if serial_bytes[0] == 0x11:
|
||||
if serial_bytes[1] in [0x25, 0x24, 0x22, 0x21]:
|
||||
inverter_type = InverterType.ONE
|
||||
elif serial_bytes[1] in [0x44, 0x42, 0x41]:
|
||||
inverter_type = InverterType.TWO
|
||||
elif serial_bytes[1] in [0x64, 0x62, 0x61]:
|
||||
inverter_type = InverterType.FOUR
|
||||
elif serial_bytes[0] == 0x13:
|
||||
inverter_type = InverterType.SIX
|
||||
elif serial_bytes[0] == 0x14:
|
||||
if serial_bytes[1] in [0x12]:
|
||||
inverter_type = InverterType.TWO
|
||||
|
||||
if inverter_type is None:
|
||||
raise ValueError(
|
||||
f"Unknown inverter type: {hex(serial_bytes[0])} {hex(serial_bytes[1])}"
|
||||
)
|
||||
|
||||
return inverter_type
|
||||
|
||||
|
||||
def get_inverter_series(serial_bytes: bytes) -> InverterSeries:
|
||||
"""Get inverter series."""
|
||||
|
||||
series = None
|
||||
if serial_bytes[0] == 0x11:
|
||||
if (serial_bytes[1] & 0x0F) == 0x04:
|
||||
series = InverterSeries.HMS
|
||||
else:
|
||||
series = InverterSeries.HM
|
||||
elif serial_bytes[0] == 0x10:
|
||||
if serial_bytes[1] & 0x03 == 0x02:
|
||||
series = InverterSeries.HM
|
||||
else:
|
||||
series = InverterSeries.HMS
|
||||
elif serial_bytes[0] == 0x13:
|
||||
series = InverterSeries.HMT
|
||||
elif serial_bytes[0] == 0x14:
|
||||
series = InverterSeries.HMS
|
||||
|
||||
if series is None:
|
||||
raise ValueError(
|
||||
f"Unknown series: {hex(serial_bytes[0])} {hex(serial_bytes[1])}!"
|
||||
)
|
||||
|
||||
return series
|
||||
|
||||
|
||||
def get_inverter_power(serial_bytes: bytes) -> InverterPower:
|
||||
"""Get inverter power."""
|
||||
|
||||
inverter_type_bytes = struct.unpack(">H", serial_bytes[:2])[0]
|
||||
power = power_mapping.get(inverter_type_bytes)
|
||||
|
||||
if power is None:
|
||||
raise ValueError(
|
||||
f"Unknown power: {hex(serial_bytes[0])} {hex(serial_bytes[1])}!"
|
||||
)
|
||||
|
||||
return power
|
||||
|
||||
|
||||
def get_inverter_model_name(serial_number: str) -> str:
|
||||
"""Get hardware model name."""
|
||||
|
||||
serial_bytes = bytes.fromhex(serial_number)
|
||||
|
||||
try:
|
||||
inverter_type = get_inverter_type(serial_bytes)
|
||||
inverter_series = get_inverter_series(serial_bytes)
|
||||
inverter_power = get_inverter_power(serial_bytes)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return "Unknown"
|
||||
else:
|
||||
inverter_model_name = (
|
||||
inverter_series.value
|
||||
+ "-"
|
||||
+ inverter_power.value
|
||||
+ "-"
|
||||
+ inverter_type.value
|
||||
)
|
||||
return inverter_model_name
|
||||
|
||||
|
||||
def get_dtu_model_type(serial_bytes: bytes) -> DTUType:
|
||||
"""Get DTU model type."""
|
||||
|
||||
dtu_type_bytes = struct.unpack(">H", serial_bytes[:2])[0]
|
||||
|
||||
dtu_type = type_mapping.get(dtu_type_bytes)
|
||||
|
||||
if dtu_type is None:
|
||||
raise ValueError(f"Unknown DTU: {serial_bytes[:2]}!")
|
||||
|
||||
return dtu_type
|
||||
|
||||
|
||||
def get_dtu_model_name(serial_number: str) -> str:
|
||||
"""Get DTU model name."""
|
||||
|
||||
serial_bytes = bytes.fromhex(serial_number)
|
||||
|
||||
try:
|
||||
dtu_type = get_dtu_model_type(serial_bytes)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return "Unknown"
|
||||
else:
|
||||
return dtu_type.value
|
||||
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message HBReqDTO {
|
||||
int32 offset = 1; // Offset value
|
||||
int32 time = 2; // Timestamp of the request
|
||||
int32 csq = 3; // Carrier Signal Quality (CSQ)
|
||||
string dtu_serial_number = 4; // DTU serial number
|
||||
string device_serial_number = 5; // Device serial number
|
||||
}
|
||||
|
||||
message HBResDTO {
|
||||
int32 offset = 1; // Offset value
|
||||
int32 time = 2; // Timestamp of the response
|
||||
string time_ymd_hms = 3; // Timestamp in the format YMD_HMS
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: APPHeartbeatPB.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x41PPHeartbeatPB.proto\"n\n\x08HBReqDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x0b\n\x03\x63sq\x18\x03 \x01(\x05\x12\x19\n\x11\x64tu_serial_number\x18\x04 \x01(\t\x12\x1c\n\x14\x64\x65vice_serial_number\x18\x05 \x01(\t\">\n\x08HBResDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x14\n\x0ctime_ymd_hms\x18\x03 \x01(\tb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'APPHeartbeatPB_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_HBREQDTO']._serialized_start=24
|
||||
_globals['_HBREQDTO']._serialized_end=134
|
||||
_globals['_HBRESDTO']._serialized_start=136
|
||||
_globals['_HBRESDTO']._serialized_end=198
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,89 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message APPDtuInfoMO {
|
||||
int32 device_kind = 1; // Type of the device
|
||||
int32 dtu_sw_version = 2; // DTU software version
|
||||
int32 dtu_hw_version = 3; // DTU hardware version
|
||||
int32 dtu_step_time = 4; // DTU step time
|
||||
int32 dtu_rf_hw_version = 5; // DTU RF hardware version
|
||||
int32 dtu_rf_sw_version = 6; // DTU RF software version
|
||||
int32 access_model = 7; // Access model
|
||||
int32 communication_time = 8; // Communication time
|
||||
int32 signal_strength = 9; // Signal strength
|
||||
string gprs_version = 10; // GPRS version
|
||||
string wifi_version = 11; // Wifi version
|
||||
string ka_number = 12; // KA number
|
||||
int32 dtu_rule_id = 13; // DTU rule ID
|
||||
int32 dtu_error_code = 14; // DTU error code
|
||||
int32 dtu485_mode = 15; // DTU485 mode
|
||||
int32 dtu485_address = 16; // DTU485 address
|
||||
int32 sub1g_frequency_band = 17; // Sub1G frequency band
|
||||
int32 sub1g_channel_total_number = 18; // Sub1G channel total number
|
||||
int32 sub1g_channel_number = 19; // Sub1G channel number
|
||||
int32 sub1g_rp = 20; // Sub1G RP
|
||||
int32 sub1g_channel_total = 21; // Sub1G channel total
|
||||
string gprs_imei = 22; // GPRS IMEI
|
||||
}
|
||||
|
||||
message APPMeterInfoMO {
|
||||
int32 device_kind = 1; // Type of the device
|
||||
int64 meter_serial_number = 2; // Meter serial number
|
||||
int32 meter_model = 3; // Meter model
|
||||
int32 meter_ct = 4; // Meter current transformer
|
||||
int32 communication_way = 5; // Communication way
|
||||
int32 access_mode = 6; // Access mode
|
||||
int32 sw_version = 7; // Software version
|
||||
string meter_value = 8; // Meter value
|
||||
}
|
||||
|
||||
message APPRpInfoMO {
|
||||
int32 device_kind = 1; // Type of the device
|
||||
int64 rp_serial_number = 2; // RP serial number
|
||||
int32 rp_sw_version = 3; // RP software version
|
||||
int32 rp_hw_version = 4; // RP hardware version
|
||||
int32 rp_rule_id = 5; // RP rule ID
|
||||
}
|
||||
|
||||
message APPPvInfoMO {
|
||||
int32 device_kind = 1; // Type of the device
|
||||
int64 pv_serial_number = 2; // PV serial number
|
||||
int32 pv_usfw = 3; // PV US firmware
|
||||
int32 pv_sw_version = 4; // PV software version
|
||||
int32 pv_hw_part_number = 5; // PV hardware part number
|
||||
int32 pv_hw_version = 6; // PV hardware version
|
||||
int32 pv_grid_profile_code = 7; // PV grid profile code
|
||||
int32 pv_grid_profile = 8; // PV grid profile
|
||||
int32 pv_rf_hw_version = 9; // PV RF hardware version
|
||||
int32 pv_rf_sw_version = 10; // PV RF software version
|
||||
int32 mi_rule_id = 11; // MI rule ID
|
||||
}
|
||||
|
||||
message APPFeatureMO {
|
||||
int32 key = 1; // Feature key
|
||||
string value = 2; // Feature value
|
||||
}
|
||||
|
||||
message APPInfoDataReqDTO {
|
||||
string dtu_serial_number = 1; // DTU serial number
|
||||
uint32 timestamp = 2; // Timestamp
|
||||
int32 device_number = 3; // Device number
|
||||
int32 pv_number = 4; // PV number
|
||||
int32 package_number = 5; // Package number
|
||||
int32 current_package = 6; // Current package
|
||||
int32 channel = 7; // Channel
|
||||
APPDtuInfoMO dtu_info = 8; // DTU information
|
||||
repeated APPMeterInfoMO meter_info = 9; // Meter information
|
||||
repeated APPRpInfoMO rp_info = 10; // RP information
|
||||
repeated APPPvInfoMO pv_info = 11; // PV information
|
||||
uint32 unknown_field = 12; // Unknown field
|
||||
repeated APPFeatureMO app_features = 13; // Application features
|
||||
}
|
||||
|
||||
message APPInfoDataResDTO {
|
||||
string time_ymd_hms = 1; // Date and time
|
||||
int32 offset = 2; // Offset
|
||||
int32 current_package = 3; // Current package
|
||||
int32 error_code = 4; // Error code
|
||||
uint32 time = 5; // Timestamp
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: APPInfomationData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x41PPInfomationData.proto\"\xa6\x04\n\x0c\x41PPDtuInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x16\n\x0e\x64tu_sw_version\x18\x02 \x01(\x05\x12\x16\n\x0e\x64tu_hw_version\x18\x03 \x01(\x05\x12\x15\n\rdtu_step_time\x18\x04 \x01(\x05\x12\x19\n\x11\x64tu_rf_hw_version\x18\x05 \x01(\x05\x12\x19\n\x11\x64tu_rf_sw_version\x18\x06 \x01(\x05\x12\x14\n\x0c\x61\x63\x63\x65ss_model\x18\x07 \x01(\x05\x12\x1a\n\x12\x63ommunication_time\x18\x08 \x01(\x05\x12\x17\n\x0fsignal_strength\x18\t \x01(\x05\x12\x14\n\x0cgprs_version\x18\n \x01(\t\x12\x14\n\x0cwifi_version\x18\x0b \x01(\t\x12\x11\n\tka_number\x18\x0c \x01(\t\x12\x13\n\x0b\x64tu_rule_id\x18\r \x01(\x05\x12\x16\n\x0e\x64tu_error_code\x18\x0e \x01(\x05\x12\x13\n\x0b\x64tu485_mode\x18\x0f \x01(\x05\x12\x16\n\x0e\x64tu485_address\x18\x10 \x01(\x05\x12\x1c\n\x14sub1g_frequency_band\x18\x11 \x01(\x05\x12\"\n\x1asub1g_channel_total_number\x18\x12 \x01(\x05\x12\x1c\n\x14sub1g_channel_number\x18\x13 \x01(\x05\x12\x10\n\x08sub1g_rp\x18\x14 \x01(\x05\x12\x1b\n\x13sub1g_channel_total\x18\x15 \x01(\x05\x12\x11\n\tgprs_imei\x18\x16 \x01(\t\"\xc2\x01\n\x0e\x41PPMeterInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x1b\n\x13meter_serial_number\x18\x02 \x01(\x03\x12\x13\n\x0bmeter_model\x18\x03 \x01(\x05\x12\x10\n\x08meter_ct\x18\x04 \x01(\x05\x12\x19\n\x11\x63ommunication_way\x18\x05 \x01(\x05\x12\x13\n\x0b\x61\x63\x63\x65ss_mode\x18\x06 \x01(\x05\x12\x12\n\nsw_version\x18\x07 \x01(\x05\x12\x13\n\x0bmeter_value\x18\x08 \x01(\t\"~\n\x0b\x41PPRpInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x18\n\x10rp_serial_number\x18\x02 \x01(\x03\x12\x15\n\rrp_sw_version\x18\x03 \x01(\x05\x12\x15\n\rrp_hw_version\x18\x04 \x01(\x05\x12\x12\n\nrp_rule_id\x18\x05 \x01(\x05\"\x95\x02\n\x0b\x41PPPvInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x18\n\x10pv_serial_number\x18\x02 \x01(\x03\x12\x0f\n\x07pv_usfw\x18\x03 \x01(\x05\x12\x15\n\rpv_sw_version\x18\x04 \x01(\x05\x12\x19\n\x11pv_hw_part_number\x18\x05 \x01(\x05\x12\x15\n\rpv_hw_version\x18\x06 \x01(\x05\x12\x1c\n\x14pv_grid_profile_code\x18\x07 \x01(\x05\x12\x17\n\x0fpv_grid_profile\x18\x08 \x01(\x05\x12\x18\n\x10pv_rf_hw_version\x18\t \x01(\x05\x12\x18\n\x10pv_rf_sw_version\x18\n \x01(\x05\x12\x12\n\nmi_rule_id\x18\x0b \x01(\x05\"*\n\x0c\x41PPFeatureMO\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\t\"\xed\x02\n\x11\x41PPInfoDataReqDTO\x12\x19\n\x11\x64tu_serial_number\x18\x01 \x01(\t\x12\x11\n\ttimestamp\x18\x02 \x01(\r\x12\x15\n\rdevice_number\x18\x03 \x01(\x05\x12\x11\n\tpv_number\x18\x04 \x01(\x05\x12\x16\n\x0epackage_number\x18\x05 \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x06 \x01(\x05\x12\x0f\n\x07\x63hannel\x18\x07 \x01(\x05\x12\x1f\n\x08\x64tu_info\x18\x08 \x01(\x0b\x32\r.APPDtuInfoMO\x12#\n\nmeter_info\x18\t \x03(\x0b\x32\x0f.APPMeterInfoMO\x12\x1d\n\x07rp_info\x18\n \x03(\x0b\x32\x0c.APPRpInfoMO\x12\x1d\n\x07pv_info\x18\x0b \x03(\x0b\x32\x0c.APPPvInfoMO\x12\x15\n\runknown_field\x18\x0c \x01(\r\x12#\n\x0c\x61pp_features\x18\r \x03(\x0b\x32\r.APPFeatureMO\"t\n\x11\x41PPInfoDataResDTO\x12\x14\n\x0ctime_ymd_hms\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x03 \x01(\x05\x12\x12\n\nerror_code\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\rb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'APPInfomationData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_APPDTUINFOMO']._serialized_start=28
|
||||
_globals['_APPDTUINFOMO']._serialized_end=578
|
||||
_globals['_APPMETERINFOMO']._serialized_start=581
|
||||
_globals['_APPMETERINFOMO']._serialized_end=775
|
||||
_globals['_APPRPINFOMO']._serialized_start=777
|
||||
_globals['_APPRPINFOMO']._serialized_end=903
|
||||
_globals['_APPPVINFOMO']._serialized_start=906
|
||||
_globals['_APPPVINFOMO']._serialized_end=1183
|
||||
_globals['_APPFEATUREMO']._serialized_start=1185
|
||||
_globals['_APPFEATUREMO']._serialized_end=1227
|
||||
_globals['_APPINFODATAREQDTO']._serialized_start=1230
|
||||
_globals['_APPINFODATAREQDTO']._serialized_end=1595
|
||||
_globals['_APPINFODATARESDTO']._serialized_start=1597
|
||||
_globals['_APPINFODATARESDTO']._serialized_end=1713
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,46 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message WInfoMO {
|
||||
int64 pv_sn = 1; // PV serial number
|
||||
int32 WCode = 2; // WCode identifier
|
||||
int32 WNum = 3; // WNum value
|
||||
int32 WTime1 = 4; // First timestamp value
|
||||
int32 WTime2 = 5; // Second timestamp value
|
||||
int32 WData1 = 6; // First data value
|
||||
int32 WData2 = 7; // Second data value
|
||||
}
|
||||
|
||||
message WInfoReqDTO {
|
||||
string dtu_sn = 1; // DTU serial number
|
||||
int32 time = 2; // Timestamp of the request
|
||||
repeated WInfoMO mWInfo = 3; // WInfoMO data array
|
||||
}
|
||||
|
||||
message WInfoResDTO {
|
||||
string time_ymd_hms = 1; // Timestamp in the format YMD_HMS
|
||||
int32 error_code = 2; // Error code indicator
|
||||
int32 offset = 3; // Offset value
|
||||
int32 time = 4; // Timestamp value
|
||||
}
|
||||
|
||||
message WWVDataReqDTO {
|
||||
string dtu_sn = 1; // DTU serial number
|
||||
int32 time = 2; // Timestamp of the request
|
||||
int32 package_nub = 3; // Package number
|
||||
int32 package_now = 4; // Current package number
|
||||
int64 pv_sn = 5; // PV serial number
|
||||
int32 WCode = 6; // WCode identifier
|
||||
int32 WNum = 7; // WNum value
|
||||
int32 WTime1 = 8; // First timestamp value
|
||||
int32 WVDataL = 9; // Length of WWVData
|
||||
int32 WPos = 10; // WPos value
|
||||
string mWVData = 11; // WWVData string
|
||||
}
|
||||
|
||||
message WWVDataResDTO {
|
||||
string time_ymd_hms = 1; // Timestamp in the format YMD_HMS
|
||||
int32 package_now = 2; // Current package number
|
||||
int32 error_code = 3; // Error code indicator
|
||||
int32 offset = 4; // Offset value
|
||||
int32 time = 5; // Timestamp value
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: AlarmData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x41larmData.proto\"u\n\x07WInfoMO\x12\r\n\x05pv_sn\x18\x01 \x01(\x03\x12\r\n\x05WCode\x18\x02 \x01(\x05\x12\x0c\n\x04WNum\x18\x03 \x01(\x05\x12\x0e\n\x06WTime1\x18\x04 \x01(\x05\x12\x0e\n\x06WTime2\x18\x05 \x01(\x05\x12\x0e\n\x06WData1\x18\x06 \x01(\x05\x12\x0e\n\x06WData2\x18\x07 \x01(\x05\"E\n\x0bWInfoReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x18\n\x06mWInfo\x18\x03 \x03(\x0b\x32\x08.WInfoMO\"U\n\x0bWInfoResDTO\x12\x14\n\x0ctime_ymd_hms\x18\x01 \x01(\t\x12\x12\n\nerror_code\x18\x02 \x01(\x05\x12\x0e\n\x06offset\x18\x03 \x01(\x05\x12\x0c\n\x04time\x18\x04 \x01(\x05\"\xc3\x01\n\rWWVDataReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x04 \x01(\x05\x12\r\n\x05pv_sn\x18\x05 \x01(\x03\x12\r\n\x05WCode\x18\x06 \x01(\x05\x12\x0c\n\x04WNum\x18\x07 \x01(\x05\x12\x0e\n\x06WTime1\x18\x08 \x01(\x05\x12\x0f\n\x07WVDataL\x18\t \x01(\x05\x12\x0c\n\x04WPos\x18\n \x01(\x05\x12\x0f\n\x07mWVData\x18\x0b \x01(\t\"l\n\rWWVDataResDTO\x12\x14\n\x0ctime_ymd_hms\x18\x01 \x01(\t\x12\x13\n\x0bpackage_now\x18\x02 \x01(\x05\x12\x12\n\nerror_code\x18\x03 \x01(\x05\x12\x0e\n\x06offset\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'AlarmData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_WINFOMO']._serialized_start=19
|
||||
_globals['_WINFOMO']._serialized_end=136
|
||||
_globals['_WINFOREQDTO']._serialized_start=138
|
||||
_globals['_WINFOREQDTO']._serialized_end=207
|
||||
_globals['_WINFORESDTO']._serialized_start=209
|
||||
_globals['_WINFORESDTO']._serialized_end=294
|
||||
_globals['_WWVDATAREQDTO']._serialized_start=297
|
||||
_globals['_WWVDATAREQDTO']._serialized_end=492
|
||||
_globals['_WWVDATARESDTO']._serialized_start=494
|
||||
_globals['_WWVDATARESDTO']._serialized_end=602
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message AppGetHistEDResDTO {
|
||||
int32 cp = 1; // Control point identifier
|
||||
int32 oft = 2; // Offset value
|
||||
uint32 time = 3; // Timestamp of the response
|
||||
}
|
||||
|
||||
message APPEnergyInfoMO {
|
||||
uint32 ed = 1; // Energy data
|
||||
uint32 r_time = 2; // Relative timestamp
|
||||
}
|
||||
|
||||
message AppGetHistEDReqDTO {
|
||||
int64 sn = 1; // Serial number
|
||||
int32 oft = 2; // Offset value
|
||||
uint32 time = 3; // Timestamp of the request
|
||||
repeated APPEnergyInfoMO energ = 4; // APPEnergyInfoMO data array
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: AppGetHistED.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x41ppGetHistED.proto\";\n\x12\x41ppGetHistEDResDTO\x12\n\n\x02\x63p\x18\x01 \x01(\x05\x12\x0b\n\x03oft\x18\x02 \x01(\x05\x12\x0c\n\x04time\x18\x03 \x01(\r\"-\n\x0f\x41PPEnergyInfoMO\x12\n\n\x02\x65\x64\x18\x01 \x01(\r\x12\x0e\n\x06r_time\x18\x02 \x01(\r\"\\\n\x12\x41ppGetHistEDReqDTO\x12\n\n\x02sn\x18\x01 \x01(\x03\x12\x0b\n\x03oft\x18\x02 \x01(\x05\x12\x0c\n\x04time\x18\x03 \x01(\r\x12\x1f\n\x05\x65nerg\x18\x04 \x03(\x0b\x32\x10.APPEnergyInfoMOb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'AppGetHistED_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_APPGETHISTEDRESDTO']._serialized_start=22
|
||||
_globals['_APPGETHISTEDRESDTO']._serialized_end=81
|
||||
_globals['_APPENERGYINFOMO']._serialized_start=83
|
||||
_globals['_APPENERGYINFOMO']._serialized_end=128
|
||||
_globals['_APPGETHISTEDREQDTO']._serialized_start=130
|
||||
_globals['_APPGETHISTEDREQDTO']._serialized_end=222
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,25 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message AppGetHistPowerResDTO {
|
||||
int32 control_point = 1; // Control point identifier
|
||||
int32 offset = 2; // Offset value
|
||||
uint32 requested_time = 3; // Time requested
|
||||
uint32 requested_day = 4; // Day requested
|
||||
}
|
||||
|
||||
message AppGetHistPowerReqDTO {
|
||||
int64 serial_number = 1; // Device serial number
|
||||
int32 access_point = 2; // Access point identifier
|
||||
int32 control_point = 3; // Control point identifier
|
||||
int32 offset = 4; // Offset value
|
||||
uint32 request_time = 5; // Timestamp of the request
|
||||
uint32 start_time = 6; // Start timestamp
|
||||
uint32 long_term_start = 7; // Long-term start timestamp
|
||||
uint32 absolute_start = 8; // Absolute start timestamp
|
||||
uint32 step_time = 9; // Step time
|
||||
uint32 relative_power = 10; // Relative power
|
||||
uint32 total_energy = 11; // Total energy
|
||||
uint32 daily_energy = 12; // Daily energy
|
||||
repeated int32 power_array = 13; // Array of power values
|
||||
uint32 warning_number = 14; // Warning number
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: AppGetHistPower.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x41ppGetHistPower.proto\"m\n\x15\x41ppGetHistPowerResDTO\x12\x15\n\rcontrol_point\x18\x01 \x01(\x05\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x16\n\x0erequested_time\x18\x03 \x01(\r\x12\x15\n\rrequested_day\x18\x04 \x01(\r\"\xca\x02\n\x15\x41ppGetHistPowerReqDTO\x12\x15\n\rserial_number\x18\x01 \x01(\x03\x12\x14\n\x0c\x61\x63\x63\x65ss_point\x18\x02 \x01(\x05\x12\x15\n\rcontrol_point\x18\x03 \x01(\x05\x12\x0e\n\x06offset\x18\x04 \x01(\x05\x12\x14\n\x0crequest_time\x18\x05 \x01(\r\x12\x12\n\nstart_time\x18\x06 \x01(\r\x12\x17\n\x0flong_term_start\x18\x07 \x01(\r\x12\x16\n\x0e\x61\x62solute_start\x18\x08 \x01(\r\x12\x11\n\tstep_time\x18\t \x01(\r\x12\x16\n\x0erelative_power\x18\n \x01(\r\x12\x14\n\x0ctotal_energy\x18\x0b \x01(\r\x12\x14\n\x0c\x64\x61ily_energy\x18\x0c \x01(\r\x12\x13\n\x0bpower_array\x18\r \x03(\x05\x12\x16\n\x0ewarning_number\x18\x0e \x01(\rb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'AppGetHistPower_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_APPGETHISTPOWERRESDTO']._serialized_start=25
|
||||
_globals['_APPGETHISTPOWERRESDTO']._serialized_end=134
|
||||
_globals['_APPGETHISTPOWERREQDTO']._serialized_start=137
|
||||
_globals['_APPGETHISTPOWERREQDTO']._serialized_end=467
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message AutoSearchReqDTO {
|
||||
string dtu_serial_number = 1; // DTU serial number
|
||||
int32 time = 2; // Timestamp of the request
|
||||
int32 package_number = 3; // Total number of packages
|
||||
int32 current_package = 4; // Current package number
|
||||
repeated int64 mi_serial_numbers = 5; // Array of MI (Meter Interface) serial numbers
|
||||
}
|
||||
|
||||
message AutoSearchResDTO {
|
||||
string ymd_hms = 1; // Timestamp in the format YMD_HMS
|
||||
int32 offset = 2; // Offset value
|
||||
int32 current_package = 3; // Current package number
|
||||
int32 error_code = 4; // Error code indicator
|
||||
int32 time = 5; // Timestamp of the response
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: AutoSearch.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x41utoSearch.proto\"\x87\x01\n\x10\x41utoSearchReqDTO\x12\x19\n\x11\x64tu_serial_number\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x16\n\x0epackage_number\x18\x03 \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x04 \x01(\x05\x12\x19\n\x11mi_serial_numbers\x18\x05 \x03(\x03\"n\n\x10\x41utoSearchResDTO\x12\x0f\n\x07ymd_hms\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x03 \x01(\x05\x12\x12\n\nerror_code\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'AutoSearch_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_AUTOSEARCHREQDTO']._serialized_start=21
|
||||
_globals['_AUTOSEARCHREQDTO']._serialized_end=156
|
||||
_globals['_AUTOSEARCHRESDTO']._serialized_start=158
|
||||
_globals['_AUTOSEARCHRESDTO']._serialized_end=268
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,78 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message CommandResDTO {
|
||||
int32 time = 1; // Timestamp of the response
|
||||
int32 action = 2; // Action code indicating the type of command
|
||||
int32 dev_kind = 3; // Device kind information
|
||||
int32 package_nub = 4; // Total number of packages expected
|
||||
int32 package_now = 5; // Current package number
|
||||
int64 tid = 6; // Transaction ID?
|
||||
string data = 7; // Additional data payload
|
||||
repeated string es_to_sn = 8; // List of ES serial numbers
|
||||
repeated int64 mi_to_sn = 9; // List of MI serial numbers
|
||||
int32 system_total_a = 10; // System total for category A
|
||||
int32 system_total_b = 11; // System total for category B
|
||||
int32 system_total_c = 12; // System total for category C
|
||||
repeated int64 mi_sn_item_a = 13; // List of MI serial numbers for category A
|
||||
repeated int64 mi_sn_item_b = 14; // List of MI serial numbers for category B
|
||||
repeated int64 mi_sn_item_c = 15; // List of MI serial numbers for category C
|
||||
}
|
||||
|
||||
message CommandReqDTO {
|
||||
string dtu_sn = 1; // Data Terminal Unit (DTU) serial number
|
||||
int32 time = 2; // Timestamp of the request
|
||||
int32 action = 3; // Action code indicating the type of command
|
||||
int32 package_now = 4; // Current package number
|
||||
int32 err_code = 5; // Error code (if any)
|
||||
int64 tid = 6; // Transaction ID
|
||||
}
|
||||
|
||||
message ESOperatingStatusMO {
|
||||
string es_sn = 1; // ES serial number
|
||||
int32 progress_rate = 2; // Progress rate of the operation
|
||||
}
|
||||
|
||||
message MIOperatingStatusMO {
|
||||
int64 mi_sn = 1; // MI serial number
|
||||
int32 progress_rate = 2; // Progress rate of the operation
|
||||
}
|
||||
|
||||
message MIErrorStatusMO {
|
||||
int64 mi_sn = 1; // MI serial number
|
||||
int64 error_code = 2; // Error code associated with the MI
|
||||
}
|
||||
|
||||
message ESSucStatusMO {
|
||||
string es_sn = 1; // ES serial number
|
||||
}
|
||||
|
||||
message ESErrorStatusMO {
|
||||
string es_sn = 1; // ES serial number
|
||||
int64 error_code = 2; // Error code associated with the ES
|
||||
}
|
||||
|
||||
message CommandStatusReqDTO {
|
||||
string dtu_sn = 1; // Data Terminal Unit (DTU) serial number
|
||||
int32 time = 2; // Timestamp of the request
|
||||
int32 action = 3; // Action code indicating the type of command
|
||||
int32 package_nub = 4; // Total number of packages expected
|
||||
int32 package_now = 5; // Current package number
|
||||
int64 tid = 6; // Transaction ID
|
||||
repeated string es_sns_sucs = 7; // List of ES serial numbers with successful execution
|
||||
repeated int64 mi_sns_sucs = 8; // List of MI serial numbers with successful execution
|
||||
repeated string es_sns_failds = 9; // List of ES serial numbers with failed execution
|
||||
repeated int64 mi_sns_failds = 10; // List of MI serial numbers with failed execution
|
||||
repeated ESOperatingStatusMO es_mOperatingStatus = 11; // List of ES operating statuses
|
||||
repeated MIOperatingStatusMO mi_mOperatingStatus = 12; // List of MI operating statuses
|
||||
repeated MIErrorStatusMO mi_mErrorStatus = 13; // List of MI error statuses
|
||||
repeated ESSucStatusMO es_mSucStatus = 14; // List of successful ES statuses
|
||||
repeated ESErrorStatusMO es_mErrorStatus = 15; // List of error ES statuses
|
||||
}
|
||||
|
||||
message CommandStatusResDTO {
|
||||
int32 time = 1; // Timestamp of the response
|
||||
int32 action = 2; // Action code indicating the type of command
|
||||
int32 package_now = 3; // Current package number
|
||||
int64 tid = 4; // Transaction ID
|
||||
int32 err_code = 5; // Error code (if any)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: CommandPB.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x43ommandPB.proto\"\xb2\x02\n\rCommandResDTO\x12\x0c\n\x04time\x18\x01 \x01(\x05\x12\x0e\n\x06\x61\x63tion\x18\x02 \x01(\x05\x12\x10\n\x08\x64\x65v_kind\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x04 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x05 \x01(\x05\x12\x0b\n\x03tid\x18\x06 \x01(\x03\x12\x0c\n\x04\x64\x61ta\x18\x07 \x01(\t\x12\x10\n\x08\x65s_to_sn\x18\x08 \x03(\t\x12\x10\n\x08mi_to_sn\x18\t \x03(\x03\x12\x16\n\x0esystem_total_a\x18\n \x01(\x05\x12\x16\n\x0esystem_total_b\x18\x0b \x01(\x05\x12\x16\n\x0esystem_total_c\x18\x0c \x01(\x05\x12\x14\n\x0cmi_sn_item_a\x18\r \x03(\x03\x12\x14\n\x0cmi_sn_item_b\x18\x0e \x03(\x03\x12\x14\n\x0cmi_sn_item_c\x18\x0f \x03(\x03\"q\n\rCommandReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x0e\n\x06\x61\x63tion\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x04 \x01(\x05\x12\x10\n\x08\x65rr_code\x18\x05 \x01(\x05\x12\x0b\n\x03tid\x18\x06 \x01(\x03\";\n\x13\x45SOperatingStatusMO\x12\r\n\x05\x65s_sn\x18\x01 \x01(\t\x12\x15\n\rprogress_rate\x18\x02 \x01(\x05\";\n\x13MIOperatingStatusMO\x12\r\n\x05mi_sn\x18\x01 \x01(\x03\x12\x15\n\rprogress_rate\x18\x02 \x01(\x05\"4\n\x0fMIErrorStatusMO\x12\r\n\x05mi_sn\x18\x01 \x01(\x03\x12\x12\n\nerror_code\x18\x02 \x01(\x03\"\x1e\n\rESSucStatusMO\x12\r\n\x05\x65s_sn\x18\x01 \x01(\t\"4\n\x0f\x45SErrorStatusMO\x12\r\n\x05\x65s_sn\x18\x01 \x01(\t\x12\x12\n\nerror_code\x18\x02 \x01(\x03\"\xb5\x03\n\x13\x43ommandStatusReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x0e\n\x06\x61\x63tion\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x04 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x05 \x01(\x05\x12\x0b\n\x03tid\x18\x06 \x01(\x03\x12\x13\n\x0b\x65s_sns_sucs\x18\x07 \x03(\t\x12\x13\n\x0bmi_sns_sucs\x18\x08 \x03(\x03\x12\x15\n\res_sns_failds\x18\t \x03(\t\x12\x15\n\rmi_sns_failds\x18\n \x03(\x03\x12\x31\n\x13\x65s_mOperatingStatus\x18\x0b \x03(\x0b\x32\x14.ESOperatingStatusMO\x12\x31\n\x13mi_mOperatingStatus\x18\x0c \x03(\x0b\x32\x14.MIOperatingStatusMO\x12)\n\x0fmi_mErrorStatus\x18\r \x03(\x0b\x32\x10.MIErrorStatusMO\x12%\n\res_mSucStatus\x18\x0e \x03(\x0b\x32\x0e.ESSucStatusMO\x12)\n\x0f\x65s_mErrorStatus\x18\x0f \x03(\x0b\x32\x10.ESErrorStatusMO\"g\n\x13\x43ommandStatusResDTO\x12\x0c\n\x04time\x18\x01 \x01(\x05\x12\x0e\n\x06\x61\x63tion\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x03 \x01(\x05\x12\x0b\n\x03tid\x18\x04 \x01(\x03\x12\x10\n\x08\x65rr_code\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'CommandPB_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_COMMANDRESDTO']._serialized_start=20
|
||||
_globals['_COMMANDRESDTO']._serialized_end=326
|
||||
_globals['_COMMANDREQDTO']._serialized_start=328
|
||||
_globals['_COMMANDREQDTO']._serialized_end=441
|
||||
_globals['_ESOPERATINGSTATUSMO']._serialized_start=443
|
||||
_globals['_ESOPERATINGSTATUSMO']._serialized_end=502
|
||||
_globals['_MIOPERATINGSTATUSMO']._serialized_start=504
|
||||
_globals['_MIOPERATINGSTATUSMO']._serialized_end=563
|
||||
_globals['_MIERRORSTATUSMO']._serialized_start=565
|
||||
_globals['_MIERRORSTATUSMO']._serialized_end=617
|
||||
_globals['_ESSUCSTATUSMO']._serialized_start=619
|
||||
_globals['_ESSUCSTATUSMO']._serialized_end=649
|
||||
_globals['_ESERRORSTATUSMO']._serialized_start=651
|
||||
_globals['_ESERRORSTATUSMO']._serialized_end=703
|
||||
_globals['_COMMANDSTATUSREQDTO']._serialized_start=706
|
||||
_globals['_COMMANDSTATUSREQDTO']._serialized_end=1143
|
||||
_globals['_COMMANDSTATUSRESDTO']._serialized_start=1145
|
||||
_globals['_COMMANDSTATUSRESDTO']._serialized_end=1248
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,76 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message DevConfigFetchResDTO {
|
||||
int32 response_time = 1; // Timestamp of the response
|
||||
int64 transaction_id = 2; // Transaction ID
|
||||
string dtu_sn = 3; // DTU serial number
|
||||
string dev_sn = 4; // Device serial number
|
||||
int32 current_package = 5; // Current package number
|
||||
int32 rule_type = 6; // Rule type
|
||||
}
|
||||
|
||||
message DevConfigFetchReqDTO {
|
||||
int32 request_time = 1; // Timestamp of the request
|
||||
int64 transaction_id = 2; // Transaction ID
|
||||
int32 rule_id = 3; // Rule ID
|
||||
string data = 4; // Data
|
||||
int32 crc = 5; // CRC value
|
||||
string dtu_sn = 6; // DTU serial number
|
||||
string dev_sn = 7; // Device serial number
|
||||
string cfg_data = 8; // Configuration data
|
||||
int32 cfg_crc = 9; // Configuration CRC value
|
||||
int32 total_packages = 10; // Total number of packages
|
||||
int32 current_package = 11; // Current package number
|
||||
int32 rule_type = 12; // Rule type
|
||||
}
|
||||
|
||||
message DevConfigPutResDTO {
|
||||
int32 response_time = 1; // Timestamp of the response
|
||||
int64 transaction_id = 2; // Transaction ID
|
||||
int32 rule_id = 3; // Rule ID
|
||||
string data = 4; // Data
|
||||
int32 crc = 5; // CRC value
|
||||
string dtu_sn = 6; // DTU serial number
|
||||
string dev_sn = 7; // Device serial number
|
||||
string cfg_data = 8; // Configuration data
|
||||
int32 cfg_crc = 9; // Configuration CRC value
|
||||
int32 total_packages = 10; // Total number of packages
|
||||
int32 current_package = 11; // Current package number
|
||||
repeated int64 mi_to_sn = 12; // List of MI (Meter Interface) serial numbers
|
||||
int32 rule_type = 13; // Rule type
|
||||
}
|
||||
|
||||
message DevConfigPutReqDTO {
|
||||
int32 request_time = 1; // Timestamp of the request
|
||||
int64 transaction_id = 2; // Transaction ID
|
||||
string dtu_sn = 3; // DTU serial number
|
||||
string dev_sn = 4; // Device serial number
|
||||
int32 status = 5; // Status indicator
|
||||
int32 current_package = 6; // Current package number
|
||||
repeated int64 mi_to_sn = 7; // List of MI (Meter Interface) serial numbers
|
||||
int32 rule_type = 8; // Rule type
|
||||
}
|
||||
|
||||
message DevConfigReportReqDTO {
|
||||
int32 request_time = 1; // Timestamp of the request
|
||||
int64 transaction_id = 2; // Transaction ID
|
||||
int32 rule_id = 3; // Rule ID
|
||||
string data = 4; // Data
|
||||
int32 crc = 5; // CRC value
|
||||
string dtu_sn = 6; // DTU serial number
|
||||
string dev_sn = 7; // Device serial number
|
||||
string cfg_data = 8; // Configuration data
|
||||
int32 cfg_crc = 9; // Configuration CRC value
|
||||
int32 total_packages = 10; // Total number of packages
|
||||
int32 current_package = 11; // Current package number
|
||||
int32 rule_type = 12; // Rule type
|
||||
}
|
||||
|
||||
message DevConfigReportResDTO {
|
||||
int32 response_time = 1; // Timestamp of the response
|
||||
int64 transaction_id = 2; // Transaction ID
|
||||
string dtu_sn = 3; // DTU serial number
|
||||
string dev_sn = 4; // Device serial number
|
||||
int32 current_package = 5; // Current package number
|
||||
int32 rule_type = 6; // Rule type
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: DevConfig.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x44\x65vConfig.proto\"\x91\x01\n\x14\x44\x65vConfigFetchResDTO\x12\x15\n\rresponse_time\x18\x01 \x01(\x05\x12\x16\n\x0etransaction_id\x18\x02 \x01(\x03\x12\x0e\n\x06\x64tu_sn\x18\x03 \x01(\t\x12\x0e\n\x06\x64\x65v_sn\x18\x04 \x01(\t\x12\x17\n\x0f\x63urrent_package\x18\x05 \x01(\x05\x12\x11\n\trule_type\x18\x06 \x01(\x05\"\xf7\x01\n\x14\x44\x65vConfigFetchReqDTO\x12\x14\n\x0crequest_time\x18\x01 \x01(\x05\x12\x16\n\x0etransaction_id\x18\x02 \x01(\x03\x12\x0f\n\x07rule_id\x18\x03 \x01(\x05\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x0b\n\x03\x63rc\x18\x05 \x01(\x05\x12\x0e\n\x06\x64tu_sn\x18\x06 \x01(\t\x12\x0e\n\x06\x64\x65v_sn\x18\x07 \x01(\t\x12\x10\n\x08\x63\x66g_data\x18\x08 \x01(\t\x12\x0f\n\x07\x63\x66g_crc\x18\t \x01(\x05\x12\x16\n\x0etotal_packages\x18\n \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x0b \x01(\x05\x12\x11\n\trule_type\x18\x0c \x01(\x05\"\x88\x02\n\x12\x44\x65vConfigPutResDTO\x12\x15\n\rresponse_time\x18\x01 \x01(\x05\x12\x16\n\x0etransaction_id\x18\x02 \x01(\x03\x12\x0f\n\x07rule_id\x18\x03 \x01(\x05\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x0b\n\x03\x63rc\x18\x05 \x01(\x05\x12\x0e\n\x06\x64tu_sn\x18\x06 \x01(\t\x12\x0e\n\x06\x64\x65v_sn\x18\x07 \x01(\t\x12\x10\n\x08\x63\x66g_data\x18\x08 \x01(\t\x12\x0f\n\x07\x63\x66g_crc\x18\t \x01(\x05\x12\x16\n\x0etotal_packages\x18\n \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x0b \x01(\x05\x12\x10\n\x08mi_to_sn\x18\x0c \x03(\x03\x12\x11\n\trule_type\x18\r \x01(\x05\"\xb0\x01\n\x12\x44\x65vConfigPutReqDTO\x12\x14\n\x0crequest_time\x18\x01 \x01(\x05\x12\x16\n\x0etransaction_id\x18\x02 \x01(\x03\x12\x0e\n\x06\x64tu_sn\x18\x03 \x01(\t\x12\x0e\n\x06\x64\x65v_sn\x18\x04 \x01(\t\x12\x0e\n\x06status\x18\x05 \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x06 \x01(\x05\x12\x10\n\x08mi_to_sn\x18\x07 \x03(\x03\x12\x11\n\trule_type\x18\x08 \x01(\x05\"\xf8\x01\n\x15\x44\x65vConfigReportReqDTO\x12\x14\n\x0crequest_time\x18\x01 \x01(\x05\x12\x16\n\x0etransaction_id\x18\x02 \x01(\x03\x12\x0f\n\x07rule_id\x18\x03 \x01(\x05\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x0b\n\x03\x63rc\x18\x05 \x01(\x05\x12\x0e\n\x06\x64tu_sn\x18\x06 \x01(\t\x12\x0e\n\x06\x64\x65v_sn\x18\x07 \x01(\t\x12\x10\n\x08\x63\x66g_data\x18\x08 \x01(\t\x12\x0f\n\x07\x63\x66g_crc\x18\t \x01(\x05\x12\x16\n\x0etotal_packages\x18\n \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x0b \x01(\x05\x12\x11\n\trule_type\x18\x0c \x01(\x05\"\x92\x01\n\x15\x44\x65vConfigReportResDTO\x12\x15\n\rresponse_time\x18\x01 \x01(\x05\x12\x16\n\x0etransaction_id\x18\x02 \x01(\x03\x12\x0e\n\x06\x64tu_sn\x18\x03 \x01(\t\x12\x0e\n\x06\x64\x65v_sn\x18\x04 \x01(\t\x12\x17\n\x0f\x63urrent_package\x18\x05 \x01(\x05\x12\x11\n\trule_type\x18\x06 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'DevConfig_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_DEVCONFIGFETCHRESDTO']._serialized_start=20
|
||||
_globals['_DEVCONFIGFETCHRESDTO']._serialized_end=165
|
||||
_globals['_DEVCONFIGFETCHREQDTO']._serialized_start=168
|
||||
_globals['_DEVCONFIGFETCHREQDTO']._serialized_end=415
|
||||
_globals['_DEVCONFIGPUTRESDTO']._serialized_start=418
|
||||
_globals['_DEVCONFIGPUTRESDTO']._serialized_end=682
|
||||
_globals['_DEVCONFIGPUTREQDTO']._serialized_start=685
|
||||
_globals['_DEVCONFIGPUTREQDTO']._serialized_end=861
|
||||
_globals['_DEVCONFIGREPORTREQDTO']._serialized_start=864
|
||||
_globals['_DEVCONFIGREPORTREQDTO']._serialized_end=1112
|
||||
_globals['_DEVCONFIGREPORTRESDTO']._serialized_start=1115
|
||||
_globals['_DEVCONFIGREPORTRESDTO']._serialized_end=1261
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message EventDataResDTO {
|
||||
int32 offset = 1; // Offset in the response
|
||||
int32 time = 2; // Timestamp of the response
|
||||
string time_ymd_hms = 3; // Start timestamp in YYYY-MM-DD HH:MM:SS format
|
||||
}
|
||||
|
||||
message MIEvent {
|
||||
int32 event_code = 1; // Event code
|
||||
int32 event_status = 2; // Event status
|
||||
int32 event_count = 3; // Event count
|
||||
int32 pv_voltage = 4; // PV voltage
|
||||
int32 grid_voltage = 5; // Grid voltage
|
||||
int32 grid_frequency = 6; // Grid frequency
|
||||
int32 grid_power = 7; // Grid power
|
||||
int32 temperature = 8; // Temperature
|
||||
int64 mi_id = 9; // Meter Interface (MI) ID
|
||||
int32 start_timestamp = 10; // Start timestamp
|
||||
}
|
||||
|
||||
message EventDataReqDTO {
|
||||
int32 offset = 1; // Offset in the request
|
||||
int32 time = 2; // Timestamp of the request
|
||||
repeated MIEvent mi_events = 3; // List of MI (Meter Interface) events
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: EventData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x45ventData.proto\"E\n\x0f\x45ventDataResDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x14\n\x0ctime_ymd_hms\x18\x03 \x01(\t\"\xdb\x01\n\x07MIEvent\x12\x12\n\nevent_code\x18\x01 \x01(\x05\x12\x14\n\x0c\x65vent_status\x18\x02 \x01(\x05\x12\x13\n\x0b\x65vent_count\x18\x03 \x01(\x05\x12\x12\n\npv_voltage\x18\x04 \x01(\x05\x12\x14\n\x0cgrid_voltage\x18\x05 \x01(\x05\x12\x16\n\x0egrid_frequency\x18\x06 \x01(\x05\x12\x12\n\ngrid_power\x18\x07 \x01(\x05\x12\x13\n\x0btemperature\x18\x08 \x01(\x05\x12\r\n\x05mi_id\x18\t \x01(\x03\x12\x17\n\x0fstart_timestamp\x18\n \x01(\x05\"L\n\x0f\x45ventDataReqDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x1b\n\tmi_events\x18\x03 \x03(\x0b\x32\x08.MIEventb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'EventData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_EVENTDATARESDTO']._serialized_start=19
|
||||
_globals['_EVENTDATARESDTO']._serialized_end=88
|
||||
_globals['_MIEVENT']._serialized_start=91
|
||||
_globals['_MIEVENT']._serialized_end=310
|
||||
_globals['_EVENTDATAREQDTO']._serialized_start=312
|
||||
_globals['_EVENTDATAREQDTO']._serialized_end=388
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,41 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message STValMO {
|
||||
int32 code = 1;
|
||||
int32 dflt_val = 2;
|
||||
int32 dflt_tim = 3;
|
||||
int32 rslt_val = 4;
|
||||
int32 rslt_tim = 5;
|
||||
}
|
||||
|
||||
message GPSTValMO {
|
||||
int64 pv_sn = 1;
|
||||
int32 ver = 2;
|
||||
int32 st = 3;
|
||||
int32 gpf = 4;
|
||||
int32 gpf_ver = 5;
|
||||
STValMO hv1_stval = 6;
|
||||
STValMO lv1_stval = 7;
|
||||
STValMO hv2_stval = 8;
|
||||
STValMO lv2_stval = 9;
|
||||
STValMO hf1_stval = 10;
|
||||
STValMO lf1_stval = 11;
|
||||
STValMO hf2_stval = 12;
|
||||
STValMO lf2_stval = 13;
|
||||
}
|
||||
|
||||
message GPSTReqDTO {
|
||||
string dtu_sn = 1;
|
||||
int32 time = 2;
|
||||
int32 package_nub = 3;
|
||||
int32 package_now = 4;
|
||||
repeated GPSTValMO mGPSTInfo = 5;
|
||||
}
|
||||
|
||||
message GPSTResDTO {
|
||||
string ymd_hms = 1;
|
||||
int32 offset = 2;
|
||||
int32 package_now = 3;
|
||||
int32 err_code = 4;
|
||||
int32 time = 5;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: GPSTData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eGPSTData.proto\"_\n\x07STValMO\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x10\n\x08\x64\x66lt_val\x18\x02 \x01(\x05\x12\x10\n\x08\x64\x66lt_tim\x18\x03 \x01(\x05\x12\x10\n\x08rslt_val\x18\x04 \x01(\x05\x12\x10\n\x08rslt_tim\x18\x05 \x01(\x05\"\xb9\x02\n\tGPSTValMO\x12\r\n\x05pv_sn\x18\x01 \x01(\x03\x12\x0b\n\x03ver\x18\x02 \x01(\x05\x12\n\n\x02st\x18\x03 \x01(\x05\x12\x0b\n\x03gpf\x18\x04 \x01(\x05\x12\x0f\n\x07gpf_ver\x18\x05 \x01(\x05\x12\x1b\n\thv1_stval\x18\x06 \x01(\x0b\x32\x08.STValMO\x12\x1b\n\tlv1_stval\x18\x07 \x01(\x0b\x32\x08.STValMO\x12\x1b\n\thv2_stval\x18\x08 \x01(\x0b\x32\x08.STValMO\x12\x1b\n\tlv2_stval\x18\t \x01(\x0b\x32\x08.STValMO\x12\x1b\n\thf1_stval\x18\n \x01(\x0b\x32\x08.STValMO\x12\x1b\n\tlf1_stval\x18\x0b \x01(\x0b\x32\x08.STValMO\x12\x1b\n\thf2_stval\x18\x0c \x01(\x0b\x32\x08.STValMO\x12\x1b\n\tlf2_stval\x18\r \x01(\x0b\x32\x08.STValMO\"s\n\nGPSTReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x04 \x01(\x05\x12\x1d\n\tmGPSTInfo\x18\x05 \x03(\x0b\x32\n.GPSTValMO\"b\n\nGPSTResDTO\x12\x0f\n\x07ymd_hms\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x03 \x01(\x05\x12\x10\n\x08\x65rr_code\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'GPSTData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_STVALMO']._serialized_start=18
|
||||
_globals['_STVALMO']._serialized_end=113
|
||||
_globals['_GPSTVALMO']._serialized_start=116
|
||||
_globals['_GPSTVALMO']._serialized_end=429
|
||||
_globals['_GPSTREQDTO']._serialized_start=431
|
||||
_globals['_GPSTREQDTO']._serialized_end=546
|
||||
_globals['_GPSTRESDTO']._serialized_start=548
|
||||
_globals['_GPSTRESDTO']._serialized_end=646
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,71 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message GetConfigResDTO {
|
||||
int32 offset = 1; // Offset in the response
|
||||
uint32 time = 2; // Timestamp of the response
|
||||
}
|
||||
|
||||
message GetConfigReqDTO {
|
||||
int32 request_offset = 1; // Offset in the request
|
||||
uint32 request_time = 2; // Timestamp of the request
|
||||
int32 lock_password = 3; // Lock password
|
||||
int32 lock_time = 4; // Lock time
|
||||
int32 limit_power_mypower = 5; // Limit power mypower
|
||||
int32 zero_export_433_addr = 6; // Zero export 433 address
|
||||
int32 zero_export_enable = 7; // Zero export enable
|
||||
int32 netmode_select = 8; // Netmode select
|
||||
int32 channel_select = 9; // Channel select
|
||||
int32 server_send_time = 10; // Server send time
|
||||
int32 wifi_rssi = 11; // Wifi RSSI
|
||||
int32 serverport = 12; // Server port
|
||||
string apn_set = 13; // Access Point Name (APN) set
|
||||
string meter_kind = 14; // Meter kind
|
||||
string meter_interface = 15; // Meter interface
|
||||
string wifi_ssid = 16; // Wifi SSID
|
||||
string wifi_password = 17; // Wifi password
|
||||
string server_domain_name = 18; // Server domain name
|
||||
int32 inv_type = 19; // Inverter type
|
||||
string dtu_sn = 20; // DTU serial number
|
||||
int32 access_model = 21; // Access model
|
||||
int32 mac_0 = 22; // MAC address byte 0
|
||||
int32 mac_1 = 23; // MAC address byte 1
|
||||
int32 mac_2 = 24; // MAC address byte 2
|
||||
int32 mac_3 = 25; // MAC address byte 3
|
||||
int32 dhcp_switch = 26; // DHCP switch
|
||||
int32 ip_addr_0 = 27; // IP address byte 0
|
||||
int32 ip_addr_1 = 28; // IP address byte 1
|
||||
int32 ip_addr_2 = 29; // IP address byte 2
|
||||
int32 ip_addr_3 = 30; // IP address byte 3
|
||||
int32 subnet_mask_0 = 31; // Subnet mask byte 0
|
||||
int32 subnet_mask_1 = 32; // Subnet mask byte 1
|
||||
int32 subnet_mask_2 = 33; // Subnet mask byte 2
|
||||
int32 subnet_mask_3 = 34; // Subnet mask byte 3
|
||||
int32 default_gateway_0 = 35; // Default gateway byte 0
|
||||
int32 default_gateway_1 = 36; // Default gateway byte 1
|
||||
int32 default_gateway_2 = 37; // Default gateway byte 2
|
||||
int32 default_gateway_3 = 38; // Default gateway byte 3
|
||||
string ka_nub = 39; // KA number
|
||||
string apn_name = 40; // APN name
|
||||
string apn_password = 41; // APN password
|
||||
int32 sub1g_sweep_switch = 42; // Sub1G sweep switch
|
||||
int32 sub1g_work_channel = 43; // Sub1G work channel
|
||||
int32 cable_dns_0 = 44; // Cable DNS byte 0
|
||||
int32 cable_dns_1 = 45; // Cable DNS byte 1
|
||||
int32 cable_dns_2 = 46; // Cable DNS byte 2
|
||||
int32 cable_dns_3 = 47; // Cable DNS byte 3
|
||||
int32 wifi_ip_addr_0 = 48; // Wifi IP address byte 0
|
||||
int32 wifi_ip_addr_1 = 49; // Wifi IP address byte 1
|
||||
int32 wifi_ip_addr_2 = 50; // Wifi IP address byte 2
|
||||
int32 wifi_ip_addr_3 = 51; // Wifi IP address byte 3
|
||||
int32 mac_4 = 52; // MAC address byte 4
|
||||
int32 mac_5 = 53; // MAC address byte 5
|
||||
int32 wifi_mac_0 = 54; // Wifi MAC address byte 0
|
||||
int32 wifi_mac_1 = 55; // Wifi MAC address byte 1
|
||||
int32 wifi_mac_2 = 56; // Wifi MAC address byte 2
|
||||
int32 wifi_mac_3 = 57; // Wifi MAC address byte 3
|
||||
int32 wifi_mac_4 = 58; // Wifi MAC address byte 4
|
||||
int32 wifi_mac_5 = 59; // Wifi MAC address byte 5
|
||||
string gprs_imei = 60; // GPRS IMEI
|
||||
string dtu_ap_ssid = 61; // DTU Access Point (AP) SSID
|
||||
string dtu_ap_pass = 62; // DTU AP password
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: GetConfig.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fGetConfig.proto\"/\n\x0fGetConfigResDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\r\"\xc9\n\n\x0fGetConfigReqDTO\x12\x16\n\x0erequest_offset\x18\x01 \x01(\x05\x12\x14\n\x0crequest_time\x18\x02 \x01(\r\x12\x15\n\rlock_password\x18\x03 \x01(\x05\x12\x11\n\tlock_time\x18\x04 \x01(\x05\x12\x1b\n\x13limit_power_mypower\x18\x05 \x01(\x05\x12\x1c\n\x14zero_export_433_addr\x18\x06 \x01(\x05\x12\x1a\n\x12zero_export_enable\x18\x07 \x01(\x05\x12\x16\n\x0enetmode_select\x18\x08 \x01(\x05\x12\x16\n\x0e\x63hannel_select\x18\t \x01(\x05\x12\x18\n\x10server_send_time\x18\n \x01(\x05\x12\x11\n\twifi_rssi\x18\x0b \x01(\x05\x12\x12\n\nserverport\x18\x0c \x01(\x05\x12\x0f\n\x07\x61pn_set\x18\r \x01(\t\x12\x12\n\nmeter_kind\x18\x0e \x01(\t\x12\x17\n\x0fmeter_interface\x18\x0f \x01(\t\x12\x11\n\twifi_ssid\x18\x10 \x01(\t\x12\x15\n\rwifi_password\x18\x11 \x01(\t\x12\x1a\n\x12server_domain_name\x18\x12 \x01(\t\x12\x10\n\x08inv_type\x18\x13 \x01(\x05\x12\x0e\n\x06\x64tu_sn\x18\x14 \x01(\t\x12\x14\n\x0c\x61\x63\x63\x65ss_model\x18\x15 \x01(\x05\x12\r\n\x05mac_0\x18\x16 \x01(\x05\x12\r\n\x05mac_1\x18\x17 \x01(\x05\x12\r\n\x05mac_2\x18\x18 \x01(\x05\x12\r\n\x05mac_3\x18\x19 \x01(\x05\x12\x13\n\x0b\x64hcp_switch\x18\x1a \x01(\x05\x12\x11\n\tip_addr_0\x18\x1b \x01(\x05\x12\x11\n\tip_addr_1\x18\x1c \x01(\x05\x12\x11\n\tip_addr_2\x18\x1d \x01(\x05\x12\x11\n\tip_addr_3\x18\x1e \x01(\x05\x12\x15\n\rsubnet_mask_0\x18\x1f \x01(\x05\x12\x15\n\rsubnet_mask_1\x18 \x01(\x05\x12\x15\n\rsubnet_mask_2\x18! \x01(\x05\x12\x15\n\rsubnet_mask_3\x18\" \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_0\x18# \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_1\x18$ \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_2\x18% \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_3\x18& \x01(\x05\x12\x0e\n\x06ka_nub\x18\' \x01(\t\x12\x10\n\x08\x61pn_name\x18( \x01(\t\x12\x14\n\x0c\x61pn_password\x18) \x01(\t\x12\x1a\n\x12sub1g_sweep_switch\x18* \x01(\x05\x12\x1a\n\x12sub1g_work_channel\x18+ \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_0\x18, \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_1\x18- \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_2\x18. \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_3\x18/ \x01(\x05\x12\x16\n\x0ewifi_ip_addr_0\x18\x30 \x01(\x05\x12\x16\n\x0ewifi_ip_addr_1\x18\x31 \x01(\x05\x12\x16\n\x0ewifi_ip_addr_2\x18\x32 \x01(\x05\x12\x16\n\x0ewifi_ip_addr_3\x18\x33 \x01(\x05\x12\r\n\x05mac_4\x18\x34 \x01(\x05\x12\r\n\x05mac_5\x18\x35 \x01(\x05\x12\x12\n\nwifi_mac_0\x18\x36 \x01(\x05\x12\x12\n\nwifi_mac_1\x18\x37 \x01(\x05\x12\x12\n\nwifi_mac_2\x18\x38 \x01(\x05\x12\x12\n\nwifi_mac_3\x18\x39 \x01(\x05\x12\x12\n\nwifi_mac_4\x18: \x01(\x05\x12\x12\n\nwifi_mac_5\x18; \x01(\x05\x12\x11\n\tgprs_imei\x18< \x01(\t\x12\x13\n\x0b\x64tu_ap_ssid\x18= \x01(\t\x12\x13\n\x0b\x64tu_ap_pass\x18> \x01(\tb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'GetConfig_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_GETCONFIGRESDTO']._serialized_start=19
|
||||
_globals['_GETCONFIGRESDTO']._serialized_end=66
|
||||
_globals['_GETCONFIGREQDTO']._serialized_start=69
|
||||
_globals['_GETCONFIGREQDTO']._serialized_end=1422
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,83 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message DtuInfoMO {
|
||||
int32 device_kind = 1;
|
||||
int32 dtu_sw = 2;
|
||||
int32 dtu_hw = 3;
|
||||
int32 dtu_step_time = 4;
|
||||
int32 dtu_rf_hw = 5;
|
||||
int32 dtu_rf_sw = 6;
|
||||
int32 access_model = 7;
|
||||
string gprs_vsn = 8;
|
||||
string wifi_vsn = 9;
|
||||
string ka_nub = 10;
|
||||
int32 dtu_rule_id = 11;
|
||||
int32 dtu_error_code = 12;
|
||||
int32 grid_type = 13;
|
||||
int32 zero_export_switch= 14;
|
||||
int32 surplus_power_a = 15;
|
||||
int32 surplus_power_b = 16;
|
||||
int32 surplus_power_c = 17;
|
||||
int32 zero_export_control= 18;
|
||||
int32 phase_balance_switch = 19;
|
||||
int32 tolerance_between_phases = 20;
|
||||
}
|
||||
|
||||
message MeterInfoMO {
|
||||
int32 device_kind = 1;
|
||||
int64 meter_sn = 2;
|
||||
int32 meter_model = 3;
|
||||
int32 meter_ct = 4;
|
||||
int32 com_way = 5;
|
||||
int32 access_mode = 6;
|
||||
}
|
||||
|
||||
message RpInfoMO {
|
||||
int32 device_kind = 1;
|
||||
int64 rp_sn = 2;
|
||||
int32 rp_sw = 3;
|
||||
int32 rp_hw = 4;
|
||||
int32 rp_rule_id = 5;
|
||||
}
|
||||
|
||||
message PvInfoMO {
|
||||
int32 device_kind = 1;
|
||||
int64 pv_sn = 2;
|
||||
int32 pv_usfw = 3;
|
||||
int32 pv_sw = 4;
|
||||
int32 pv_hw_pn = 5;
|
||||
int32 pv_hw = 6;
|
||||
int32 pv_gpf_code = 7;
|
||||
int32 pv_gpf = 8;
|
||||
int32 pv_rf_hw = 9;
|
||||
int32 pv_rf_sw = 10;
|
||||
int32 mi_rule_id = 11;
|
||||
}
|
||||
|
||||
message FeatureMO {
|
||||
int32 key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message InfoDataReqDTO {
|
||||
string dtu_sn = 1;
|
||||
int32 time = 2;
|
||||
int32 device_nub = 3;
|
||||
int32 pv_nub = 4;
|
||||
int32 package_nub = 5;
|
||||
int32 package_now = 6;
|
||||
int32 channel = 7;
|
||||
DtuInfoMO mDtuInfo = 8;
|
||||
repeated MeterInfoMO mMeterInfo = 9;
|
||||
repeated RpInfoMO mRpInfo = 10;
|
||||
repeated PvInfoMO mpvInfo = 11;
|
||||
repeated FeatureMO m_feature = 12;
|
||||
}
|
||||
|
||||
message InfoDataResDTO {
|
||||
string time_ymd_hms = 1;
|
||||
int32 offset = 2;
|
||||
int32 package_now = 3;
|
||||
int32 error_code = 4;
|
||||
int32 time = 5;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: InfomationData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14InfomationData.proto\"\xcb\x03\n\tDtuInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x0e\n\x06\x64tu_sw\x18\x02 \x01(\x05\x12\x0e\n\x06\x64tu_hw\x18\x03 \x01(\x05\x12\x15\n\rdtu_step_time\x18\x04 \x01(\x05\x12\x11\n\tdtu_rf_hw\x18\x05 \x01(\x05\x12\x11\n\tdtu_rf_sw\x18\x06 \x01(\x05\x12\x14\n\x0c\x61\x63\x63\x65ss_model\x18\x07 \x01(\x05\x12\x10\n\x08gprs_vsn\x18\x08 \x01(\t\x12\x10\n\x08wifi_vsn\x18\t \x01(\t\x12\x0e\n\x06ka_nub\x18\n \x01(\t\x12\x13\n\x0b\x64tu_rule_id\x18\x0b \x01(\x05\x12\x16\n\x0e\x64tu_error_code\x18\x0c \x01(\x05\x12\x11\n\tgrid_type\x18\r \x01(\x05\x12\x1a\n\x12zero_export_switch\x18\x0e \x01(\x05\x12\x17\n\x0fsurplus_power_a\x18\x0f \x01(\x05\x12\x17\n\x0fsurplus_power_b\x18\x10 \x01(\x05\x12\x17\n\x0fsurplus_power_c\x18\x11 \x01(\x05\x12\x1b\n\x13zero_export_control\x18\x12 \x01(\x05\x12\x1c\n\x14phase_balance_switch\x18\x13 \x01(\x05\x12 \n\x18tolerance_between_phases\x18\x14 \x01(\x05\"\x81\x01\n\x0bMeterInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x10\n\x08meter_sn\x18\x02 \x01(\x03\x12\x13\n\x0bmeter_model\x18\x03 \x01(\x05\x12\x10\n\x08meter_ct\x18\x04 \x01(\x05\x12\x0f\n\x07\x63om_way\x18\x05 \x01(\x05\x12\x13\n\x0b\x61\x63\x63\x65ss_mode\x18\x06 \x01(\x05\"`\n\x08RpInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\r\n\x05rp_sn\x18\x02 \x01(\x03\x12\r\n\x05rp_sw\x18\x03 \x01(\x05\x12\r\n\x05rp_hw\x18\x04 \x01(\x05\x12\x12\n\nrp_rule_id\x18\x05 \x01(\x05\"\xcc\x01\n\x08PvInfoMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\r\n\x05pv_sn\x18\x02 \x01(\x03\x12\x0f\n\x07pv_usfw\x18\x03 \x01(\x05\x12\r\n\x05pv_sw\x18\x04 \x01(\x05\x12\x10\n\x08pv_hw_pn\x18\x05 \x01(\x05\x12\r\n\x05pv_hw\x18\x06 \x01(\x05\x12\x13\n\x0bpv_gpf_code\x18\x07 \x01(\x05\x12\x0e\n\x06pv_gpf\x18\x08 \x01(\x05\x12\x10\n\x08pv_rf_hw\x18\t \x01(\x05\x12\x10\n\x08pv_rf_sw\x18\n \x01(\x05\x12\x12\n\nmi_rule_id\x18\x0b \x01(\x05\"\'\n\tFeatureMO\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\t\"\xa4\x02\n\x0eInfoDataReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x12\n\ndevice_nub\x18\x03 \x01(\x05\x12\x0e\n\x06pv_nub\x18\x04 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x05 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x06 \x01(\x05\x12\x0f\n\x07\x63hannel\x18\x07 \x01(\x05\x12\x1c\n\x08mDtuInfo\x18\x08 \x01(\x0b\x32\n.DtuInfoMO\x12 \n\nmMeterInfo\x18\t \x03(\x0b\x32\x0c.MeterInfoMO\x12\x1a\n\x07mRpInfo\x18\n \x03(\x0b\x32\t.RpInfoMO\x12\x1a\n\x07mpvInfo\x18\x0b \x03(\x0b\x32\t.PvInfoMO\x12\x1d\n\tm_feature\x18\x0c \x03(\x0b\x32\n.FeatureMO\"m\n\x0eInfoDataResDTO\x12\x14\n\x0ctime_ymd_hms\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x03 \x01(\x05\x12\x12\n\nerror_code\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'InfomationData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_DTUINFOMO']._serialized_start=25
|
||||
_globals['_DTUINFOMO']._serialized_end=484
|
||||
_globals['_METERINFOMO']._serialized_start=487
|
||||
_globals['_METERINFOMO']._serialized_end=616
|
||||
_globals['_RPINFOMO']._serialized_start=618
|
||||
_globals['_RPINFOMO']._serialized_end=714
|
||||
_globals['_PVINFOMO']._serialized_start=717
|
||||
_globals['_PVINFOMO']._serialized_end=921
|
||||
_globals['_FEATUREMO']._serialized_start=923
|
||||
_globals['_FEATUREMO']._serialized_end=962
|
||||
_globals['_INFODATAREQDTO']._serialized_start=965
|
||||
_globals['_INFODATAREQDTO']._serialized_end=1257
|
||||
_globals['_INFODATARESDTO']._serialized_start=1259
|
||||
_globals['_INFODATARESDTO']._serialized_end=1368
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message NetworkInfoReqDTO {
|
||||
string dtu_sn = 1; // DTU serial number
|
||||
uint32 time = 2; // Timestamp of the request
|
||||
int32 net_set_mod = 3; // Network setting mode
|
||||
int32 net_set_time = 4; // Network setting time
|
||||
int32 net_set_state = 5; // Network setting state
|
||||
int32 net_work_mod = 6; // Network working mode
|
||||
int32 net_work_time = 7; // Network working time
|
||||
int32 csq = 8; // Carrier Signal Quality (CSQ)
|
||||
int32 net_work_state = 9; // Network working state
|
||||
int32 ap_set_state = 10; // Access Point (AP) setting state
|
||||
}
|
||||
|
||||
message NetworkInfoResDTO {
|
||||
int32 offset = 1; // Offset value for response
|
||||
uint32 time = 2; // Timestamp of the response
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: NetworkInfo.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11NetworkInfo.proto\"\xdb\x01\n\x11NetworkInfoReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\r\x12\x13\n\x0bnet_set_mod\x18\x03 \x01(\x05\x12\x14\n\x0cnet_set_time\x18\x04 \x01(\x05\x12\x15\n\rnet_set_state\x18\x05 \x01(\x05\x12\x14\n\x0cnet_work_mod\x18\x06 \x01(\x05\x12\x15\n\rnet_work_time\x18\x07 \x01(\x05\x12\x0b\n\x03\x63sq\x18\x08 \x01(\x05\x12\x16\n\x0enet_work_state\x18\t \x01(\x05\x12\x14\n\x0c\x61p_set_state\x18\n \x01(\x05\"1\n\x11NetworkInfoResDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\rb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'NetworkInfo_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_NETWORKINFOREQDTO']._serialized_start=22
|
||||
_globals['_NETWORKINFOREQDTO']._serialized_end=241
|
||||
_globals['_NETWORKINFORESDTO']._serialized_start=243
|
||||
_globals['_NETWORKINFORESDTO']._serialized_end=292
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,78 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message MeterDataMO {
|
||||
int32 device_kind = 1; // Device kind identifier
|
||||
int64 meter_sn = 2; // Meter serial number
|
||||
int32 meter_total_power = 3; // Total power by the meter (Watts)
|
||||
int32 meter_phase_A_power = 4; // Power in phase A (Watts)
|
||||
int32 meter_phase_B_power = 5; // Power in phase B (Watts)
|
||||
int32 meter_phase_C_power = 6; // Power in phase C (Watts)
|
||||
int32 meter_factor = 7; // Meter factor
|
||||
int32 meter_total_energy =
|
||||
8; // Total energy produced by the meter (Watt-hours)
|
||||
int32 meter_phase_A_energy = 9; // Energy produced in phase A (Watt-hours)
|
||||
int32 meter_phase_B_energy = 10; // Energy produced in phase B (Watt-hours)
|
||||
int32 meter_phase_C_energy = 11; // Energy produced in phase C (Watt-hours)
|
||||
int32 meter_total_consumed = 12; // Total energy consumed (Watt-hours)
|
||||
int32 meter_phase_A_consumed = 13; // Energy consumed in phase A (Watt-hours)
|
||||
int32 meter_phase_B_consumed = 14; // Energy consumed in phase B (Watt-hours)
|
||||
int32 meter_phase_C_consumed = 15; // Energy consumed in phase C (Watt-hours)
|
||||
int32 meter_fault = 16; // Meter fault code
|
||||
}
|
||||
|
||||
message RpDataMO {
|
||||
int64 rp_sn = 1; // RP serial number
|
||||
int32 rp_signal = 2; // RP signal strength
|
||||
int32 rp_channel = 3; // RP channel number
|
||||
int32 rp_link_nub = 4; // RP link number
|
||||
int32 rp_link_status = 5; // RP link status
|
||||
}
|
||||
|
||||
message PvDataMO {
|
||||
int64 pv_sn = 1; // PV serial number
|
||||
int32 pv_port = 2; // PV port number
|
||||
int32 pv_vol = 3; // PV voltage (Volts)
|
||||
int32 pv_cur = 4; // PV current (Amperes)
|
||||
int32 pv_power = 5; // PV power (Watts)
|
||||
int32 pv_energy_total = 6; // Total energy generated by PV (Watt-hours)
|
||||
int32 grid_vol = 7; // Grid voltage (Volts)
|
||||
int32 grid_vol_max = 8; // Maximum grid voltage (Volts)
|
||||
int32 grid_freq = 9; // Grid frequency (Hertz)
|
||||
int32 grid_p = 10; // Grid active power (Watts)
|
||||
int32 grid_q = 11; // Grid reactive power (VAR)
|
||||
int32 grid_i = 12; // Grid current (Amperes)
|
||||
int32 grid_pf = 13; // Grid power factor
|
||||
int32 pv_temp = 14; // PV temperature
|
||||
int32 pv_run_status = 15; // PV running status
|
||||
int32 pv_fault_num = 16; // PV fault number
|
||||
int32 pv_fault_cnt = 17; // PV fault count
|
||||
int32 pv_warning_cnt = 18; // PV warning count
|
||||
int32 pv_link_status = 19; // PV link status
|
||||
int32 pv_send_power = 20; // PV send power (Watts)
|
||||
int32 pv_receive_power = 21; // PV received power (Watts)
|
||||
int32 pv_time = 22; // PV time
|
||||
int32 pv_energy = 23; // PV energy (Watt-hours)
|
||||
int32 mi_signal = 24; // Modulation index signal
|
||||
}
|
||||
|
||||
message RealDataReqDTO {
|
||||
string dtu_sn = 1; // DTU serial number
|
||||
int32 timestamp = 2; // Timestamp of the data
|
||||
int32 device_number = 3; // Device number
|
||||
int32 pv_number = 4; // PV number
|
||||
int32 package_number = 5; // Package number
|
||||
int32 current_package = 6; // Current package number
|
||||
int32 csq = 7; // Carrier Signal Quality (CSQ)
|
||||
repeated MeterDataMO meter_data = 8; // Meter data array
|
||||
repeated RpDataMO rp_data = 9; // RpDataMO data array
|
||||
repeated PvDataMO pv_data = 10; // PvDataMO data array
|
||||
int32 version = 11; // Version number
|
||||
}
|
||||
|
||||
message RealDataResDTO {
|
||||
string time_ymd_hms = 1; // Timestamp in the format YMD_HMS
|
||||
int32 package_now = 2; // Package now
|
||||
int32 error_code = 3; // Error code indicator
|
||||
int32 offset = 4; // Offset value
|
||||
int32 time = 5; // Timestamp value
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message MeterMO {
|
||||
int32 device_type = 1; // Device type identifier
|
||||
int64 serial_number = 2; // Serial number of the meter
|
||||
int32 phase_total_power = 3; // Total power across all phases (Watts)
|
||||
int32 phase_A_power = 4; // Power in phase A (Watts)
|
||||
int32 phase_B_power = 5; // Power in phase B (Watts)
|
||||
int32 phase_C_power = 6; // Power in phase C (Watts)
|
||||
int32 power_factor_total = 7; // Total power factor
|
||||
int32 energy_total_power = 8; // Total energy generated (Watt-hours)
|
||||
int32 energy_phase_A = 9; // Energy generated in phase A (Watt-hours)
|
||||
int32 energy_phase_B = 10; // Energy generated in phase B (Watt-hours)
|
||||
int32 energy_phase_C = 11; // Energy generated in phase C (Watt-hours)
|
||||
int32 energy_total_consumed = 12; // Total energy consumed (Watt-hours)
|
||||
int32 energy_phase_A_consumed = 13; // Energy consumed in phase A (Watt-hours)
|
||||
int32 energy_phase_B_consumed = 14; // Energy consumed in phase B (Watt-hours)
|
||||
int32 energy_phase_C_consumed = 15; // Energy consumed in phase C (Watt-hours)
|
||||
int32 fault_code = 16; // Fault code indicator
|
||||
int32 voltage_phase_A = 17; // Voltage in phase A (Volts)
|
||||
int32 voltage_phase_B = 18; // Voltage in phase B (Volts)
|
||||
int32 voltage_phase_C = 19; // Voltage in phase C (Volts)
|
||||
int32 current_phase_A = 20; // Current in phase A (Amperes)
|
||||
int32 current_phase_B = 21; // Current in phase B (Amperes)
|
||||
int32 current_phase_C = 22; // Current in phase C (Amperes)
|
||||
int32 power_factor_phase_A = 23; // Power factor in phase A
|
||||
int32 power_factor_phase_B = 24; // Power factor in phase B
|
||||
int32 power_factor_phase_C = 25; // Power factor in phase C
|
||||
}
|
||||
|
||||
message RpMO {
|
||||
int64 serial_number = 1; // Serial number of the device
|
||||
int32 signature = 2; // Signature value
|
||||
int32 channel = 3; // Channel number
|
||||
int32 pv_number = 4; // Photovoltaic (PV) number
|
||||
int32 link_status = 5; // Link status indicator
|
||||
}
|
||||
|
||||
message RSDMO {
|
||||
int64 serial_number = 1; // Serial number of the device
|
||||
int32 firmware_version = 2; // Firmware version
|
||||
int32 voltage = 3; // Voltage value
|
||||
int32 power = 4; // Power value
|
||||
int32 temperature = 5; // Temperature value
|
||||
int32 warning_number = 6; // Warning number
|
||||
int32 crc_checksum = 7; // CRC checksum
|
||||
int32 link_status = 8; // Link status indicator
|
||||
}
|
||||
|
||||
message SGSMO {
|
||||
int64 serial_number = 1; // Serial number of the device
|
||||
int32 firmware_version = 2; // Firmware version
|
||||
int32 voltage = 3; // Grid voltage (Volts)
|
||||
int32 frequency = 4; // Grid frequency (Hertz)
|
||||
int32 active_power = 5; // Active power (Watts)
|
||||
int32 reactive_power = 6; // Reactive power (VAR)
|
||||
int32 current = 7; // Current (Amperes)
|
||||
int32 power_factor = 8; // Power factor
|
||||
int32 temperature = 9; // Temperature value
|
||||
int32 warning_number = 10; // Warning number
|
||||
int32 crc_checksum = 11; // CRC checksum
|
||||
int32 link_status = 12; // Link status indicator
|
||||
int32 power_limit = 13; // Power limit (Watts)
|
||||
int32 modulation_index_signal = 20; // Modulation index signal
|
||||
}
|
||||
|
||||
message TGSMO {
|
||||
int64 serial_number = 1; // Serial number of the device
|
||||
int32 firmware_version = 2; // Firmware version
|
||||
int32 voltage_phase_A = 3; // Voltage in phase A (Volts)
|
||||
int32 voltage_phase_B = 4; // Voltage in phase B (Volts)
|
||||
int32 voltage_phase_C = 5; // Voltage in phase C (Volts)
|
||||
int32 voltage_line_AB = 6; // Voltage between lines A and B (Volts)
|
||||
int32 voltage_line_BC = 7; // Voltage between lines B and C (Volts)
|
||||
int32 voltage_line_CA = 8; // Voltage between lines C and A (Volts)
|
||||
int32 frequency = 9; // Frequency (Hertz)
|
||||
int32 active_power = 10; // Active power (Watts)
|
||||
int32 reactive_power = 11; // Reactive power (VAR)
|
||||
int32 current_phase_A = 12; // Current in phase A (Amperes)
|
||||
int32 current_phase_B = 13; // Current in phase B (Amperes)
|
||||
int32 current_phase_C = 14; // Current in phase C (Amperes)
|
||||
int32 power_factor = 15; // Power factor
|
||||
int32 temperature = 16; // Temperature value
|
||||
int32 warning_number = 17; // Warning number
|
||||
int32 crc_checksum = 18; // CRC checksum
|
||||
int32 link_status = 19; // Link status indicator
|
||||
int32 modulation_index_signal = 20; // Modulation index signal
|
||||
}
|
||||
|
||||
message PvMO {
|
||||
int64 serial_number = 1; // Serial number of the device
|
||||
int32 port_number = 2; // Port number
|
||||
int32 voltage = 3; // Voltage (Volts)
|
||||
int32 current = 4; // Current (Amperes)
|
||||
int32 power = 5; // Power (Watts)
|
||||
int32 energy_total = 6; // Total energy generated (Watt-hours)
|
||||
int32 energy_daily = 7; // Daily energy generated (Watt-hours)
|
||||
int32 error_code = 8; // Error code indicator
|
||||
}
|
||||
|
||||
message RealDataNewReqDTO {
|
||||
string device_serial_number = 1; // Serial number of the device
|
||||
int32 timestamp = 2; // Timestamp of the data
|
||||
int32 active_power = 3; // Active power (Watts)
|
||||
int32 cp = 4; // Control parameter?
|
||||
int32 firmware_version = 5; // Firmware version
|
||||
repeated MeterMO meter_data = 6; // Meter data array
|
||||
repeated RpMO rp_data = 7; // RpMO data array
|
||||
repeated RSDMO rsd_data = 8; // RSDMO data array
|
||||
repeated SGSMO sgs_data = 9; // SGSMO data array
|
||||
repeated TGSMO tgs_data = 10; // TGSMO data array
|
||||
repeated PvMO pv_data = 11; // PvMO data array
|
||||
uint64 dtu_power = 12; // Power of the DTU (Watts)
|
||||
uint64 dtu_daily_energy = 13; // Daily energy of the DTU (Watt-hours)
|
||||
}
|
||||
|
||||
message RealDataNewResDTO {
|
||||
string time_ymd_hms = 1; // Timestamp in the format YMD_HMS
|
||||
int32 cp = 2; // Control parameter?
|
||||
int32 error_code = 3; // Error code indicator
|
||||
int32 offset = 4; // Offset value
|
||||
int32 time = 5; // Timestamp value
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: RealDataNew.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11RealDataNew.proto\"\x9b\x05\n\x07MeterMO\x12\x13\n\x0b\x64\x65vice_type\x18\x01 \x01(\x05\x12\x15\n\rserial_number\x18\x02 \x01(\x03\x12\x19\n\x11phase_total_power\x18\x03 \x01(\x05\x12\x15\n\rphase_A_power\x18\x04 \x01(\x05\x12\x15\n\rphase_B_power\x18\x05 \x01(\x05\x12\x15\n\rphase_C_power\x18\x06 \x01(\x05\x12\x1a\n\x12power_factor_total\x18\x07 \x01(\x05\x12\x1a\n\x12\x65nergy_total_power\x18\x08 \x01(\x05\x12\x16\n\x0e\x65nergy_phase_A\x18\t \x01(\x05\x12\x16\n\x0e\x65nergy_phase_B\x18\n \x01(\x05\x12\x16\n\x0e\x65nergy_phase_C\x18\x0b \x01(\x05\x12\x1d\n\x15\x65nergy_total_consumed\x18\x0c \x01(\x05\x12\x1f\n\x17\x65nergy_phase_A_consumed\x18\r \x01(\x05\x12\x1f\n\x17\x65nergy_phase_B_consumed\x18\x0e \x01(\x05\x12\x1f\n\x17\x65nergy_phase_C_consumed\x18\x0f \x01(\x05\x12\x12\n\nfault_code\x18\x10 \x01(\x05\x12\x17\n\x0fvoltage_phase_A\x18\x11 \x01(\x05\x12\x17\n\x0fvoltage_phase_B\x18\x12 \x01(\x05\x12\x17\n\x0fvoltage_phase_C\x18\x13 \x01(\x05\x12\x17\n\x0f\x63urrent_phase_A\x18\x14 \x01(\x05\x12\x17\n\x0f\x63urrent_phase_B\x18\x15 \x01(\x05\x12\x17\n\x0f\x63urrent_phase_C\x18\x16 \x01(\x05\x12\x1c\n\x14power_factor_phase_A\x18\x17 \x01(\x05\x12\x1c\n\x14power_factor_phase_B\x18\x18 \x01(\x05\x12\x1c\n\x14power_factor_phase_C\x18\x19 \x01(\x05\"i\n\x04RpMO\x12\x15\n\rserial_number\x18\x01 \x01(\x03\x12\x11\n\tsignature\x18\x02 \x01(\x05\x12\x0f\n\x07\x63hannel\x18\x03 \x01(\x05\x12\x11\n\tpv_number\x18\x04 \x01(\x05\x12\x13\n\x0blink_status\x18\x05 \x01(\x05\"\xb0\x01\n\x05RSDMO\x12\x15\n\rserial_number\x18\x01 \x01(\x03\x12\x18\n\x10\x66irmware_version\x18\x02 \x01(\x05\x12\x0f\n\x07voltage\x18\x03 \x01(\x05\x12\r\n\x05power\x18\x04 \x01(\x05\x12\x13\n\x0btemperature\x18\x05 \x01(\x05\x12\x16\n\x0ewarning_number\x18\x06 \x01(\x05\x12\x14\n\x0c\x63rc_checksum\x18\x07 \x01(\x05\x12\x13\n\x0blink_status\x18\x08 \x01(\x05\"\xbf\x02\n\x05SGSMO\x12\x15\n\rserial_number\x18\x01 \x01(\x03\x12\x18\n\x10\x66irmware_version\x18\x02 \x01(\x05\x12\x0f\n\x07voltage\x18\x03 \x01(\x05\x12\x11\n\tfrequency\x18\x04 \x01(\x05\x12\x14\n\x0c\x61\x63tive_power\x18\x05 \x01(\x05\x12\x16\n\x0ereactive_power\x18\x06 \x01(\x05\x12\x0f\n\x07\x63urrent\x18\x07 \x01(\x05\x12\x14\n\x0cpower_factor\x18\x08 \x01(\x05\x12\x13\n\x0btemperature\x18\t \x01(\x05\x12\x16\n\x0ewarning_number\x18\n \x01(\x05\x12\x14\n\x0c\x63rc_checksum\x18\x0b \x01(\x05\x12\x13\n\x0blink_status\x18\x0c \x01(\x05\x12\x13\n\x0bpower_limit\x18\r \x01(\x05\x12\x1f\n\x17modulation_index_signal\x18\x14 \x01(\x05\"\xe9\x03\n\x05TGSMO\x12\x15\n\rserial_number\x18\x01 \x01(\x03\x12\x18\n\x10\x66irmware_version\x18\x02 \x01(\x05\x12\x17\n\x0fvoltage_phase_A\x18\x03 \x01(\x05\x12\x17\n\x0fvoltage_phase_B\x18\x04 \x01(\x05\x12\x17\n\x0fvoltage_phase_C\x18\x05 \x01(\x05\x12\x17\n\x0fvoltage_line_AB\x18\x06 \x01(\x05\x12\x17\n\x0fvoltage_line_BC\x18\x07 \x01(\x05\x12\x17\n\x0fvoltage_line_CA\x18\x08 \x01(\x05\x12\x11\n\tfrequency\x18\t \x01(\x05\x12\x14\n\x0c\x61\x63tive_power\x18\n \x01(\x05\x12\x16\n\x0ereactive_power\x18\x0b \x01(\x05\x12\x17\n\x0f\x63urrent_phase_A\x18\x0c \x01(\x05\x12\x17\n\x0f\x63urrent_phase_B\x18\r \x01(\x05\x12\x17\n\x0f\x63urrent_phase_C\x18\x0e \x01(\x05\x12\x14\n\x0cpower_factor\x18\x0f \x01(\x05\x12\x13\n\x0btemperature\x18\x10 \x01(\x05\x12\x16\n\x0ewarning_number\x18\x11 \x01(\x05\x12\x14\n\x0c\x63rc_checksum\x18\x12 \x01(\x05\x12\x13\n\x0blink_status\x18\x13 \x01(\x05\x12\x1f\n\x17modulation_index_signal\x18\x14 \x01(\x05\"\xa3\x01\n\x04PvMO\x12\x15\n\rserial_number\x18\x01 \x01(\x03\x12\x13\n\x0bport_number\x18\x02 \x01(\x05\x12\x0f\n\x07voltage\x18\x03 \x01(\x05\x12\x0f\n\x07\x63urrent\x18\x04 \x01(\x05\x12\r\n\x05power\x18\x05 \x01(\x05\x12\x14\n\x0c\x65nergy_total\x18\x06 \x01(\x05\x12\x14\n\x0c\x65nergy_daily\x18\x07 \x01(\x05\x12\x12\n\nerror_code\x18\x08 \x01(\x05\"\xc9\x02\n\x11RealDataNewReqDTO\x12\x1c\n\x14\x64\x65vice_serial_number\x18\x01 \x01(\t\x12\x11\n\ttimestamp\x18\x02 \x01(\x05\x12\x14\n\x0c\x61\x63tive_power\x18\x03 \x01(\x05\x12\n\n\x02\x63p\x18\x04 \x01(\x05\x12\x18\n\x10\x66irmware_version\x18\x05 \x01(\x05\x12\x1c\n\nmeter_data\x18\x06 \x03(\x0b\x32\x08.MeterMO\x12\x16\n\x07rp_data\x18\x07 \x03(\x0b\x32\x05.RpMO\x12\x18\n\x08rsd_data\x18\x08 \x03(\x0b\x32\x06.RSDMO\x12\x18\n\x08sgs_data\x18\t \x03(\x0b\x32\x06.SGSMO\x12\x18\n\x08tgs_data\x18\n \x03(\x0b\x32\x06.TGSMO\x12\x16\n\x07pv_data\x18\x0b \x03(\x0b\x32\x05.PvMO\x12\x11\n\tdtu_power\x18\x0c \x01(\x04\x12\x18\n\x10\x64tu_daily_energy\x18\r \x01(\x04\"g\n\x11RealDataNewResDTO\x12\x14\n\x0ctime_ymd_hms\x18\x01 \x01(\t\x12\n\n\x02\x63p\x18\x02 \x01(\x05\x12\x12\n\nerror_code\x18\x03 \x01(\x05\x12\x0e\n\x06offset\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'RealDataNew_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_METERMO']._serialized_start=22
|
||||
_globals['_METERMO']._serialized_end=689
|
||||
_globals['_RPMO']._serialized_start=691
|
||||
_globals['_RPMO']._serialized_end=796
|
||||
_globals['_RSDMO']._serialized_start=799
|
||||
_globals['_RSDMO']._serialized_end=975
|
||||
_globals['_SGSMO']._serialized_start=978
|
||||
_globals['_SGSMO']._serialized_end=1297
|
||||
_globals['_TGSMO']._serialized_start=1300
|
||||
_globals['_TGSMO']._serialized_end=1789
|
||||
_globals['_PVMO']._serialized_start=1792
|
||||
_globals['_PVMO']._serialized_end=1955
|
||||
_globals['_REALDATANEWREQDTO']._serialized_start=1958
|
||||
_globals['_REALDATANEWREQDTO']._serialized_end=2287
|
||||
_globals['_REALDATANEWRESDTO']._serialized_start=2289
|
||||
_globals['_REALDATANEWRESDTO']._serialized_end=2392
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: RealData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eRealData.proto\"\xc5\x03\n\x0bMeterDataMO\x12\x13\n\x0b\x64\x65vice_kind\x18\x01 \x01(\x05\x12\x10\n\x08meter_sn\x18\x02 \x01(\x03\x12\x19\n\x11meter_total_power\x18\x03 \x01(\x05\x12\x1b\n\x13meter_phase_A_power\x18\x04 \x01(\x05\x12\x1b\n\x13meter_phase_B_power\x18\x05 \x01(\x05\x12\x1b\n\x13meter_phase_C_power\x18\x06 \x01(\x05\x12\x14\n\x0cmeter_factor\x18\x07 \x01(\x05\x12\x1a\n\x12meter_total_energy\x18\x08 \x01(\x05\x12\x1c\n\x14meter_phase_A_energy\x18\t \x01(\x05\x12\x1c\n\x14meter_phase_B_energy\x18\n \x01(\x05\x12\x1c\n\x14meter_phase_C_energy\x18\x0b \x01(\x05\x12\x1c\n\x14meter_total_consumed\x18\x0c \x01(\x05\x12\x1e\n\x16meter_phase_A_consumed\x18\r \x01(\x05\x12\x1e\n\x16meter_phase_B_consumed\x18\x0e \x01(\x05\x12\x1e\n\x16meter_phase_C_consumed\x18\x0f \x01(\x05\x12\x13\n\x0bmeter_fault\x18\x10 \x01(\x05\"m\n\x08RpDataMO\x12\r\n\x05rp_sn\x18\x01 \x01(\x03\x12\x11\n\trp_signal\x18\x02 \x01(\x05\x12\x12\n\nrp_channel\x18\x03 \x01(\x05\x12\x13\n\x0brp_link_nub\x18\x04 \x01(\x05\x12\x16\n\x0erp_link_status\x18\x05 \x01(\x05\"\xdd\x03\n\x08PvDataMO\x12\r\n\x05pv_sn\x18\x01 \x01(\x03\x12\x0f\n\x07pv_port\x18\x02 \x01(\x05\x12\x0e\n\x06pv_vol\x18\x03 \x01(\x05\x12\x0e\n\x06pv_cur\x18\x04 \x01(\x05\x12\x10\n\x08pv_power\x18\x05 \x01(\x05\x12\x17\n\x0fpv_energy_total\x18\x06 \x01(\x05\x12\x10\n\x08grid_vol\x18\x07 \x01(\x05\x12\x14\n\x0cgrid_vol_max\x18\x08 \x01(\x05\x12\x11\n\tgrid_freq\x18\t \x01(\x05\x12\x0e\n\x06grid_p\x18\n \x01(\x05\x12\x0e\n\x06grid_q\x18\x0b \x01(\x05\x12\x0e\n\x06grid_i\x18\x0c \x01(\x05\x12\x0f\n\x07grid_pf\x18\r \x01(\x05\x12\x0f\n\x07pv_temp\x18\x0e \x01(\x05\x12\x15\n\rpv_run_status\x18\x0f \x01(\x05\x12\x14\n\x0cpv_fault_num\x18\x10 \x01(\x05\x12\x14\n\x0cpv_fault_cnt\x18\x11 \x01(\x05\x12\x16\n\x0epv_warning_cnt\x18\x12 \x01(\x05\x12\x16\n\x0epv_link_status\x18\x13 \x01(\x05\x12\x15\n\rpv_send_power\x18\x14 \x01(\x05\x12\x18\n\x10pv_receive_power\x18\x15 \x01(\x05\x12\x0f\n\x07pv_time\x18\x16 \x01(\x05\x12\x11\n\tpv_energy\x18\x17 \x01(\x05\x12\x11\n\tmi_signal\x18\x18 \x01(\x05\"\x86\x02\n\x0eRealDataReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x11\n\ttimestamp\x18\x02 \x01(\x05\x12\x15\n\rdevice_number\x18\x03 \x01(\x05\x12\x11\n\tpv_number\x18\x04 \x01(\x05\x12\x16\n\x0epackage_number\x18\x05 \x01(\x05\x12\x17\n\x0f\x63urrent_package\x18\x06 \x01(\x05\x12\x0b\n\x03\x63sq\x18\x07 \x01(\x05\x12 \n\nmeter_data\x18\x08 \x03(\x0b\x32\x0c.MeterDataMO\x12\x1a\n\x07rp_data\x18\t \x03(\x0b\x32\t.RpDataMO\x12\x1a\n\x07pv_data\x18\n \x03(\x0b\x32\t.PvDataMO\x12\x0f\n\x07version\x18\x0b \x01(\x05\"d\n\x0eRealDataResDTO\x12\x14\n\x0ctime_ymd_hms\x18\x01 \x01(\t\x12\n\n\x02\x63p\x18\x02 \x01(\x05\x12\x12\n\nerror_code\x18\x03 \x01(\x05\x12\x0e\n\x06offset\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'RealData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_METERDATAMO']._serialized_start=19
|
||||
_globals['_METERDATAMO']._serialized_end=472
|
||||
_globals['_RPDATAMO']._serialized_start=474
|
||||
_globals['_RPDATAMO']._serialized_end=583
|
||||
_globals['_PVDATAMO']._serialized_start=586
|
||||
_globals['_PVDATAMO']._serialized_end=1063
|
||||
_globals['_REALDATAREQDTO']._serialized_start=1066
|
||||
_globals['_REALDATAREQDTO']._serialized_end=1328
|
||||
_globals['_REALDATARESDTO']._serialized_start=1330
|
||||
_globals['_REALDATARESDTO']._serialized_end=1430
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,62 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// Definition of the response message for setting configuration.
|
||||
message SetConfigResDTO {
|
||||
int32 offset = 1; // Offset value
|
||||
uint32 time = 2; // Time value
|
||||
int32 lock_password = 3; // Lock password
|
||||
int32 lock_time = 4; // Lock time
|
||||
int32 limit_power_mypower = 5; // Limit power for mypower
|
||||
int32 zero_export_433_addr = 6; // Zero export 433 address
|
||||
int32 zero_export_enable = 7; // Zero export enable flag
|
||||
int32 netmode_select = 8; // Network mode selection
|
||||
int32 channel_select = 9; // Channel selection
|
||||
int32 server_send_time = 10; // Server send time
|
||||
int32 serverport = 11; // Server port
|
||||
string apn_set = 12; // Access Point Name (APN) setting
|
||||
string meter_kind = 13; // Meter kind
|
||||
string meter_interface = 14; // Meter interface
|
||||
string wifi_ssid = 15; // Wi-Fi SSID
|
||||
string wifi_password = 16; // Wi-Fi password
|
||||
string server_domain_name = 17; // Server domain name
|
||||
int32 inv_type = 18; // Inverter type
|
||||
string dtu_sn = 19; // Data Terminal Unit (DTU) serial number
|
||||
int32 access_model = 20; // Access model
|
||||
int32 mac_0 = 21; // MAC address octet 0
|
||||
int32 mac_1 = 22; // MAC address octet 1
|
||||
int32 mac_2 = 23; // MAC address octet 2
|
||||
int32 mac_3 = 24; // MAC address octet 3
|
||||
int32 dhcp_switch = 25; // DHCP switch
|
||||
int32 ip_addr_0 = 26; // IP address octet 0
|
||||
int32 ip_addr_1 = 27; // IP address octet 1
|
||||
int32 ip_addr_2 = 28; // IP address octet 2
|
||||
int32 ip_addr_3 = 29; // IP address octet 3
|
||||
int32 subnet_mask_0 = 30; // Subnet mask octet 0
|
||||
int32 subnet_mask_1 = 31; // Subnet mask octet 1
|
||||
int32 subnet_mask_2 = 32; // Subnet mask octet 2
|
||||
int32 subnet_mask_3 = 33; // Subnet mask octet 3
|
||||
int32 default_gateway_0 = 34; // Default gateway octet 0
|
||||
int32 default_gateway_1 = 35; // Default gateway octet 1
|
||||
int32 default_gateway_2 = 36; // Default gateway octet 2
|
||||
int32 default_gateway_3 = 37; // Default gateway octet 3
|
||||
string apn_name = 38; // APN name
|
||||
string apn_password = 39; // APN password
|
||||
int32 sub1g_sweep_switch = 40; // Sub-1GHz sweep switch
|
||||
int32 sub1g_work_channel = 41; // Sub-1GHz work channel
|
||||
int32 cable_dns_0 = 42; // Cable DNS octet 0
|
||||
int32 cable_dns_1 = 43; // Cable DNS octet 1
|
||||
int32 cable_dns_2 = 44; // Cable DNS octet 2
|
||||
int32 cable_dns_3 = 45; // Cable DNS octet 3
|
||||
int32 mac_4 = 46; // MAC address octet 4
|
||||
int32 mac_5 = 47; // MAC address octet 5
|
||||
string dtu_ap_ssid = 48; // DTU AP SSID
|
||||
string dtu_ap_pass = 49; // DTU AP password
|
||||
int32 app_page = 50; // App page
|
||||
}
|
||||
|
||||
// Definition of the request message for setting configuration.
|
||||
message SetConfigReqDTO {
|
||||
int32 offset = 1; // Offset value
|
||||
uint32 time = 2; // Time value
|
||||
int32 error_code = 3; // Error code
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: SetConfig.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fSetConfig.proto\"\xbd\x08\n\x0fSetConfigResDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\r\x12\x15\n\rlock_password\x18\x03 \x01(\x05\x12\x11\n\tlock_time\x18\x04 \x01(\x05\x12\x1b\n\x13limit_power_mypower\x18\x05 \x01(\x05\x12\x1c\n\x14zero_export_433_addr\x18\x06 \x01(\x05\x12\x1a\n\x12zero_export_enable\x18\x07 \x01(\x05\x12\x16\n\x0enetmode_select\x18\x08 \x01(\x05\x12\x16\n\x0e\x63hannel_select\x18\t \x01(\x05\x12\x18\n\x10server_send_time\x18\n \x01(\x05\x12\x12\n\nserverport\x18\x0b \x01(\x05\x12\x0f\n\x07\x61pn_set\x18\x0c \x01(\t\x12\x12\n\nmeter_kind\x18\r \x01(\t\x12\x17\n\x0fmeter_interface\x18\x0e \x01(\t\x12\x11\n\twifi_ssid\x18\x0f \x01(\t\x12\x15\n\rwifi_password\x18\x10 \x01(\t\x12\x1a\n\x12server_domain_name\x18\x11 \x01(\t\x12\x10\n\x08inv_type\x18\x12 \x01(\x05\x12\x0e\n\x06\x64tu_sn\x18\x13 \x01(\t\x12\x14\n\x0c\x61\x63\x63\x65ss_model\x18\x14 \x01(\x05\x12\r\n\x05mac_0\x18\x15 \x01(\x05\x12\r\n\x05mac_1\x18\x16 \x01(\x05\x12\r\n\x05mac_2\x18\x17 \x01(\x05\x12\r\n\x05mac_3\x18\x18 \x01(\x05\x12\x13\n\x0b\x64hcp_switch\x18\x19 \x01(\x05\x12\x11\n\tip_addr_0\x18\x1a \x01(\x05\x12\x11\n\tip_addr_1\x18\x1b \x01(\x05\x12\x11\n\tip_addr_2\x18\x1c \x01(\x05\x12\x11\n\tip_addr_3\x18\x1d \x01(\x05\x12\x15\n\rsubnet_mask_0\x18\x1e \x01(\x05\x12\x15\n\rsubnet_mask_1\x18\x1f \x01(\x05\x12\x15\n\rsubnet_mask_2\x18 \x01(\x05\x12\x15\n\rsubnet_mask_3\x18! \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_0\x18\" \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_1\x18# \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_2\x18$ \x01(\x05\x12\x19\n\x11\x64\x65\x66\x61ult_gateway_3\x18% \x01(\x05\x12\x10\n\x08\x61pn_name\x18& \x01(\t\x12\x14\n\x0c\x61pn_password\x18\' \x01(\t\x12\x1a\n\x12sub1g_sweep_switch\x18( \x01(\x05\x12\x1a\n\x12sub1g_work_channel\x18) \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_0\x18* \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_1\x18+ \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_2\x18, \x01(\x05\x12\x13\n\x0b\x63\x61\x62le_dns_3\x18- \x01(\x05\x12\r\n\x05mac_4\x18. \x01(\x05\x12\r\n\x05mac_5\x18/ \x01(\x05\x12\x13\n\x0b\x64tu_ap_ssid\x18\x30 \x01(\t\x12\x13\n\x0b\x64tu_ap_pass\x18\x31 \x01(\t\x12\x10\n\x08\x61pp_page\x18\x32 \x01(\x05\"C\n\x0fSetConfigReqDTO\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\x0c\n\x04time\x18\x02 \x01(\r\x12\x12\n\nerror_code\x18\x03 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'SetConfig_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_SETCONFIGRESDTO']._serialized_start=20
|
||||
_globals['_SETCONFIGRESDTO']._serialized_end=1105
|
||||
_globals['_SETCONFIGREQDTO']._serialized_start=1107
|
||||
_globals['_SETCONFIGREQDTO']._serialized_end=1174
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,50 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message WarnReqDTO {
|
||||
string dtu_sn = 1;
|
||||
int32 time = 2;
|
||||
int32 package_nub = 3;
|
||||
int32 package_now = 4;
|
||||
int32 warn_device = 5;
|
||||
repeated WarnMO warns = 6;
|
||||
}
|
||||
|
||||
message WarnMO {
|
||||
int64 pv_sn = 1;
|
||||
int32 code = 2;
|
||||
int32 num = 3;
|
||||
int32 s_time = 4;
|
||||
int32 e_time = 5;
|
||||
int32 w_data1 = 6;
|
||||
int32 w_data2 = 7;
|
||||
}
|
||||
|
||||
message WarnResDTO {
|
||||
string ymd_hms = 1;
|
||||
int32 package_now = 2;
|
||||
int32 err_code = 3;
|
||||
int32 offset = 4;
|
||||
int32 time = 5;
|
||||
}
|
||||
|
||||
message WaveReqDTO {
|
||||
string dtu_sn = 1;
|
||||
int32 time = 2;
|
||||
int32 package_nub = 3;
|
||||
int32 package_now = 4;
|
||||
int64 pv_sn = 5;
|
||||
int32 code = 6;
|
||||
int32 num = 7;
|
||||
int32 warn_time = 8;
|
||||
int32 data_len = 9;
|
||||
int32 pos = 10;
|
||||
string warn_data = 11;
|
||||
}
|
||||
|
||||
message WaveResDTO {
|
||||
string ymd_hms = 1;
|
||||
int32 package_now = 2;
|
||||
int32 err_code = 3;
|
||||
int32 offset = 4;
|
||||
int32 time = 5;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: WarnData.proto
|
||||
# Protobuf Python Version: 4.25.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eWarnData.proto\"\x81\x01\n\nWarnReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x04 \x01(\x05\x12\x13\n\x0bwarn_device\x18\x05 \x01(\x05\x12\x16\n\x05warns\x18\x06 \x03(\x0b\x32\x07.WarnMO\"t\n\x06WarnMO\x12\r\n\x05pv_sn\x18\x01 \x01(\x03\x12\x0c\n\x04\x63ode\x18\x02 \x01(\x05\x12\x0b\n\x03num\x18\x03 \x01(\x05\x12\x0e\n\x06s_time\x18\x04 \x01(\x05\x12\x0e\n\x06\x65_time\x18\x05 \x01(\x05\x12\x0f\n\x07w_data1\x18\x06 \x01(\x05\x12\x0f\n\x07w_data2\x18\x07 \x01(\x05\"b\n\nWarnResDTO\x12\x0f\n\x07ymd_hms\x18\x01 \x01(\t\x12\x13\n\x0bpackage_now\x18\x02 \x01(\x05\x12\x10\n\x08\x65rr_code\x18\x03 \x01(\x05\x12\x0e\n\x06offset\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\"\xc3\x01\n\nWaveReqDTO\x12\x0e\n\x06\x64tu_sn\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x05\x12\x13\n\x0bpackage_nub\x18\x03 \x01(\x05\x12\x13\n\x0bpackage_now\x18\x04 \x01(\x05\x12\r\n\x05pv_sn\x18\x05 \x01(\x03\x12\x0c\n\x04\x63ode\x18\x06 \x01(\x05\x12\x0b\n\x03num\x18\x07 \x01(\x05\x12\x11\n\twarn_time\x18\x08 \x01(\x05\x12\x10\n\x08\x64\x61ta_len\x18\t \x01(\x05\x12\x0b\n\x03pos\x18\n \x01(\x05\x12\x11\n\twarn_data\x18\x0b \x01(\t\"b\n\nWaveResDTO\x12\x0f\n\x07ymd_hms\x18\x01 \x01(\t\x12\x13\n\x0bpackage_now\x18\x02 \x01(\x05\x12\x10\n\x08\x65rr_code\x18\x03 \x01(\x05\x12\x0e\n\x06offset\x18\x04 \x01(\x05\x12\x0c\n\x04time\x18\x05 \x01(\x05\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'WarnData_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_globals['_WARNREQDTO']._serialized_start=19
|
||||
_globals['_WARNREQDTO']._serialized_end=148
|
||||
_globals['_WARNMO']._serialized_start=150
|
||||
_globals['_WARNMO']._serialized_end=266
|
||||
_globals['_WARNRESDTO']._serialized_start=268
|
||||
_globals['_WARNRESDTO']._serialized_end=366
|
||||
_globals['_WAVEREQDTO']._serialized_start=369
|
||||
_globals['_WAVEREQDTO']._serialized_end=564
|
||||
_globals['_WAVERESDTO']._serialized_start=566
|
||||
_globals['_WAVERESDTO']._serialized_end=664
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
for file in $(ls *.proto)
|
||||
do
|
||||
#protoc --pyi_out=. $file
|
||||
protoc --python_out=. $file
|
||||
done
|
||||
@@ -0,0 +1,61 @@
|
||||
"""Utils for interacting with Hoymiles WiFi API."""
|
||||
|
||||
from hoymiles_wifi.protobuf import (
|
||||
GetConfig_pb2,
|
||||
SetConfig_pb2,
|
||||
)
|
||||
|
||||
|
||||
def initialize_set_config(get_config_req: GetConfig_pb2.GetConfigReqDTO):
|
||||
"""Initialize set config response with get config request."""
|
||||
|
||||
set_config_res = SetConfig_pb2.SetConfigResDTO()
|
||||
set_config_res.lock_password = get_config_req.lock_password
|
||||
set_config_res.lock_time = get_config_req.lock_time
|
||||
set_config_res.limit_power_mypower = get_config_req.limit_power_mypower
|
||||
set_config_res.zero_export_433_addr = get_config_req.zero_export_433_addr
|
||||
set_config_res.zero_export_enable = get_config_req.zero_export_enable
|
||||
set_config_res.netmode_select = get_config_req.netmode_select
|
||||
set_config_res.channel_select = get_config_req.channel_select
|
||||
set_config_res.server_send_time = get_config_req.server_send_time
|
||||
set_config_res.serverport = get_config_req.serverport
|
||||
set_config_res.apn_set = get_config_req.apn_set
|
||||
set_config_res.meter_kind = get_config_req.meter_kind
|
||||
set_config_res.meter_interface = get_config_req.meter_interface
|
||||
set_config_res.wifi_ssid = get_config_req.wifi_ssid
|
||||
set_config_res.wifi_password = get_config_req.wifi_password
|
||||
set_config_res.server_domain_name = get_config_req.server_domain_name
|
||||
set_config_res.inv_type = get_config_req.inv_type
|
||||
set_config_res.dtu_sn = get_config_req.dtu_sn
|
||||
set_config_res.access_model = get_config_req.access_model
|
||||
set_config_res.mac_0 = get_config_req.mac_0
|
||||
set_config_res.mac_1 = get_config_req.mac_1
|
||||
set_config_res.mac_2 = get_config_req.mac_2
|
||||
set_config_res.mac_3 = get_config_req.mac_3
|
||||
set_config_res.mac_4 = get_config_req.mac_4
|
||||
set_config_res.mac_5 = get_config_req.mac_5
|
||||
set_config_res.dhcp_switch = get_config_req.dhcp_switch
|
||||
set_config_res.ip_addr_0 = get_config_req.ip_addr_0
|
||||
set_config_res.ip_addr_1 = get_config_req.ip_addr_1
|
||||
set_config_res.ip_addr_2 = get_config_req.ip_addr_2
|
||||
set_config_res.ip_addr_3 = get_config_req.ip_addr_3
|
||||
set_config_res.subnet_mask_0 = get_config_req.subnet_mask_0
|
||||
set_config_res.subnet_mask_1 = get_config_req.subnet_mask_1
|
||||
set_config_res.subnet_mask_2 = get_config_req.subnet_mask_2
|
||||
set_config_res.subnet_mask_3 = get_config_req.subnet_mask_3
|
||||
set_config_res.default_gateway_0 = get_config_req.default_gateway_0
|
||||
set_config_res.default_gateway_1 = get_config_req.default_gateway_1
|
||||
set_config_res.default_gateway_2 = get_config_req.default_gateway_2
|
||||
set_config_res.default_gateway_3 = get_config_req.default_gateway_3
|
||||
set_config_res.apn_name = get_config_req.apn_name
|
||||
set_config_res.apn_password = get_config_req.apn_password
|
||||
set_config_res.sub1g_sweep_switch = get_config_req.sub1g_sweep_switch
|
||||
set_config_res.sub1g_work_channel = get_config_req.sub1g_work_channel
|
||||
set_config_res.cable_dns_0 = get_config_req.cable_dns_0
|
||||
set_config_res.cable_dns_1 = get_config_req.cable_dns_1
|
||||
set_config_res.cable_dns_2 = get_config_req.cable_dns_2
|
||||
set_config_res.cable_dns_3 = get_config_req.cable_dns_3
|
||||
set_config_res.dtu_ap_ssid = get_config_req.dtu_ap_ssid
|
||||
set_config_res.dtu_ap_pass = get_config_req.dtu_ap_pass
|
||||
|
||||
return set_config_res
|
||||
Reference in New Issue
Block a user