From 2854665108ad8227b2af907cab8ab0f94f732242 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Fri, 22 Dec 2023 21:22:08 -0800 Subject: [PATCH] Remove vitals mock data --- pypowerwall/cloud.py | 460 ------------------------------------------- 1 file changed, 460 deletions(-) diff --git a/pypowerwall/cloud.py b/pypowerwall/cloud.py index cea1bdd..a14a9bb 100644 --- a/pypowerwall/cloud.py +++ b/pypowerwall/cloud.py @@ -567,466 +567,6 @@ def poll(self, api): "expected_energy_remaining": 0 } - ## Vitals - elif api == '/api/devices/vitals': - # Protobuf payload - not implemented - use /vitals instead - data = None - - elif api == '/vitals': - # TODO: Assemble vitals data payload - # Get Site power data - """ - "response": { - "solar_power": 1290, - "energy_left": 21276.894736842103, - "total_pack_energy": 25939, - "percentage_charged": 82.02665768472995, - "backup_capable": true, - "battery_power": -220, - "load_power": 1070, - "grid_status": "Active", - "grid_services_active": false, - "grid_power": 0, - "grid_services_power": 0, - "generator_power": 0, - "island_status": "on_grid", - "storm_mode_active": false, - "timestamp": "2023-12-17T14:23:31-08:00", - "wall_connectors": [] - } - """ - power = self.get_site_power() - # Get Site config data - """ - "response": { - "id": "1232100-00-E--TGxxxxxxxxxxxx", - "site_name": "Tesla Energy Gateway", - "backup_reserve_percent": 80, - "default_real_mode": "self_consumption", - "installation_date": "xxxx-xx-xx", - "user_settings": { - "go_off_grid_test_banner_enabled": false, - "storm_mode_enabled": false, - "powerwall_onboarding_settings_set": true, - "powerwall_tesla_electric_interested_in": false, - "vpp_tour_enabled": true, - "sync_grid_alert_enabled": true, - "breaker_alert_enabled": false - }, - "components": { - "solar": true, - "solar_type": "pv_panel", - "battery": true, - "grid": true, - "backup": true, - "gateway": "teg", - "load_meter": true, - "tou_capable": true, - "storm_mode_capable": true, - "flex_energy_request_capable": false, - "car_charging_data_supported": false, - "off_grid_vehicle_charging_reserve_supported": true, - "vehicle_charging_performance_view_enabled": false, - "vehicle_charging_solar_offset_view_enabled": false, - "battery_solar_offset_view_enabled": true, - "solar_value_enabled": true, - "energy_value_header": "Energy Value", - "energy_value_subheader": "Estimated Value", - "energy_service_self_scheduling_enabled": true, - "show_grid_import_battery_source_cards": true, - "set_islanding_mode_enabled": true, - "wifi_commissioning_enabled": true, - "backup_time_remaining_enabled": true, - "rate_plan_manager_supported": true, - "battery_type": "solar_powerwall", - "configurable": true, - "grid_services_enabled": false, - "inverters": [ - { - "device_id": "xxxxxxxxxxxxxxxxxx", - "din": "xxxxxxxxx", - "is_active": true, - "site_id": "xxxxxxxxxxxxxxxxxx", - } - ], - "edit_setting_permission_to_export": true, - "edit_setting_grid_charging": true, - "edit_setting_energy_exports": true - }, - "version": "23.28.2 27626f98", - "battery_count": 2, - "tariff_content": { # removed for brevity - }, - "tariff_id": "SCE-TOU-PRIME", - "nameplate_power": 10800, - "nameplate_energy": 27000, - "installation_time_zone": "America/Los_Angeles", - "off_grid_vehicle_charging_reserve_percent": 65, - "max_site_meter_power_ac": 1000000000, - "min_site_meter_power_ac": -1000000000, - "geolocation": { - "latitude": XX.XXXXXXX, - "longitude": XX.XXXXXXX, - "source": "Site Address Preference" - }, - "address": { - "address_line1": "xxxxxx", - "city": "xxxxxx", - "state": "xx", - "zip": "xxxxx", - "country": "xx" - }, - "vpp_backup_reserve_percent": 80 - } - """ - config = self.get_site_config() - # Get Battery data - """ - { - 'response': { - 'resource_type': 'battery', - 'site_name': 'CoxEnergyGateway', - 'gateway_id': '1232100-00-E--TG121048001E4G', - 'energy_left': 20619.68421052632, - 'total_pack_energy': 25786, - 'percentage_charged': 79.9646482995669, - 'battery_type': 'ac_powerwall', - 'backup_capable': True, - 'battery_power': -20, - 'go_off_grid_test_banner_enabled': None, - 'storm_mode_enabled': False, - 'powerwall_onboarding_settings_set': True, - 'powerwall_tesla_electric_interested_in': None, - 'vpp_tour_enabled': None, - 'sync_grid_alert_enabled': True, - 'breaker_alert_enabled': True - } - } - """ - battery = self.get_battery() - din = lookup(config, ("response", "id")) - # Break apart DIN - din_parts = din.split("--") - partNumber = din_parts[0] - serialNumber = din_parts[1] - timestamp = int(time.time()) - inverters = lookup(config, ("response", "components", "inverters")) - for i in inverters: - inverter_din = i['din'] - inverter_parts = inverter_din.split("--") - inverter_partNumber = inverter_parts[0] - inverter_serialNumber = inverter_parts[1] - inverter_ - systsm = f"STSTSM--{partNumber}--{serialNumber}" - - data = { - systsm: { - "STSTSM-Location": "Gateway", - "alerts": [ - "FWUpdateSucceeded", - "SystemConnectedToGrid", - "PodCommissionTime" - ], - "firmwareVersion": "2023-11-30-g6e07d12eea", - "lastCommunicationTime": timestamp, - "manufacturer": "TESLA", - "partNumber": partNumber, - "serialNumber": serialNumber, - "teslaEnergyEcuAttributes": { - "ecuType": 207 - } - }, - "TESLA--1538100-00-F--CN321237C0F0EJ": { - "componentParentDin": "STSTSM--1232100-00-E--TG121048001E4G", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "pvInverterAttributes": { - "nameplateRealPowerW": 7680 - }, - "serialNumber": "1538100-00-F--CN321237C0F0EJ" - }, - "PVAC--1538100-00-F--CN321237C0F0EJ": { - "PVAC_Fout": 59.968, - "PVAC_GridState": "Grid_Compliant", - "PVAC_InvState": "INV_Grid_Connected", - "PVAC_Iout": 1.2, - "PVAC_LifetimeEnergyPV_Total": 26409276.0, - "PVAC_PVCurrent_A": 0.35000000000000003, - "PVAC_PVCurrent_B": 0.0, - "PVAC_PVCurrent_C": 0.4, - "PVAC_PVCurrent_D": 0.4, - "PVAC_PVMeasuredPower_A": 83.0, - "PVAC_PVMeasuredPower_B": 0.0, - "PVAC_PVMeasuredPower_C": 107.0, - "PVAC_PVMeasuredPower_D": 108.0, - "PVAC_PVMeasuredVoltage_A": 241.9, - "PVAC_PVMeasuredVoltage_B": -2.3, - "PVAC_PVMeasuredVoltage_C": 274.3, - "PVAC_PVMeasuredVoltage_D": 274.6, - "PVAC_Pout": 300.0, - "PVAC_PvState_A": "PV_Active", - "PVAC_PvState_B": "PV_Active", - "PVAC_PvState_C": "PV_Active", - "PVAC_PvState_D": "PV_Active_Parallel", - "PVAC_Qout": 10.0, - "PVAC_State": "PVAC_Active", - "PVAC_VHvMinusChassisDC": -210.0, - "PVAC_VL1Ground": 121.5, - "PVAC_VL2Ground": 121.8, - "PVAC_Vout": 243.20000000000002, - "PVI-PowerStatusSetpoint": "on", - "componentParentDin": "TETHC--2012170-25-E--TG1212580025G4", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1538100-00-F", - "serialNumber": "CN321237C0F0EJ", - "teslaEnergyEcuAttributes": { - "ecuType": 296 - } - }, - "PVS--1538100-00-F--CN321237C0F0EJ": { - "PVS_EnableOutput": true, - "PVS_SelfTestState": "PVS_SelfTestOff", - "PVS_State": "PVS_Active", - "PVS_StringA_Connected": true, - "PVS_StringB_Connected": false, - "PVS_StringC_Connected": true, - "PVS_StringD_Connected": true, - "PVS_vLL": 243.3, - "alerts": [ - "PVS_a018_MciStringB", - "PVS_a060_MciClose" - ], - "componentParentDin": "PVAC--1538100-00-F--CN321237C0F0EJ", - "firmwareVersion": "44857755923fa5", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1538100-00-F", - "serialNumber": "CN321237C0F0EJ", - "teslaEnergyEcuAttributes": { - "ecuType": 297 - } - }, - "TEPINV--1081100-10-U--T21F0004978": { - "PINV_EnergyCharged": 6886049.0, - "PINV_EnergyDischarged": 6120138.0, - "PINV_Fout": 59.971000000000004, - "PINV_GridState": "Grid_Compliant", - "PINV_HardwareEnableLine": true, - "PINV_PllFrequency": 59.96, - "PINV_PllLocked": true, - "PINV_Pout": 0.0, - "PINV_PowerLimiter": "PWRLIM_POD_Power_Limit", - "PINV_Qout": 0.33, - "PINV_ReadyForGridForming": true, - "PINV_State": "PINV_GridFollowing", - "PINV_VSplit1": 121.9, - "PINV_VSplit2": 121.80000000000001, - "PINV_Vout": 243.5, - "alerts": [ - "PINV_a067_overvoltageNeutralChassis" - ], - "componentParentDin": "TETHC--3012170-05-B--TG121248001NJ4", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1081100-10-U", - "serialNumber": "T21F0004978", - "teslaEnergyEcuAttributes": { - "ecuType": 253 - } - }, - "TEPINV--1081100-13-V--T21I0001140": { - "PINV_EnergyCharged": 7089078.0, - "PINV_EnergyDischarged": 6294524.0, - "PINV_Fout": 59.972, - "PINV_GridState": "Grid_Compliant", - "PINV_HardwareEnableLine": true, - "PINV_PllFrequency": 59.957, - "PINV_PllLocked": true, - "PINV_Pout": 0.0, - "PINV_PowerLimiter": "PWRLIM_POD_Power_Limit", - "PINV_Qout": 0.32, - "PINV_ReadyForGridForming": true, - "PINV_State": "PINV_GridFollowing", - "PINV_VSplit1": 121.80000000000001, - "PINV_VSplit2": 121.7, - "PINV_Vout": 243.4, - "alerts": [ - "PINV_a067_overvoltageNeutralChassis" - ], - "componentParentDin": "TETHC--2012170-25-E--TG1212580025G4", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1081100-13-V", - "serialNumber": "T21I0001140", - "teslaEnergyEcuAttributes": { - "ecuType": 253 - } - }, - "TEPOD--1081100-10-U--T21F0004978": { - "POD_ActiveHeating": false, - "POD_CCVhold": false, - "POD_ChargeComplete": false, - "POD_ChargeRequest": false, - "POD_DischargeComplete": false, - "POD_PermanentlyFaulted": false, - "POD_PersistentlyFaulted": false, - "POD_available_charge_power": 7000.0, - "POD_available_dischg_power": 12000.0, - "POD_enable_line": true, - "POD_nom_energy_remaining": 10232.0, - "POD_nom_energy_to_be_charged": 2500.0, - "POD_nom_full_pack_energy": 12603.0, - "POD_state": "POD_ACTIVE", - "componentParentDin": "TETHC--3012170-05-B--TG121248001NJ4", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1081100-10-U", - "serialNumber": "T21F0004978", - "teslaEnergyEcuAttributes": { - "ecuType": 226 - } - }, - "TEPOD--1081100-13-V--T21I0001140": { - "POD_ActiveHeating": false, - "POD_CCVhold": false, - "POD_ChargeComplete": false, - "POD_ChargeRequest": false, - "POD_DischargeComplete": false, - "POD_PermanentlyFaulted": false, - "POD_PersistentlyFaulted": false, - "POD_available_charge_power": 7000.0, - "POD_available_dischg_power": 12000.0, - "POD_enable_line": true, - "POD_nom_energy_remaining": 10646.0, - "POD_nom_energy_to_be_charged": 2666.0, - "POD_nom_full_pack_energy": 13183.0, - "POD_state": "POD_ACTIVE", - "componentParentDin": "TETHC--2012170-25-E--TG1212580025G4", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1081100-13-V", - "serialNumber": "T21I0001140", - "teslaEnergyEcuAttributes": { - "ecuType": 226 - } - }, - - "TESLA--JBL20335Y1F097": { - "componentParentDin": "STSTSM--1232100-00-E--TG121048001E4G", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "meterAttributes": { - "meterLocation": [ - 1 - ] - }, - "serialNumber": "JBL20335Y1F097" - }, - "TESYNC--1493315-01-F--JBL20335Y1F097": { - "ISLAND_FreqL1_Load": 59.96, - "ISLAND_FreqL1_Main": 59.97, - "ISLAND_FreqL2_Load": 59.96, - "ISLAND_FreqL2_Main": 59.97, - "ISLAND_FreqL3_Load": 0.0, - "ISLAND_FreqL3_Main": 0.0, - "ISLAND_GridConnected": true, - "ISLAND_GridState": "ISLAND_GridState_Grid_Compliant", - "ISLAND_L1L2PhaseDelta": -180.5, - "ISLAND_L1L3PhaseDelta": -180.5, - "ISLAND_L1MicrogridOk": true, - "ISLAND_L2L3PhaseDelta": -180.5, - "ISLAND_L2MicrogridOk": true, - "ISLAND_L3MicrogridOk": false, - "ISLAND_PhaseL1_Main_Load": 0.0, - "ISLAND_PhaseL2_Main_Load": 0.0, - "ISLAND_PhaseL3_Main_Load": -180.5, - "ISLAND_ReadyForSynchronization": true, - "ISLAND_VL1N_Load": 122.0, - "ISLAND_VL1N_Main": 122.0, - "ISLAND_VL2N_Load": 122.0, - "ISLAND_VL2N_Main": 122.0, - "ISLAND_VL3N_Load": 0.0, - "ISLAND_VL3N_Main": 0.0, - "METER_X_CTA_I": 6.7700000000000005, - "METER_X_CTA_InstReactivePower": -394.0, - "METER_X_CTA_InstRealPower": 644.0, - "METER_X_CTB_I": 3.396, - "METER_X_CTB_InstReactivePower": 71.0, - "METER_X_CTB_InstRealPower": 373.0, - "METER_X_CTC_I": 0.0, - "METER_X_CTC_InstReactivePower": 0.0, - "METER_X_CTC_InstRealPower": 0.0, - "METER_X_LifetimeEnergyExport": 7833046.0, - "METER_X_LifetimeEnergyImport": 10475782.0, - "METER_X_VL1N": 121.68, - "METER_X_VL2N": 121.79, - "METER_X_VL3N": 0.0, - "METER_Y_CTA_I": 0.0, - "METER_Y_CTA_InstReactivePower": 0.0, - "METER_Y_CTA_InstRealPower": 0.0, - "METER_Y_CTB_I": 0.0, - "METER_Y_CTB_InstReactivePower": 0.0, - "METER_Y_CTB_InstRealPower": 0.0, - "METER_Y_CTC_I": 0.0, - "METER_Y_CTC_InstReactivePower": 0.0, - "METER_Y_CTC_InstRealPower": 0.0, - "METER_Y_LifetimeEnergyExport": 0.0, - "METER_Y_LifetimeEnergyImport": 2.0, - "METER_Y_VL1N": 121.7, - "METER_Y_VL2N": 121.79, - "METER_Y_VL3N": 0.0, - "SYNC_ExternallyPowered": false, - "SYNC_SiteSwitchEnabled": false, - "alerts": [ - "SYNC_a001_SW_App_Boot", - "SYNC_a046_DoCloseArguments" - ], - "componentParentDin": "STSTSM--1232100-00-E--TG121048001E4G", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "1493315-01-F", - "serialNumber": "JBL20335Y1F097", - "teslaEnergyEcuAttributes": { - "ecuType": 259 - } - }, - "TETHC--2012170-25-E--TG1212580025G4": { - "THC_AmbientTemp": 20.0, - "THC_State": "THC_STATE_AUTONOMOUSCONTROL", - "componentParentDin": "STSTSM--1232100-00-E--TG121048001E4G", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "2012170-25-E", - "serialNumber": "TG1212580025G4", - "teslaEnergyEcuAttributes": { - "ecuType": 224 - } - }, - "TETHC--3012170-05-B--TG121248001NJ4": { - "THC_AmbientTemp": 20.400000000000006, - "THC_State": "THC_STATE_AUTONOMOUSCONTROL", - "componentParentDin": "STSTSM--1232100-00-E--TG121048001E4G", - "firmwareVersion": "aa269d352a70b0", - "lastCommunicationTime": 1703288222, - "manufacturer": "TESLA", - "partNumber": "3012170-05-B", - "serialNumber": "TG121248001NJ4", - "teslaEnergyEcuAttributes": { - "ecuType": 224 - } - } - } - ## Possible Actions elif api == '/api/logout': data = '{"status":"ok"}'