foxesscloud 2.7.7__tar.gz → 2.7.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foxesscloud
3
- Version: 2.7.7
3
+ Version: 2.7.9
4
4
  Summary: library for accessing Fox ESS cloud data using Open API
5
5
  Author-email: Tony Matthews <tony@quasair.co.uk>
6
6
  Project-URL: Homepage, https://github.com/TonyM1958/FoxESS-Cloud
@@ -358,7 +358,9 @@ All the parameters are optional:
358
358
 
359
359
  charge_needed() uses a number of models to better estimate the state of the battery.
360
360
 
361
- **Manual Consumption:** You can provide your 'annual_consumption' in kWh e.g. 5500. This figure is factored down to a daily consumption by dividing by 365 and applying **f.seasonality**. This normally decreases consumption in the summer and increases it in winter. Seasonality is a list of weightings by month for Jan, Feb, Mar, Apr etc. Preset lists are 'f.high_seasonality' (recommend where electric heating is ued), 'f.medium_seasonality' (default) amd 'f.no_seasonality' (all months the same). The daily consumption is profiled by hour using **f.daily_consumption**. This maps your consumption for a day to the hours when more or less energy is consumed. It is a list of 24 values for the times 00, 01, 02, 03 .. 23. Preset lists are 'f.high_profile' (larger peaks at 8am and 6pm), 'f.medium_profile' (default, more balanced) and 'f.no_profile' (flat).
361
+ **Manual Consumption:** You can provide your expected 'consumption' in kWh e.g. 15. This figure is used directly.
362
+
363
+ **Annual Consumption:** You can provide your 'annual_consumption' in kWh e.g. 5500. This figure is factored down to a daily consumption by dividing by 365 and applying **f.seasonality**. This normally decreases consumption in the summer and increases it in winter. Seasonality is a list of weightings by month for Jan, Feb, Mar, Apr etc. Preset lists are 'f.high_seasonality' (recommend where electric heating is ued), 'f.medium_seasonality' (default) amd 'f.no_seasonality' (all months the same). The daily consumption is profiled by hour using **f.daily_consumption**. This maps your consumption for a day to the hours when more or less energy is consumed. It is a list of 24 values for the times 00, 01, 02, 03 .. 23. Preset lists are 'f.high_profile' (larger peaks at 8am and 6pm), 'f.medium_profile' (default, more balanced) and 'f.no_profile' (flat).
362
364
 
363
365
  **Historic Consumption:** If annual_consumption is not provided, your consumption history is used. By default, this looks at your average consumption for the last 3 days using the load power reported by your inverter. For systems with multiple inverters where CT2 is not connected, the load power may not be correct. For this and other cases where you want to set your consumption, provide your annual_consumption.
364
366
 
@@ -807,6 +809,13 @@ This setting can be:
807
809
 
808
810
  # Version Info
809
811
 
812
+ 2.7.9<br>
813
+ Add 'consumption' input for charge_needed().
814
+ Avoid throwing exception in battery_info() if there is no capacity info.
815
+
816
+ 2.7.8<br>
817
+ Update the battery_params charge rate table to 2025 values.
818
+
810
819
  2.7.7<br>
811
820
  Updates to get_pvoutput() to support solar inverters that don't provide grid energy by setting tou=2.
812
821
  Default tariff changed to None.
@@ -344,7 +344,9 @@ All the parameters are optional:
344
344
 
345
345
  charge_needed() uses a number of models to better estimate the state of the battery.
346
346
 
