foxesscloud 2.7.2__py3-none-any.whl → 2.7.4__py3-none-any.whl
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.
- foxesscloud/foxesscloud.py +16 -16
- foxesscloud/openapi.py +15 -10
- {foxesscloud-2.7.2.dist-info → foxesscloud-2.7.4.dist-info}/METADATA +7 -1
- foxesscloud-2.7.4.dist-info/RECORD +7 -0
- foxesscloud-2.7.2.dist-info/RECORD +0 -7
- {foxesscloud-2.7.2.dist-info → foxesscloud-2.7.4.dist-info}/LICENCE +0 -0
- {foxesscloud-2.7.2.dist-info → foxesscloud-2.7.4.dist-info}/WHEEL +0 -0
- {foxesscloud-2.7.2.dist-info → foxesscloud-2.7.4.dist-info}/top_level.txt +0 -0
foxesscloud/foxesscloud.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################################
|
2
2
|
"""
|
3
3
|
Module: Fox ESS Cloud
|
4
|
-
Updated:
|
4
|
+
Updated: 13 December 2024
|
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.
|
13
|
+
version = "1.8.5"
|
14
14
|
print(f"FoxESS-Cloud version {version}")
|
15
15
|
|
16
16
|
debug_setting = 1
|
@@ -491,15 +491,16 @@ def get_device(sn=None):
|
|
491
491
|
remote_settings = get_ui()
|
492
492
|
# parse the model code to work out attributes
|
493
493
|
model_code = device['deviceType'].upper()
|
494
|
-
|
495
|
-
|
494
|
+
if model_code[:1] == 'T':
|
495
|
+
model_code = 'T3-' + model_code[1:]
|
496
|
+
elif model_code[:2] == 'KH':
|
496
497
|
model_code = 'KH-' + model_code[2:]
|
497
498
|
elif model_code[:4] == 'AIO-':
|
498
499
|
model_code = 'AIO' + model_code[4:]
|
499
500
|
device['eps'] = 'E' in model_code
|
500
501
|
parts = model_code.split('-')
|
501
502
|
model = parts[0]
|
502
|
-
if model not in ['KH', 'H1', 'AC1', 'H3', 'AC3', 'AIOH1', 'AIOH3']:
|
503
|
+
if model not in ['T3', 'KH', 'H1', 'AC1', 'H3', 'AC3', 'AIOH1', 'AIOH3']:
|
503
504
|
output(f"** device model not recognised for deviceType: {device['deviceType']}")
|
504
505
|
return device
|
505
506
|
device['model'] = model
|
@@ -507,13 +508,15 @@ def get_device(sn=None):
|
|
507
508
|
for p in parts[1:]:
|
508
509
|
if p.replace('.','').isnumeric():
|
509
510
|
power = float(p)
|
510
|
-
if power >= 1.0 and power <
|
511
|
+
if power >= 1.0 and power < 50.0:
|
511
512
|
device['power'] = float(p)
|
512
513
|
break
|
513
514
|
if device.get('power') is None:
|
514
515
|
output(f"** device power not found for deviceType: {device['deviceType']}")
|
515
516
|
# set max charge current
|
516
|
-
if model in ['
|
517
|
+
if model in ['T3']:
|
518
|
+
device['max_charge_current'] = None
|
519
|
+
elif model in ['KH']:
|
517
520
|
device['max_charge_current'] = 50
|
518
521
|
elif model in ['H1', 'AC1']:
|
519
522
|
device['max_charge_current'] = 35
|
@@ -809,7 +812,7 @@ def time_period(t):
|
|
809
812
|
return result
|
810
813
|
|
811
814
|
def set_charge(ch1=True, st1=0, en1=0, ch2=True, st2=0, en2=0, force=0, enable=1):
|
812
|
-
global device_sn, battery_settings, debug_setting, messages
|
815
|
+
global device_sn, battery_settings, debug_setting, messages
|
813
816
|
if get_device() is None:
|
814
817
|
return None
|
815
818
|
if battery_settings is None:
|
@@ -818,9 +821,8 @@ def set_charge(ch1=True, st1=0, en1=0, ch2=True, st2=0, en2=0, force=0, enable=1
|
|
818
821
|
battery_settings['times'] = []
|
819
822
|
battery_settings['times'].append({'tip': '', 'enableCharge': True, 'enableGrid': False, 'startTime': {'hour': 0, 'minute': 0}, 'endTime': {'hour': 0, 'minute': 0}})
|
820
823
|
battery_settings['times'].append({'tip': '', 'enableCharge': True, 'enableGrid': False, 'startTime': {'hour': 0, 'minute': 0}, 'endTime': {'hour': 0, 'minute': 0}})
|
821
|
-
|
822
|
-
|
823
|
-
if schedule.get('enable') == True:
|
824
|
+
flag = get_flag()
|
825
|
+
if flag is not None and flag.get('enable') == True:
|
824
826
|
if force == 0:
|
825
827
|
output(f"** set_charge(): cannot set charge when a schedule is enabled")
|
826
828
|
return None
|
@@ -1250,8 +1252,6 @@ def get_flag():
|
|
1250
1252
|
errno = response.json().get('errno')
|
1251
1253
|
if errno == 40256:
|
1252
1254
|
output(f"** get_flag(), not suported on this device")
|
1253
|
-
else:
|
1254
|
-
output(f"** get_flag()), no result data, {errno_message(errno)}")
|
1255
1255
|
return None
|
1256
1256
|
if schedule is None:
|
1257
1257
|
schedule = {'enable': None, 'support': None, 'pollcy': None}
|
@@ -1781,7 +1781,7 @@ def report_value_profile(result):
|
|
1781
1781
|
current_total = sum(by_hour)
|
1782
1782
|
result = []
|
1783
1783
|
for t in range(0, 24):
|
1784
|
-
result.append(by_hour[t] * daily_average / current_total)
|
1784
|
+
result.append(by_hour[t] * daily_average / current_total if current_total != 0.0 else 0.0)
|
1785
1785
|
return (daily_average, result)
|
1786
1786
|
|
1787
1787
|
# forwards compatibility
|
@@ -1840,7 +1840,7 @@ def get_report(report_type='day', d=None, v=None, summary=1, save=None, load=Non
|
|
1840
1840
|
return None
|
1841
1841
|
id_name = 'deviceID' if station == 0 else 'stationID'
|
1842
1842
|
id_code = device_id if station == 0 else station_id
|
1843
|
-
query_path = '/
|
1843
|
+
query_path = '/generic/w/v0/device/history/report' if station == 0 else '/generic/w/v0/plant/history/report'
|
1844
1844
|
# process list of days
|
1845
1845
|
if d is not None and type(d) is list:
|
1846
1846
|
result_list = []
|
@@ -3067,7 +3067,7 @@ def charge_needed(forecast=None, update_settings=0, timed_mode=None, show_data=N
|
|
3067
3067
|
output(f"full_charge = {full_charge}")
|
3068
3068
|
if test_soc is not None:
|
3069
3069
|
current_soc = test_soc
|
3070
|
-
capacity = 14.
|
3070
|
+
capacity = 14.40
|
3071
3071
|
residual = test_soc * capacity / 100
|
3072
3072
|
bat_volt = 317.4
|
3073
3073
|
bat_power = 0.0
|
foxesscloud/openapi.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################################
|
2
2
|
"""
|
3
3
|
Module: Fox ESS Cloud using Open API
|
4
|
-
Updated:
|
4
|
+
Updated: 13 December 2024
|
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.
|
13
|
+
version = "2.7.4"
|
14
14
|
print(f"FoxESS-Cloud Open API version {version}")
|
15
15
|
|
16
16
|
debug_setting = 1
|
@@ -481,7 +481,8 @@ def get_device(sn=None):
|
|
481
481
|
# remote_settings = get_ui()
|
482
482
|
# parse the model code to work out attributes
|
483
483
|
model_code = device['deviceType'].upper()
|
484
|
-
|
484
|
+
if model_code[:1] == 'T':
|
485
|
+
model_code = 'T3-' + model_code[1:]
|
485
486
|
if model_code[:2] == 'KH':
|
486
487
|
model_code = 'KH-' + model_code[2:]
|
487
488
|
elif model_code[:4] == 'AIO-':
|
@@ -489,7 +490,7 @@ def get_device(sn=None):
|
|
489
490
|
device['eps'] = 'E' in model_code
|
490
491
|
parts = model_code.split('-')
|
491
492
|
model = parts[0]
|
492
|
-
if model not in ['KH', 'H1', 'AC1', 'H3', 'AC3', 'AIOH1', 'AIOH3']:
|
493
|
+
if model not in ['T3', 'KH', 'H1', 'AC1', 'H3', 'AC3', 'AIOH1', 'AIOH3']:
|
493
494
|
output(f"** device model not recognised for deviceType: {device['deviceType']}")
|
494
495
|
return device
|
495
496
|
device['model'] = model
|
@@ -497,13 +498,15 @@ def get_device(sn=None):
|
|
497
498
|
for p in parts[1:]:
|
498
499
|
if p.replace('.','').isnumeric():
|
499
500
|
power = float(p)
|
500
|
-
if power >= 1.0 and power <
|
501
|
+
if power >= 1.0 and power < 50.0:
|
501
502
|
device['power'] = float(p)
|
502
503
|
break
|
503
504
|
if device.get('power') is None:
|
504
505
|
output(f"** device power not found for deviceType: {device['deviceType']}")
|
505
506
|
# set max charge current
|
506
|
-
if model in ['
|
507
|
+
if model in ['T3']:
|
508
|
+
device['max_charge_current'] = None
|
509
|
+
elif model in ['KH']:
|
507
510
|
device['max_charge_current'] = 50
|
508
511
|
elif model in ['H1', 'AC1']:
|
509
512
|
device['max_charge_current'] = 35
|
@@ -693,7 +696,8 @@ def set_charge(ch1=True, st1=0, en1=0, ch2=True, st2=0, en2=0, force = 0, enable
|
|
693
696
|
battery_settings['times']['enable2'] = False
|
694
697
|
battery_settings['times']['startTime2'] = {'hour': 0, 'minute': 0}
|
695
698
|
battery_settings['times']['endTime2'] = {'hour': 0, 'minute': 0}
|
696
|
-
|
699
|
+
flag = get_flag()
|
700
|
+
if flag is not None and flag.get('enable') == 1:
|
697
701
|
if force == 0:
|
698
702
|
output(f"** set_charge(): cannot set charge when a schedule is enabled")
|
699
703
|
return None
|
@@ -1002,7 +1006,8 @@ def get_flag():
|
|
1002
1006
|
return None
|
1003
1007
|
result = response.json().get('result')
|
1004
1008
|
if result is None:
|
1005
|
-
|
1009
|
+
if errno == 40256:
|
1010
|
+
output(f"** get_flag(), not suported on this device")
|
1006
1011
|
return None
|
1007
1012
|
if schedule is None:
|
1008
1013
|
schedule = {'enable': None, 'support': None, 'periods': None}
|
@@ -1477,7 +1482,7 @@ def report_value_profile(result):
|
|
1477
1482
|
current_total = sum(by_hour)
|
1478
1483
|
result = []
|
1479
1484
|
for t in range(0, 24):
|
1480
|
-
result.append(by_hour[t] * daily_average / current_total)
|
1485
|
+
result.append(by_hour[t] * daily_average / current_total if current_total != 0.0 else 0.0)
|
1481
1486
|
return (daily_average, result)
|
1482
1487
|
|
1483
1488
|
# rescale history data based on time and steps
|
@@ -2727,7 +2732,7 @@ def charge_needed(forecast=None, update_settings=0, timed_mode=None, show_data=N
|
|
2727
2732
|
output(f"full_charge = {full_charge}")
|
2728
2733
|
if test_soc is not None:
|
2729
2734
|
current_soc = test_soc
|
2730
|
-
capacity = 14.
|
2735
|
+
capacity = 14.40
|
2731
2736
|
residual = test_soc * capacity / 100
|
2732
2737
|
bat_volt = 317.4
|
2733
2738
|
bat_power = 0.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: foxesscloud
|
3
|
-
Version: 2.7.
|
3
|
+
Version: 2.7.4
|
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
|
@@ -807,6 +807,12 @@ This setting can be:
|
|
807
807
|
|
808
808
|
# Version Info
|
809
809
|
|
810
|
+
2.7.4<br>
|
811
|
+
Update to support T series inverters.
|
812
|
+
|
813
|
+
2.7.3<br>
|
814
|
+
Fix divide by zero error if get_report() returns no data.
|
815
|
+
|
810
816
|
2.7.2<br>
|
811
817
|
Fix to get_battery() to return error and flag status=0 in f.battery when the cloud is not returning valid data.
|
812
818
|
Fix exception calculating SoH if ratedCapacity is returned as 0 when cloud is not returning valid data.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
foxesscloud/foxesscloud.py,sha256=-StB3jyYKQc0dIdzx0vZK8eBHgThZMwT9rquaXo6gh4,222979
|
2
|
+
foxesscloud/openapi.py,sha256=tcc83zs1e_Z9aKc0l9r5LYA5Mi0-c1i-hlaR-vOnfVU,207126
|
3
|
+
foxesscloud-2.7.4.dist-info/LICENCE,sha256=-3xv8CElCJV8Bc8PbAsg3iyxMpAK8MoJneM3rXigxqI,1074
|
4
|
+
foxesscloud-2.7.4.dist-info/METADATA,sha256=A8wIra0loiQQ0DuliBSRn_BcmmcDGw3j8VLTuB2h2S8,62438
|
5
|
+
foxesscloud-2.7.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6
|
+
foxesscloud-2.7.4.dist-info/top_level.txt,sha256=IWOrKSNZCLU6IDXSX_b4_bqCfbZoWAT4CC0w0Lg7PuU,12
|
7
|
+
foxesscloud-2.7.4.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
foxesscloud/foxesscloud.py,sha256=OLhRTCJKCR1pp02nrxOGkEUyGpFxftJ6fvWOaxCSHHw,222936
|
2
|
-
foxesscloud/openapi.py,sha256=pdswoEnPm9fFFJnC9uxvs_DeqFbrwHy3L6ImBnKPXZE,206937
|
3
|
-
foxesscloud-2.7.2.dist-info/LICENCE,sha256=-3xv8CElCJV8Bc8PbAsg3iyxMpAK8MoJneM3rXigxqI,1074
|
4
|
-
foxesscloud-2.7.2.dist-info/METADATA,sha256=N58su8ukQyapfXLbAqdZ6y5MkVJ-3aOB26iLM--GP3E,62314
|
5
|
-
foxesscloud-2.7.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6
|
-
foxesscloud-2.7.2.dist-info/top_level.txt,sha256=IWOrKSNZCLU6IDXSX_b4_bqCfbZoWAT4CC0w0Lg7PuU,12
|
7
|
-
foxesscloud-2.7.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|