foxesscloud 2.8.2__py3-none-any.whl → 2.8.3__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.
@@ -1,7 +1,7 @@
1
1
  ##################################################################################################
2
2
  """
3
3
  Module: Fox ESS Cloud
4
- Updated: 09 April 2025
4
+ Updated: 16 April 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.9.4"
13
+ version = "1.9.5"
14
14
  print(f"FoxESS-Cloud version {version}")
15
15
 
16
16
  debug_setting = 1
@@ -1005,6 +1005,13 @@ merge_settings = { # keys to add
1005
1005
  'unit': '℃'},
1006
1006
  }
1007
1007
 
1008
+ # change named settings, if required, so names match between Fox API and Open API
1009
+ translate_names = {
1010
+ 'MaxSoc': 'MaximumSoC',
1011
+ 'MinSoc': 'MinimumSoC',
1012
+ 'MinSocOnGrid': 'MinimumSoC-OnGrid'
1013
+ }
1014
+
1008
1015
  def get_ui():
1009
1016
  global device_id, debug_setting, messages, remote_settings, named_settings, merge_settings
1010
1017
  if get_device() is None:
@@ -1069,7 +1076,7 @@ def get_ui():
1069
1076
  return remote_settings
1070
1077
 
1071
1078
  def get_remote_settings(key):
1072
- global device_id, debug_setting, messages
1079
+ global device_id, debug_setting, messages, translate_settings
1073
1080
  if get_device() is None:
1074
1081
  return None
1075
1082
  output(f"getting remote settings", 2)
@@ -1101,7 +1108,7 @@ def get_remote_settings(key):
1101
1108
  return values
1102
1109
 
1103
1110
  def get_named_settings(name):
1104
- global named_settings
1111
+ global named_settings, translate_names
1105
1112
  if get_device() is None:
1106
1113
  return None
1107
1114
  if type(name) is list:
@@ -1109,10 +1116,11 @@ def get_named_settings(name):
1109
1116
  for n in name:
1110
1117
  result.append(get_named_settings(n))
1111
1118
  return result
1112
- if named_settings is None or named_settings.get(name) is None:
1119
+ key_name = translate_names[name] if translate_names.get(name) is not None else name
1120
+ if named_settings is None or named_settings.get(key_name) is None:
1113
1121
  output(f"** get_named_settings(): {name} was not recognised")
1114
1122
  return None
1115
- keys = named_settings[name].get('keys')
1123
+ keys = named_settings[key_name].get('keys')
1116
1124
  if keys is None:
1117
1125
  output(f"** get_named_settings(): no keys for name: {name}")
1118
1126
  return None
@@ -1121,8 +1129,8 @@ def get_named_settings(name):
1121
1129
  if result is None:
1122
1130
  output(f"** get_named_settings(): no result for {name} using key: {keys}")
1123
1131
  return None
1124
- result_type = named_settings[name].get('type')
1125
- value_type = named_settings[name].get('valueType')
1132
+ result_type = named_settings[key_name].get('type')
1133
+ value_type = named_settings[key_name].get('valueType')
1126
1134
  if result_type is None:
1127
1135
  v = result.get([k for k in result.keys()][0])
1128
1136
  return v if value_type is None else c_float(v) if value_type == 'float' else c_int(v)
@@ -1134,7 +1142,7 @@ def get_named_settings(name):
1134
1142
  return result
1135
1143
 
1136
1144
  def set_named_settings(name, value, force=0):
1137
- global named_settings
1145
+ global named_settings, translate_names
1138
1146
  if get_device() is None:
1139
1147
  return None
1140
1148
  if force == 1 and get_schedule().get('enable'):
@@ -1144,18 +1152,19 @@ def set_named_settings(name, value, force=0):
1144
1152
  for (n, v) in name:
1145
1153
  result.append(set_named_settings(name=n, value=v))
1146
1154
  return result
1147
- if named_settings is None or named_settings.get(name) is None:
1155
+ key_name = translate_names[name] if translate_names.get(name) is not None else name
1156
+ if named_settings is None or named_settings.get(key_name) is None:
1148
1157
  output(f"** set_named_settings(): {name} was not recognised")
1149
1158
  return None
1150
- keys = named_settings[name].get('keys')
1159
+ keys = named_settings[key_name].get('keys')
1151
1160
  if keys is None:
1152
1161
  output(f"** set_named_settings(): no keys for name: {name}")
1153
1162
  return None
1154
- item_type = named_settings[name].get('type')
1163
+ item_type = named_settings[key_name].get('type')
1155
1164
  if item_type is None:
1156
1165
  values = {keys: str(value)}
1157
1166
  elif item_type == 'block':
1158
- items = named_setting[name]['items']
1167
+ items = named_setting[key_name]['items']
1159
1168
  n = len(items)
1160
1169
  if type(value) is not list or n != len(value):
1161
1170
  output(f"** set_named_settings(): {name} requires list of {n} values")
foxesscloud/openapi.py CHANGED
@@ -1,7 +1,7 @@
1
1
  ##################################################################################################
2
2
  """
