Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions custom_components/solix_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
F2000,
F3800,
Generic,
MagGo3in1,
PrimeCharger160w,
PrimeCharger250w,
PrimePowerBank20k,
Expand Down Expand Up @@ -56,6 +57,8 @@ def get_power_station_class(model: Models) -> SolixBLEDevice:
return PrimeCharger250w
elif model is Models.PRIME_POWER_BANK_20K:
return PrimePowerBank20k
elif model is Models.MAGGO_3IN1:
return MagGo3in1
elif model is Models.SOLARBANK_2:
return Solarbank2
elif model is Models.UNKNOWN:
Expand Down
1 change: 1 addition & 0 deletions custom_components/solix_ble/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,5 @@ class Models(Enum):
PRIME_CHARGER_250 = "Prime Charger (250w)"
PRIME_POWER_BANK_20K = "Prime Power Bank 20k (220w)"
SOLARBANK_2 = "Solarbank 2"
MAGGO_3IN1 = "MagGo 3-in-1 Wireless Charger (A25x7)"
UNKNOWN = "Unknown"
24 changes: 24 additions & 0 deletions custom_components/solix_ble/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
C1000G2,
F2000,
F3800,
MagGo3in1,
PrimeCharger160w,
PrimeCharger250w,
PrimePowerBank20k,
Expand Down Expand Up @@ -1121,6 +1122,29 @@ async def async_setup_entry(
)
)

# MagGo 3-in-1 wireless charger: per-pad power + total
if type(device) in [MagGo3in1]:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be individual so that devices which might have just 1 wireless charging pad can make use of this code by just adding them to the list for that sensor.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — split into three separate per-pad blocks, each gated on its own if type(device) in [MagGo3in1]: list, so a future single-pad device can be added to just the relevant pad's sensor.

sensors.append(
SolixSensorEntity(
device, "Pad 1 Power", "W", "pad_1_power", SensorDeviceClass.POWER
)
)
sensors.append(
SolixSensorEntity(
device, "Pad 2 Power", "W", "pad_2_power", SensorDeviceClass.POWER
)
)
sensors.append(
SolixSensorEntity(
device, "Pad 3 Power", "W", "pad_3_power", SensorDeviceClass.POWER
)
)
sensors.append(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already is a sensor for total power that can be re-used.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the bespoke Total Power sensor and added MagGo3in1 to the existing "Total Power Out" (power_out) list instead.

SolixSensorEntity(
device, "Total Power", "W", "total_power", SensorDeviceClass.POWER
)
)

async_add_entities(sensors)


Expand Down