diff --git a/solaredge_setapp/information.py b/solaredge_setapp/information.py index fcf5352..d016992 100644 --- a/solaredge_setapp/information.py +++ b/solaredge_setapp/information.py @@ -23,21 +23,21 @@ def parse_protobuf(self, bytes): parsed["dsp1"] = str(f"{proto.dsp1.major}.{proto.dsp1.minor}.{proto.dsp1.build}") parsed["dsp2"] = str(f"{proto.dsp2.major}.{proto.dsp2.minor}.{proto.dsp2.build}") - for logger in proto.errors.loggerList: + for logger in proto.errors.loggers: parsed["errors"] = [{ - "controller_id": int(logger.controllerid), + "controller_id": int(logger.controllerID), "subsystem_id": int(logger.subsystem), - "error_code": int(error.errorCode), + "error_code": int(error.error_code), "timestamp": int(datetime.datetime.strptime( "{year} {month} {day} {hour} {minutes} {seconds}".format( - year=int(error.startTime.year), - month=int(error.startTime.month), - day=int(error.startTime.day), - hour=int(error.startTime.hour), - minutes=int(error.startTime.minute), - seconds=int(error.startTime.second) + year=int(error.start_time.year), + month=int(error.start_time.month), + day=int(error.start_time.day), + hour=int(error.start_time.hour), + minutes=int(error.start_time.minute), + seconds=int(error.start_time.second) ), "%Y %m %d %H %M %S").timestamp()), - } for error in logger.errorsList] + } for error in logger.errors] except AttributeError as e: print(f"AttributeError: {e}") diff --git a/solaredge_setapp/maintenance.py b/solaredge_setapp/maintenance.py index ee812b8..fbc692d 100644 --- a/solaredge_setapp/maintenance.py +++ b/solaredge_setapp/maintenance.py @@ -22,11 +22,11 @@ def parse_protobuf(self, bytes): "serial": str(proto.header.id), "timestamp": int(proto.header.timestamp), "standby": bool(proto.standby.activated), - "utc_offset": int(proto.dateAndTime.gmtOffset), - "ntp_server": str(proto.dateAndTime.ntp), + "utc_offset": int(proto.date_and_time.gmt_offset), + "ntp_server": str(proto.date_and_time.ntp), "afci": { "enabled": bool(proto.afci.enable), - "manual_reconnect": bool(proto.afci.manualReconnect), + "manual_reconnect": bool(proto.afci.manual_reconnect), "test_result": int(proto.afci.test.result) }, } @@ -34,12 +34,12 @@ def parse_protobuf(self, bytes): parsed["inverters"] = [] for inverter in proto.diagnostics.inverters.primary, proto.diagnostics.inverters.left, proto.diagnostics.inverters.right: - if inverter.invSn: + if inverter.inv_sn: - if inverter.isolation.rIso.scaling: - inverter_isolation_r_iso = float(inverter.isolation.rIso.value / inverter.isolation.rIso.scaling) + if inverter.isolation.r_iso.scaling: + inverter_isolation_r_iso = float(inverter.isolation.r_iso.value / inverter.isolation.r_iso.scaling) else: - inverter_isolation_r_iso = float(inverter.isolation.rIso.value) + inverter_isolation_r_iso = float(inverter.isolation.r_iso.value) if inverter.isolation.alpha.scaling: inverter_isolation_alpha = float(inverter.isolation.alpha.value / inverter.isolation.alpha.scaling) @@ -47,22 +47,23 @@ def parse_protobuf(self, bytes): inverter_isolation_alpha = float(inverter.isolation.alpha.value) parsed["inverters"].append({ - "serial": str(inverter.invSn), + "serial": str(inverter.inv_sn), "isolation": { - "fault_location": int(inverter.isolation.faultLocation), + "fault_location": int(inverter.isolation.fault_location), "r_iso": inverter_isolation_r_iso, "alpha": inverter_isolation_alpha }, "optimizers_status": { - "total": int(inverter.optimizersStatus.enabled), - "online": int(inverter.optimizersStatus.connected) + "total": int(inverter.optimizers_status.enabled), + "online": int(inverter.optimizers_status.connected) }, "optimizers": [{ "serial": str(po.sn), "online": bool(po.reports), - "po_voltage": int(po.outputV), - "module_voltage": int(po.inputV), - "module_current": int(po.inputC), + "po_voltage": int(po.output_v), + "po_power": int(po.energy.value), + "module_voltage": int(po.input_v), + "module_current": int(po.input_c), "temperature": int(po.temperature.value), "timestamp": 0 if not bool(po.reports) else int(datetime.datetime.strptime( "{year} {month} {day} {hour} {minutes} {seconds}".format( @@ -73,7 +74,7 @@ def parse_protobuf(self, bytes): minutes=po.date.minute, seconds=po.date.second ), "%Y %m %d %H %M %S").timestamp()) - } for po in inverter.optimizerList] + } for po in inverter.optimizer] }) except AttributeError as e: print(f"AttributeError: {e}") diff --git a/solaredge_setapp/status.py b/solaredge_setapp/status.py index 2e4a6c6..fd5cb29 100644 --- a/solaredge_setapp/status.py +++ b/solaredge_setapp/status.py @@ -18,45 +18,45 @@ def parse_protobuf(self, bytes): parsed = { "serial": str(proto.sn), - "power_ac": float(proto.powerWatt), + "power_ac": float(proto.power_watt), "power_ac_limit": int(proto.limit), "voltage_ac": float(proto.voltage), - "frequency": float(proto.frequencyHz), + "frequency": float(proto.frequency_hz), "status": int(proto.status), - "switch": bool(proto.switchStatus), - "cosphi": float(proto.cosPhi), + "switch": bool(proto.switch_status), + "cosphi": float(proto.cos_Phi), "country_id": int(proto.country), - "portia_subsystem_id": int(proto.portiaSubsystem), + "portia_subsystem_id": int(proto.portia_subsystem), "afci": { "enabled": bool(proto.afci.enable), - "manual_reconnect": bool(proto.afci.manualReconnect), + "manual_reconnect": bool(proto.afci.manual_reconnect), "test_result": int(proto.afci.test.result) }, "optimizers": { - "total": int(proto.optimizersStatus.enabled), - "online": int(proto.optimizersStatus.connected) + "total": int(proto.optimizers_status.enabled), + "online": int(proto.optimizers_status.connected) }, - "server_connection": bool(proto.sOk), + "server_connection": bool(proto.s_ok), "server_communication": { - "physical": bool(proto.serverComm.lanTest.physicalConnection), - "ip": bool(proto.serverComm.lanTest.ipAddress), - "gateway": bool(proto.serverComm.lanTest.gatewayLink), - "internet": bool(proto.serverComm.lanTest.internetLink), - "monitoring": bool(proto.serverComm.lanTest.monitoringLink), - "server": bool(proto.serverComm.lanTest.sOk) + "physical": bool(proto.server_comm.lan_test.physical_connection), + "ip": bool(proto.server_comm.lan_test.ip_address), + "gateway": bool(proto.server_comm.lan_test.gateway_link), + "internet": bool(proto.server_comm.lan_test.internet_link), + "monitoring": bool(proto.server_comm.lan_test.monitoring_link), + "server": bool(proto.server_comm.lan_test.s_ok) }, "server_channel": { - "lan": bool(proto.serverChannel.lan.value), - "cellular": bool(proto.serverChannel.cellular.value), - "rs485_1": bool(proto.serverChannel.rs4851SeSlave.value), - "rs485_2": bool(proto.serverChannel.rs4852SeSlave.value), - "wifi": bool(proto.serverChannel.wifi.value), - "zigbee": bool(proto.serverChannel.zigbee.value) + "lan": bool(proto.server_channel.lan.value), + "cellular": bool(proto.server_channel.cellular.value), + "rs485_1": bool(proto.server_channel.rs485_1_se_slave.value), + "rs485_2": bool(proto.server_channel.rs485_2_se_slave.value), + "wifi": bool(proto.server_channel.wifi.value), + "zigbee": bool(proto.server_channel.zigbee.value) }, "energy": { "day": float(proto.energy.today), - "month": float(proto.energy.thisMonth), - "year": float(proto.energy.thisYear), + "month": float(proto.energy.this_month), + "year": float(proto.energy.this_year), "total": float(proto.energy.total) }, "inverters": [], @@ -64,30 +64,30 @@ def parse_protobuf(self, bytes): "batteries": [], "communication": { "lan": { - "mac": str(proto.communication.lanInfo.mac.value), - "dhcp": bool(proto.communication.lanInfo.dhcp.value), - "ip": str(proto.communication.lanInfo.ip.ipAddress.value), - "netmask": str(proto.communication.lanInfo.ip.subnetMask.value), - "gateway": str(proto.communication.lanInfo.ip.gateway.value), - "dns": str(proto.communication.lanInfo.ip.dns.value), - "connected": bool(proto.communication.lanInfo.cableConnected.value) + "mac": str(proto.communication.lan_info.mac.value), + "dhcp": bool(proto.communication.lan_info.dhcp.value), + "ip": str(proto.communication.lan_info.ip.ip_address.value), + "netmask": str(proto.communication.lan_info.ip.subnet_mask.value), + "gateway": str(proto.communication.lan_info.ip.gateway.value), + "dns": str(proto.communication.lan_info.ip.dns.value), + "connected": bool(proto.communication.lan_info.cable_connected.value) }, "rs485_1": { "protocol": { - "se_slave": bool(proto.communication.rs4851.protocol.seSlave), - "se_master": bool(proto.communication.rs4851.protocol.seMaster), - "modbus_multi_devices": bool(proto.communication.rs4851.protocol.modbusMultiDevices), - "sunspec": bool(proto.communication.rs4851.protocol.sunspec), - "none": bool(proto.communication.rs4851.protocol.none) + "se_slave": bool(proto.communication.rs485_1.protocol.se_slave), + "se_master": bool(proto.communication.rs485_1.protocol.se_master), + "modbus_multi_devices": bool(proto.communication.rs485_1.protocol.modbus_multi_devices), + "sunspec": bool(proto.communication.rs485_1.protocol.sunspec), + "none": bool(proto.communication.rs485_1.protocol.none) } }, "rs485_2": { "protocol": { - "se_slave": bool(proto.communication.rs4852.protocol.seSlave), - "se_master": bool(proto.communication.rs4852.protocol.seMaster), - "modbus_multi_devices": bool(proto.communication.rs4852.protocol.modbusMultiDevices), - "sunspec": bool(proto.communication.rs4852.protocol.sunspec), - "none": bool(proto.communication.rs4852.protocol.none) + "se_slave": bool(proto.communication.rs485_2.protocol.se_slave), + "se_master": bool(proto.communication.rs485_2.protocol.se_master), + "modbus_multi_devices": bool(proto.communication.rs485_2.protocol.modbus_multi_devices), + "sunspec": bool(proto.communication.rs485_2.protocol.sunspec), + "none": bool(proto.communication.rs485_2.protocol.none) } } } @@ -104,7 +104,7 @@ def parse_protobuf(self, bytes): parsed["country"] = solaredge_setapp.Countries(-1).name for inverter in proto.inverters.primary, proto.inverters.left, proto.inverters.right: - if not inverter.dspSn: + if not inverter.dsp_sn: continue if inverter.power.scaling: @@ -112,10 +112,10 @@ def parse_protobuf(self, bytes): else: inverter_power_ac = float(inverter.power.value) - if inverter.isolation.rIso.scaling: - inverter_isolation_r_iso = float(inverter.isolation.rIso.value / inverter.isolation.rIso.scaling) + if inverter.isolation.r_iso.scaling: + inverter_isolation_r_iso = float(inverter.isolation.r_iso.value / inverter.isolation.r_iso.scaling) else: - inverter_isolation_r_iso = float(inverter.isolation.rIso.value) + inverter_isolation_r_iso = float(inverter.isolation.r_iso.value) if inverter.isolation.alpha.scaling: inverter_isolation_alpha = float(inverter.isolation.alpha.value / inverter.isolation.alpha.scaling) @@ -123,12 +123,12 @@ def parse_protobuf(self, bytes): inverter_isolation_alpha = float(inverter.isolation.alpha.value) parsed["inverters"].append({ - "serial": str(inverter.dspSn), + "serial": str(inverter.dsp_sn), "voltage_dc": float(inverter.voltage), "power_ac": inverter_power_ac, "optimizers": { - "total": int(inverter.optimizers.enabled), - "online": int(inverter.optimizers.connected) + "total": int(inverter.optimizers_status.enabled), + "online": int(inverter.optimizers_status.connected) }, "temperature": { "value": int(inverter.temperature.value), @@ -138,7 +138,7 @@ def parse_protobuf(self, bytes): } }, "isolation": { - "fault_location": int(inverter.isolation.faultLocation), + "fault_location": int(inverter.isolation.fault_location), "r_iso": inverter_isolation_r_iso, "alpha": inverter_isolation_alpha },