@@ -37,9 +37,9 @@ class DeviceType(Enum):
3737 @classmethod
3838 def get_url_prefix (cls , device_type ) -> str : # noqa: ANN001
3939 """Get the URL prefix for a given device type."""
40- if device_type == cls .SPH_MIX or device_type == cls .SPH_MIX .value :
40+ if device_type in ( cls .SPH_MIX , cls .SPH_MIX .value ) :
4141 return "mix"
42- elif device_type == cls .MIN_TLX or device_type == cls .MIN_TLX .value : # noqa: RET505
42+ elif device_type in ( cls .MIN_TLX , cls .MIN_TLX .value ) : # noqa: RET505
4343 return "tlx"
4444 else :
4545 msg = f"Unsupported device type: { device_type } "
@@ -290,56 +290,57 @@ def pv_onoff_to_params(params: "OpenApiV1.PvOnOffParams") -> dict:
290290
291291 @staticmethod
292292 def grid_voltage_to_params (params : "OpenApiV1.GridVoltageParams" ) -> dict :
293- """Convert GridVoltageParams to API parameters."""
293+ """
294+ Convert GridVoltageParams to API parameters.
295+
296+ Note: This currently only supports voltage_high.
297+ voltage_low would require a different command.
298+ """
294299 return {
295- "param1" : str (params .voltage_high ), # For high voltage
296- # OR
297- "param1" : str (
298- params .voltage_low
299- ), # For low voltage (different command)
300+ "param1" : str (params .voltage_high ),
301+ # Note: voltage_low requires different command, not implemented
300302 }
301303
302304 @staticmethod
303305 def off_grid_to_params (params : "OpenApiV1.OffGridParams" ) -> dict :
304- """Convert OffGridParams to API parameters."""
306+ """
307+ Convert OffGridParams to API parameters.
308+
309+ Note: This currently only supports off_grid_enabled.
310+ frequency and voltage would require different commands.
311+ """
305312 return {
306313 "param1" : "1" if params .off_grid_enabled else "0" ,
307- # OR for frequency/voltage (different commands)
308- "param1" : str (params .frequency ),
309- # OR
310- "param1" : str (params .voltage ),
314+ # Note: frequency and voltage require different commands, not implemented
311315 }
312316
313317 @staticmethod
314318 def power_to_params (params : "OpenApiV1.PowerParams" ) -> dict :
315- """Convert PowerParams to API parameters."""
319+ """
320+ Convert PowerParams to API parameters.
321+
322+ Note: This currently only supports active_power.
323+ reactive_power and power_factor would require different commands.
324+ """
316325 return {
317- "param1" : str (params .active_power ), # For active power
318- # OR
319- "param1" : str (params .reactive_power ), # For reactive power
320- # OR
321- "param1" : str (params .power_factor ), # For power factor
326+ "param1" : str (params .active_power ),
327+ # Note: reactive_power and power_factor require different commands, not implemented
322328 }
323329
324330 @staticmethod
325331 def charge_discharge_to_params (
326332 params : "OpenApiV1.ChargeDischargeParams" ,
327333 ) -> dict :
328- """Convert ChargeDischargeParams to API parameters."""
334+ """
335+ Convert ChargeDischargeParams to API parameters.
336+
337+ Note: This currently only supports charge_power.
338+ Other parameters (charge_stop_soc, discharge_power, discharge_stop_soc,
339+ ac_charge_enabled) would require different commands.
340+ """
329341 return {
330- "param1" : str (params .charge_power ), # For charge_power command
331- # OR
332- "param1" : str (params .charge_stop_soc ), # For charge_stop_soc command
333- # OR
334- "param1" : str (params .discharge_power ), # For discharge_power command
335- # OR
336- "param1" : str (
337- params .discharge_stop_soc
338- ), # For discharge_stop_soc command
339- # OR
340- "param1" : "1"
341- if params .ac_charge_enabled
342- else "0" , # For ac_charge command
342+ "param1" : str (params .charge_power ),
343+ # Note: Other parameters require different commands, not implemented
343344 }
344345
345346 class DeviceEnergyHistoryParams (NamedTuple ):
0 commit comments