3
3
  Module: Fox ESS Cloud using Open API
4
- Updated: 09 April 2025
4
+ Updated: 16 April 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.8.2"
13
+ version = "2.8.3"
14
14
  print(f"FoxESS-Cloud Open API version {version}")
15
15
 
16
16
  debug_setting = 1
@@ -861,6 +861,7 @@ def get_remote_settings(name):
861
861
  values[x] = v[x]
862
862
  return values
863
863
  body = {'sn': device_sn, 'key': name}
864
+ setting_delay()
864
865
  response = signed_post(path="/op/v0/device/setting/get", body=body)
865
866
  if response.status_code != 200:
866
867
  output(f"** get_remote_settings() got response code {response.status_code}: {response.reason}")
@@ -1016,10 +1017,9 @@ def get_flag():
1016
1017
  if result is None:
1017
1018
  return None
1018
1019
  if schedule is None:
1019
- schedule = {'enable': None, 'support': None, 'periods': None}
1020
+ schedule = {'enable': None, 'support': None, 'periods': None, 'maxsoc': False}
1020
1021
  schedule['enable'] = result.get('enable')
1021
1022
  schedule['support'] = result.get('support')
1022
- schedule['maxsoc'] = False
1023
1023
  if device.get('function') is not None and device['function'].get('scheduler') is not None:
1024
1024
  device['function']['scheduler'] = schedule['support']
1025
1025
  return schedule
@@ -1055,6 +1055,8 @@ def get_schedule():
1055
1055
  for g in result['groups']:
1056
1056
  if g['enable'] == 1 and g['workMode'] in work_modes:
1057
1057
  schedule['periods'].append(g)
1058
+ if g.get('maxSoc') is not None:
1059
+ schedule['maxsoc'] = True
1058
1060
  return schedule
1059
1061
 
1060
1062
  # build strategy using current schedule
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foxesscloud
3
- Version: 2.8.2
3
+ Version: 2.8.3
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
@@ -132,13 +132,14 @@ Additional battery attributes provided include:
132
132
 
133
133
  get_settings() will return the battery settings and is equivalent to get_charge() and get_min(). The results are stored in f.battery_settings. The settings include minSoc, minSocOnGrid, enable charge from grid and the charge times.
134
134
 
135
- get_flag() returns the current scheduler enable / support / maxsoc flags
135
+ get_flag() returns the current scheduler enable / support / maxsoc flags. By default support for Max Soc is set to False.
136
136
 
137
137
  get_schedule() returns the current work mode / soc schedule settings. The result is stored in f.schedule.
138
+ + if the schedule returned contains any values for 'maxSoc', the f.schedule['maxsoc'] is set to True to indicate that the current inverter supports setting Max Soc in schedules and Max Soc values are set by set_schedule().
138
139
 