347
- **Manual Consumption:** You can provide your 'annual_consumption' in kWh e.g. 5500. This figure is factored down to a daily consumption by dividing by 365 and applying **f.seasonality**. This normally decreases consumption in the summer and increases it in winter. Seasonality is a list of weightings by month for Jan, Feb, Mar, Apr etc. Preset lists are 'f.high_seasonality' (recommend where electric heating is ued), 'f.medium_seasonality' (default) amd 'f.no_seasonality' (all months the same). The daily consumption is profiled by hour using **f.daily_consumption**. This maps your consumption for a day to the hours when more or less energy is consumed. It is a list of 24 values for the times 00, 01, 02, 03 .. 23. Preset lists are 'f.high_profile' (larger peaks at 8am and 6pm), 'f.medium_profile' (default, more balanced) and 'f.no_profile' (flat).
347
+ **Manual Consumption:** You can provide your expected 'consumption' in kWh e.g. 15. This figure is used directly.
348
+
349
+ **Annual Consumption:** You can provide your 'annual_consumption' in kWh e.g. 5500. This figure is factored down to a daily consumption by dividing by 365 and applying **f.seasonality**. This normally decreases consumption in the summer and increases it in winter. Seasonality is a list of weightings by month for Jan, Feb, Mar, Apr etc. Preset lists are 'f.high_seasonality' (recommend where electric heating is ued), 'f.medium_seasonality' (default) amd 'f.no_seasonality' (all months the same). The daily consumption is profiled by hour using **f.daily_consumption**. This maps your consumption for a day to the hours when more or less energy is consumed. It is a list of 24 values for the times 00, 01, 02, 03 .. 23. Preset lists are 'f.high_profile' (larger peaks at 8am and 6pm), 'f.medium_profile' (default, more balanced) and 'f.no_profile' (flat).
348
350
 
349
351
  **Historic Consumption:** If annual_consumption is not provided, your consumption history is used. By default, this looks at your average consumption for the last 3 days using the load power reported by your inverter. For systems with multiple inverters where CT2 is not connected, the load power may not be correct. For this and other cases where you want to set your consumption, provide your annual_consumption.
350
352
 
@@ -793,6 +795,13 @@ This setting can be:
793
795
 
794
796
  # Version Info
795
797
 
798
+ 2.7.9<br>
799
+ Add 'consumption' input for charge_needed().
800
+ Avoid throwing exception in battery_info() if there is no capacity info.
801
+
802
+ 2.7.8<br>
803
+ Update the battery_params charge rate table to 2025 values.
804
+
796
805
  2.7.7<br>
797
806
  Updates to get_pvoutput() to support solar inverters that don't provide grid energy by setting tou=2.
798
807
  Default tariff changed to None.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "foxesscloud"
7
- version = "2.7.7"
7
+ version = "2.7.9"
8
8
  authors = [
9
9
  {name="Tony Matthews", email="tony@quasair.co.uk"},
10
10
  ]
@@ -1,7 +1,7 @@
1
1
  ##################################################################################################
2
2
  """
3
3
  Module: Fox ESS Cloud
4
- Updated: 11 January 2025
4
+ Updated: 28 January 2025
5
5
  By: Tony Matthews
6
6
  """
7
7
  ##################################################################################################
@@ -10,7 +10,7 @@ By: Tony Matthews
10
10
  # ALL RIGHTS ARE RESERVED © Tony Matthews 2023
11
11
  ##################################################################################################
12
12
 
13
- version = "1.8.8"
13
+ version = "1.9.0"
14
14
  print(f"FoxESS-Cloud version {version}")
15
15
 
16
16
  debug_setting = 1
@@ -591,25 +591,29 @@ battery_settings = None
591
591
  # 1 = Residual Energy, 2 = Residual Capacity (HV), 3 = Residual Capacity per battery (Mira)
592
592
  residual_handling = 1
593
593
 