139
140
  get_named_settings() returns the value of a named setting. If 'name' is a list, it returns a list of values.
140
- + f.named_settings is updated. This is dictionary of information and current value, indexed by 'name.
141
- + the only name currently supported by Fox is 'ExportLimit' and this is only available for H3 inverters.
141
+ + f.named_settings is updated. This is dictionary of information and current value, indexed by 'name'.
142
+ + named_settings current supported include: ExportLimit, MinSoc, MinSocOnGrid, MaxSoc, GridCode
142
143
 
143
144
 
144
145
  ## Inverter Settings
@@ -194,8 +195,8 @@ set_schedule() configures a list of scheduled work mode / soc changes with enabl
194
195
  set_named_settings() sets the 'name' setting to 'value'.
195
196
  + 'name' may also be a list of (name, value) pairs.
196
197
  + 'force': setting to 1 will disable Mode Scheduler, if enabled. Default is 0.
197
- + A return value of 1 is success. 0 means setting failed. None is another error e.g. device not found, invalid name or value.
198
- + the only 'name' currently supported is 'ExportLimit'
198
+ + a return value of 1 is success. 0 means setting failed. None is another error e.g. device not found, invalid name or value.
199
+ + named_settings current supported include: ExportLimit, MinSoc, MinSocOnGrid, MaxSoc, GridCode
199
200
 
200
201
 
201
202
  ## Real Time Data
@@ -820,6 +821,9 @@ This setting can be:
820
821
 
821
822
  # Version Info
822
823
 
824
+ 2.8.3<br>
825
+ Update to support setting Max Soc in schedules now this is supported by Fox using Open API.
826
+
823
827
  2.8.2<br>
824
828
  Fix forecast.solar (after change to start parameter processing).
825
829
  Change logic around battery status so 0 is offline and others values are online.
@@ -0,0 +1,7 @@
1
+ foxesscloud/foxesscloud.py,sha256=E48TEwk75XrLcJNXNvuMwG93VjjIYknuPERqSYGhRDE,224825
2
+ foxesscloud/openapi.py,sha256=d-qKK_XjpnRQpnAQ7HcLZSP7hbViHQ9tckM5o4Xf0eE,208484
3
+ foxesscloud-2.8.3.dist-info/LICENCE,sha256=8JF-24QkE8UfdII-g6RaIEvM-PZ9zwaEcxlwYUDMt-4,1079
4
+ foxesscloud-2.8.3.dist-info/METADATA,sha256=ECLbKmesBVJ5HRnvGXTw842d9q8XPhAc2y0MKuP9AyE,65179
5
+ foxesscloud-2.8.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
6
+ foxesscloud-2.8.3.dist-info/top_level.txt,sha256=IWOrKSNZCLU6IDXSX_b4_bqCfbZoWAT4CC0w0Lg7PuU,12
7
+ foxesscloud-2.8.3.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- foxesscloud/foxesscloud.py,sha256=vX5EffYUgLaeeHJImRVBPaQCCykthPBaT8AyyuoeoJM,224362
2
- foxesscloud/openapi.py,sha256=LuB2NpQZKQ1TSWWQ-8DAnDZ4CuBHjj6EH8Q0PnHmyGI,208392
3
- foxesscloud-2.8.2.dist-info/LICENCE,sha256=8JF-24QkE8UfdII-g6RaIEvM-PZ9zwaEcxlwYUDMt-4,1079
4
- foxesscloud-2.8.2.dist-info/METADATA,sha256=W_DdQjHq-w_8eLQ8aI9AdDKUq2LY-Wnxt_BTmuRpGWE,64767
5
- foxesscloud-2.8.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
6
- foxesscloud-2.8.2.dist-info/top_level.txt,sha256=IWOrKSNZCLU6IDXSX_b4_bqCfbZoWAT4CC0w0Lg7PuU,12
7
- foxesscloud-2.8.2.dist-info/RECORD,,