594
- # charge rates based on residual_handling
594
+ # charge rates based on residual_handling. Index is bms temperature
595
595
  battery_params = {
596
- # cell temp -5 0 5 10 15 20 25 30 35 40 45 50 55
597
596
  # bms temp 5 10 15 20 25 30 35 40 45 50 55 60 65
597
+ # cell temp -5 0 5 10 15 20 25 30 35 40 45 50 55
598
598
  1: {'table': [ 0, 2, 10, 15, 25, 50, 50, 50, 50, 50, 30, 20, 0],
599
599
  'step': 5,
600
600
  'offset': 5,
601
601
  'charge_loss': 0.974,
602
602
  'discharge_loss': 0.974},
603
- # HV BMS v2 with firmware 1.014 or later
604
- 2: {'table': [ 0, 2, 10, 10, 15, 15, 25, 50, 50, 50, 30, 20, 0],
603
+ # HV BMS v2 with firmware 1.014 or later
604
+ # bms temp 10 15 20 25 30 35 40 45 50 55 60 65 70
605
+ # cell temp 0 5 10 15 20 25 30 35 40 45 50 55 60
606
+ 2: {'table': [ 0, 5, 10, 15, 25, 50, 50, 50, 50, 25, 20, 3, 0],
605
607
  'step': 5,
606
- 'offset': 5,
608
+ 'offset': 11,
607
609
  'charge_loss': 1.08,
608
610
  'discharge_loss': 0.95},
609
- # Mira BMS with firmware 1.014 or later
610
- 3: {'table': [ 0, 2, 10, 10, 15, 15, 25, 50, 50, 50, 30, 20, 0],
611
+ # Mira BMS with firmware 1.014 or later
612
+ # bms temp 10 15 20 25 30 35 40 45 50 55 60 65 70
613
+ # cell temp 0 5 10 15 20 25 30 35 40 45 50 55 60
614
+ 3: {'table': [ 0, 5, 10, 15, 25, 50, 50, 50, 50, 25, 20, 3, 0],
611
615
  'step': 5,
612
- 'offset': 5,
616
+ 'offset': 11,
613
617
  'charge_loss': 0.974,
614
618
  'discharge_loss': 0.974},
615
619
  }
@@ -2953,6 +2957,7 @@ charge_needed_app_key = "awcr5gro2v13oher3v1qu6hwnovp28"
2953
2957
 
2954
2958
  # work out the charge times to set using the parameters:
2955
2959
  # forecast: the kWh expected tomorrow. If none, forecast data is loaded from solcast etc
2960
+ # consumption: the kWh consumed. If none, consumption is loaded from history
2956
2961
  # update_settings: 0 no updates, 1 update charge settings. The default is 0
2957
2962
  # show_data: 1 shows battery SoC, 2 shows battery residual. Default = 0
2958
2963
  # show_plot: 1 plots battery SoC, 2 plots battery residual. Default = 1
@@ -2960,7 +2965,7 @@ charge_needed_app_key = "awcr5gro2v13oher3v1qu6hwnovp28"
2960
2965
  # forecast_times: list of hours when forecast can be fetched (UTC)
2961
2966
  # force_charge: 1 = hold battery, 2 = charge for whole period
2962
2967
 
2963
- def charge_needed(forecast=None, update_settings=0, timed_mode=None, show_data=None, show_plot=None, run_after=None, reload=2,
2968
+ def charge_needed(forecast=None, consumption=None, update_settings=0, timed_mode=None, show_data=None, show_plot=None, run_after=None, reload=2,
2964
2969
  forecast_times=None, force_charge=0, test_time=None, test_soc=None, test_charge=None, **settings):
2965
2970
  global device, seasonality, solcast_api_key, debug_setting, tariff, solar_arrays, legend_location, time_shift, charge_needed_app_key
2966
2971
  global timed_strategy, steps_per_hour, base_time, storage, battery, battery_params
@@ -3172,6 +3177,9 @@ def charge_needed(forecast=None, update_settings=0, timed_mode=None, show_data=N
3172
3177
  consumption = annual_consumption / 365 * seasonality[now.month - 1] / sum(seasonality) * 12
3173
3178
  consumption_by_hour = daily_consumption
3174
3179
  output(f"\nEstimated consumption: {consumption:.1f}kWh")
3180
+ elif consumption is not None:
3181
+ consumption_by_hour = daily_consumption
3182
+ output(f"\nConsumption: {consumption:.1f}kWh")
3175
3183
  else:
3176
3184
  consumption_days = charge_config['consumption_days']
3177
3185
  consumption_days = 3 if consumption_days > 7 or consumption_days < 1 else consumption_days
@@ -3633,7 +3641,7 @@ def battery_info(log=0, plot=1, rated=None, count=None, info=1, bat=None):
3633
3641
  bat_current = bat['current']
3634
3642
  bat_power = bat['power']
3635
3643
  bms_temperature = bat['temperature']
3636
- capacity = bat['capacity']
3644
+ capacity = bat.get('capacity')
3637
3645
  cell_volts = get_cell_volts()
3638
3646
  if cell_volts is None:
3639
3647
  output_close()
@@ -3678,7 +3686,8 @@ def battery_info(log=0, plot=1, rated=None, count=None, info=1, bat=None):
3678
3686
  s +=f",{v:.0f}"
3679
3687
  return s
3680
3688
  output(f"Current SoC: {current_soc}%")
3681
- output(f"Capacity: {capacity:.2f}kWh" + (" (calculated)" if bat['residual_handling'] in [1,3] else ""))
3689
+ if capacity is not None:
3690
+ output(f"Capacity: {capacity:.2f}kWh" + (" (calculated)" if bat['residual_handling'] in [1,3] else ""))
3682
3691
  output(f"Residual: {residual:.2f}kWh" + (" (calculated)" if bat['residual_handling'] in [2,3] else ""))
3683
3692
  if rated_capacity is not None and bat_soh is not None:
3684
3693
  output(f"Rated Capacity: {rated_capacity / 1000:.2f}kWh")
@@ -1,7 +1,7 @@
1
1
  ##################################################################################################
2
2
  """
3
3
  Module: Fox ESS Cloud using Open API
4
- Updated: 11 January 2025
4
+ Updated: 27 January 2025
5
5
  By: Tony Matthews
6
6
  """
7
7
  ##################################################################################################
@@ -10,7 +10,7 @@ By: Tony Matthews
10
10
  # ALL RIGHTS ARE RESERVED © Tony Matthews 2024
11
11
  ##################################################################################################
12
12
 
13
- version = "2.7.7"
13
+ version = "2.7.9"
14
14
  print(f"FoxESS-Cloud Open API version {version}")
15
15
 
16
16
  debug_setting = 1
@@ -555,25 +555,29 @@ battery_data = ['soc', 'volt', 'current', 'power', 'temperature', 'residual']
555
555
  # 1 = Residual Energy, 2 = Residual Capacity (HV), 3 = Residual Capacity per battery (Mira)
556
556
  residual_handling = 1
557
557
 
558
- # charge rates based on residual_handling
558
+ # charge rates based on residual_handling. Index is bms temperature
559
559
  battery_params = {
560
- # cell temp -5 0 5 10 15 20 25 30 35 40 45 50 55
561
560
  # bms temp 5 10 15 20 25 30 35 40 45 50 55 60 65
561
+ # cell temp -5 0 5 10 15 20 25 30 35 40 45 50 55
562
562
  1: {'table': [ 0, 2, 10, 15, 25, 50, 50, 50, 50, 50, 30, 20, 0],
563
563
  'step': 5,
564
564
  'offset': 5,
565
565
  'charge_loss': 0.974,
566
566
  'discharge_loss': 0.974},
567
- # HV BMS v2 with firmware 1.014 or later
568
- 2: {'table': [ 0, 2, 10, 10, 15, 15, 25, 50, 50, 50, 30, 20, 0],
567
+ # HV BMS v2 with firmware 1.014 or later
568
+ # bms temp 10 15 20 25 30 35 40 45 50 55 60 65 70
569
+ # cell temp 0 5 10 15 20 25 30 35 40 45 50 55 60
570
+ 2: {'table': [ 0, 5, 10, 15, 25, 50, 50, 50, 50, 25, 20, 3, 0],
569
571
  'step': 5,
570
- 'offset': 5,
572
+ 'offset': 11,
571
573
  'charge_loss': 1.08,
572
574
  'discharge_loss': 0.95},
573
- # Mira BMS with firmware 1.014 or later
574
- 3: {'table': [ 0, 2, 10, 10, 15, 15, 25, 50, 50, 50, 30, 20, 0],
575
+ # Mira BMS with firmware 1.014 or later
576
+ # bms temp 10 15 20 25 30 35 40 45 50 55 60 65 70
577
+ # cell temp 0 5 10 15 20 25 30 35 40 45 50 55 60
578
+ 3: {'table': [ 0, 5, 10, 15, 25, 50, 50, 50, 50, 25, 20, 3, 0],
575
579
  'step': 5,
576
- 'offset': 5,
580
+ 'offset': 11,
577
581
  'charge_loss': 0.974,
578
582
  'discharge_loss': 0.974},
579
583
  }
@@ -2624,6 +2628,7 @@ charge_needed_app_key = "awcr5gro2v13oher3v1qu6hwnovp28"
2624
2628
 
2625
2629
  # work out the charge times to set using the parameters:
2626
2630
  # forecast: the kWh expected tomorrow. If none, forecast data is loaded from solcast etc
2631
+ # consumption: the kWh consumed. If none, consumption is loaded from history
2627
2632
  # update_settings: 0 no updates, 1 update charge settings. The default is 0
2628
2633
  # show_data: 1 shows battery SoC, 2 shows battery residual. Default = 0
2629
2634
  # show_plot: 1 plots battery SoC, 2 plots battery residual. Default = 1
@@ -2631,7 +2636,7 @@ charge_needed_app_key = "awcr5gro2v13oher3v1qu6hwnovp28"
2631
2636
  # forecast_times: list of hours when forecast can be fetched (UTC)
2632
2637
  # force_charge: 1 = hold battery, 2 = charge for whole period
2633
2638
 
2634
- def charge_needed(forecast=None, update_settings=0, timed_mode=None, show_data=None, show_plot=None, run_after=None, reload=2,
2639
+ def charge_needed(forecast=None, consumption=None, update_settings=0, timed_mode=None, show_data=None, show_plot=None, run_after=None, reload=2,
2635
2640
  forecast_times=None, force_charge=0, test_time=None, test_soc=None, test_charge=None, **settings):
2636
2641
  global device, seasonality, solcast_api_key, debug_setting, tariff, solar_arrays, legend_location, time_shift, charge_needed_app_key
2637
2642
  global timed_strategy, steps_per_hour, base_time, storage, battery, battery_params
@@ -2847,6 +2852,9 @@ def charge_needed(forecast=None, update_settings=0, timed_mode=None, show_data=N
2847
2852
  consumption = annual_consumption / 365 * seasonality[now.month - 1] / sum(seasonality) * 12
2848
2853
  consumption_by_hour = daily_consumption
2849
2854
  output(f"\nEstimated consumption: {consumption:.1f}kWh")
2855
+ elif consumption is not None:
2856
+ consumption_by_hour = daily_consumption
2857
+ output(f"\nConsumption: {consumption:.1f}kWh")
2850
2858
  else:
2851
2859
  consumption_days = charge_config['consumption_days']
2852
2860
  consumption_days = 3 if consumption_days > 7 or consumption_days < 1 else consumption_days
@@ -3305,7 +3313,7 @@ def battery_info(log=0, plot=1, rated=None, count=None, info=1, bat=None):
3305
3313
  bat_current = bat['current']
3306
3314
  bat_power = bat['power']
3307
3315
  bms_temperature = bat['temperature']
3308
- capacity = bat['capacity']
3316
+ capacity = bat.get('capacity')
3309
3317
  cell_volts = get_cell_volts()
3310
3318
  if cell_volts is None:
3311
3319
  output_close()
@@ -3350,7 +3358,8 @@ def battery_info(log=0, plot=1, rated=None, count=None, info=1, bat=None):
3350
3358
  s +=f",{v:.0f}"
3351
3359
  return s
3352
3360
  output(f"Current SoC: {current_soc}%")
3353
- output(f"Capacity: {capacity:.2f}kWh" + (" (calculated)" if bat['residual_handling'] in [1,3] else ""))
3361
+ if capacity is not None:
3362
+ output(f"Capacity: {capacity:.2f}kWh" + (" (calculated)" if bat['residual_handling'] in [1,3] else ""))
3354
3363
  output(f"Residual: {residual:.2f}kWh" + (" (calculated)" if bat['residual_handling'] in [2,3] else ""))
3355
3364
  if rated_capacity is not None and bat_soh is not None:
3356
3365
  output(f"Rated Capacity: {rated_capacity / 1000:.2f}kWh")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foxesscloud
3
- Version: 2.7.7
3
+ Version: 2.7.9
4
4
  Summary: library for accessing Fox ESS cloud data using Open API
5
5
  Author-email: Tony Matthews <tony@quasair.co.uk>
6
6
  Project-URL: Homepage, https://github.com/TonyM1958/FoxESS-Cloud
@@ -358,7 +358,9 @@ All the parameters are optional:
358
358
 
359
359
  charge_needed() uses a number of models to better estimate the state of the battery.
360
360
 
361
- **Manual Consumption:** You can provide your 'annual_consumption' in kWh e.g. 5500. This figure is factored down to a daily consumption by dividing by 365 and applying **f.seasonality**. This normally decreases consumption in the summer and increases it in winter. Seasonality is a list of weightings by month for Jan, Feb, Mar, Apr etc. Preset lists are 'f.high_seasonality' (recommend where electric heating is ued), 'f.medium_seasonality' (default) amd 'f.no_seasonality' (all months the same). The daily consumption is profiled by hour using **f.daily_consumption**. This maps your consumption for a day to the hours when more or less energy is consumed. It is a list of 24 values for the times 00, 01, 02, 03 .. 23. Preset lists are 'f.high_profile' (larger peaks at 8am and 6pm), 'f.medium_profile' (default, more balanced) and 'f.no_profile' (flat).
361
+ **Manual Consumption:** You can provide your expected 'consumption' in kWh e.g. 15. This figure is used directly.
362
+
363
+ **Annual Consumption:** You can provide your 'annual_consumption' in kWh e.g. 5500. This figure is factored down to a daily consumption by dividing by 365 and applying **f.seasonality**. This normally decreases consumption in the summer and increases it in winter. Seasonality is a list of weightings by month for Jan, Feb, Mar, Apr etc. Preset lists are 'f.high_seasonality' (recommend where electric heating is ued), 'f.medium_seasonality' (default) amd 'f.no_seasonality' (all months the same). The daily consumption is profiled by hour using **f.daily_consumption**. This maps your consumption for a day to the hours when more or less energy is consumed. It is a list of 24 values for the times 00, 01, 02, 03 .. 23. Preset lists are 'f.high_profile' (larger peaks at 8am and 6pm), 'f.medium_profile' (default, more balanced) and 'f.no_profile' (flat).
362
364
 
363
365
  **Historic Consumption:** If annual_consumption is not provided, your consumption history is used. By default, this looks at your average consumption for the last 3 days using the load power reported by your inverter. For systems with multiple inverters where CT2 is not connected, the load power may not be correct. For this and other cases where you want to set your consumption, provide your annual_consumption.
364
366
 
@@ -807,6 +809,13 @@ This setting can be:
807
809
 
808
810
  # Version Info
809
811
 
812
+ 2.7.9<br>
813
+ Add 'consumption' input for charge_needed().
814
+ Avoid throwing exception in battery_info() if there is no capacity info.
815
+
816
+ 2.7.8<br>
817
+ Update the battery_params charge rate table to 2025 values.
818
+
810
819
  2.7.7<br>
811
820
  Updates to get_pvoutput() to support solar inverters that don't provide grid energy by setting tou=2.
812
821
  Default tariff changed to None.
File without changes
File without changes