flashforge-python-api 1.2.2__py3-none-any.whl → 1.2.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.
flashforge/__init__.py CHANGED
@@ -127,7 +127,7 @@ from .tcp import (
127
127
  )
128
128
 
129
129
  FiveMClient = FlashForgeClient
130
- __version__ = "1.2.2"
130
+ __version__ = "1.2.3"
131
131
  __author__ = "FlashForge Python API Contributors"
132
132
  __email__ = "notghosttypes@gmail.com"
133
133
  __description__ = "Python library for controlling FlashForge 3D printers"
@@ -14,6 +14,14 @@ if TYPE_CHECKING:
14
14
  from ...client import FlashForgeClient
15
15
 
16
16
 
17
+ # Firmware-reported PIDs from FlashForge's /detail endpoint. These are stable
18
+ # identifiers set by firmware, unlike the user-mutable `name` field.
19
+ PID_5M = 35
20
+ PID_5M_PRO = 36
21
+ PID_AD5X = 38
22
+ KNOWN_HTTP_PIDS = {PID_5M, PID_5M_PRO, PID_AD5X}
23
+
24
+
17
25
  class MachineInfoParser:
18
26
  """
19
27
  Transforms printer detail data from the API response format into a structured FFMachineInfo object.
@@ -68,8 +76,17 @@ class MachineInfoParser:
68
76
  or len(getattr(getattr(detail, "matl_station_info", None), "slot_infos", []) or []) > 0
69
77
  )
70
78
  printer_name = getattr(detail, "name", "") or ""
71
- is_ad5x = printer_name.upper() == "AD5X" or has_material_station
72
- is_pro = "Pro" in printer_name and not is_ad5x
79
+ pid = getattr(detail, "pid", None)
80
+
81
+ if pid in KNOWN_HTTP_PIDS:
82
+ is_ad5x = pid == PID_AD5X
83
+ is_pro = pid == PID_5M_PRO
84
+ else:
85
+ # Fallback for firmware that doesn't report pid: legacy
86
+ # name+capability heuristic. Vulnerable to user renames, which
87
+ # is why pid-based detection is preferred when available.
88
+ is_ad5x = printer_name.upper() == "AD5X" or has_material_station
89
+ is_pro = "Pro" in printer_name and not is_ad5x
73
90
 
74
91
  # Build the FFMachineInfo object
75
92
  machine_info = FFMachineInfo(
@@ -107,6 +124,7 @@ class MachineInfoParser:
107
124
  fill_amount=getattr(detail, "fill_amount", 0) or 0,
108
125
  firmware_version=getattr(detail, "firmware_version", "") or "",
109
126
  name=printer_name,
127
+ pid=pid,
110
128
  is_pro=is_pro,
111
129
  is_ad5x=is_ad5x,
112
130
  nozzle_size=getattr(detail, "nozzle_model", "") or "",
@@ -324,6 +324,7 @@ class FFMachineInfo(BaseModel):
324
324
  fill_amount: float = 0.0
325
325
  firmware_version: str = ""
326
326
  name: str = ""
327
+ pid: int | None = None
327
328
  is_pro: bool = False
328
329
  is_ad5x: bool = False
329
330
  nozzle_size: str = ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashforge-python-api
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: A comprehensive Python library for controlling FlashForge 3D printers
5
5
  Project-URL: Homepage, https://github.com/GhostTypes/ff-5mp-api-py
6
6
  Project-URL: Documentation, https://github.com/GhostTypes/ff-5mp-api-py#readme
@@ -1,4 +1,4 @@
1
- flashforge/__init__.py,sha256=NjSFURsQlavWjvD6CikOj01SXqpdmGF-PlAHyLXtc-4,5336
1
+ flashforge/__init__.py,sha256=TkwDdU0toTFKhbDE6-9P85X8o4_GKwkdFTp4CcdFMt4,5336
2
2
  flashforge/client.py,sha256=lplKJxNOLhUJMusm025cj7rZvWRAiv2j5qENdBIctuA,16920
3
3
  flashforge/api/__init__.py,sha256=vQz-DkG6LTH39bI4fyiUc0D9jQzemLh45pORLptSOlg,335
4
4
  flashforge/api/constants/__init__.py,sha256=Q0HL2tqSBYPd4Oz49VHLS3qUvRuv__GCvTGecaLrQ-Y,163
@@ -7,7 +7,7 @@ flashforge/api/constants/endpoints.py,sha256=zU_ONPyLUATr1KPlk0x8SLrK4ojs4QiiWr1
7
7
  flashforge/api/controls/__init__.py,sha256=53s-H25Pjwr0kvPk8MZ2Twy8VHGqGcO6Q6uBphhEOh4,293
8
8
  flashforge/api/controls/control.py,sha256=8wK2YOGf9NphWXsjIDapyQEfx-qGZgytXZFsjKeWvSA,11291
9
9
  flashforge/api/controls/files.py,sha256=8T9kzgss_2DYFL4WVuEFj8W9sOPPPMIMq3dTq1d551w,6560
10
- flashforge/api/controls/info.py,sha256=KVExwaeDd1SYiSOBZVVtif3Rf_cJkw4Bizhgm6dbAS8,12398
10
+ flashforge/api/controls/info.py,sha256=CesJXAQZkmF_o9dNKeZmeu_44ysDK4Lj8uHRwAVcv4w,13086
11
11
  flashforge/api/controls/job_control.py,sha256=-DglR97DWBzl45mmqGkauYpUM_I-C0tXrbp9SKPYOVs,21814
12
12
  flashforge/api/controls/temp_control.py,sha256=TGkX63WHygVA9DeYfLARbktZ0o-bYX6MNyYOX6V_RB4,3034
13
13
  flashforge/api/filament/__init__.py,sha256=isT2dl0hzUS0xMTXMm4Tip0GTG1gCsm8LKWa9xPu4Y8,104
@@ -21,7 +21,7 @@ flashforge/api/network/utils.py,sha256=hh-9SGI61ii0CRkLVnAp-Eq2E0a9PAKPyNLMGaYPN
21
21
  flashforge/discovery/__init__.py,sha256=G0WiP70EhfHdjXR1RNlv6xjhyHOdo-HWyOm9J0ds4SM,828
22
22
  flashforge/discovery/discovery.py,sha256=ka75bIXnn2a14DEpzpmJxUGajF-tpLHUR2EHA88NIGc,26073
23
23
  flashforge/models/__init__.py,sha256=MNpnXdS6Yah5kSwBB7cbA2Hd-8azffE62pgUrrKSZk4,984
24
- flashforge/models/machine_info.py,sha256=t7TJk03PG8kf-g6XnWd3NiWuCVLY1Wuod-aI4zdXu4Y,14976
24
+ flashforge/models/machine_info.py,sha256=HDOzXi9RaYgFPkqtYe8dLyM5c8ZUCFfZ_uefGIj1VYM,15003
25
25
  flashforge/models/responses.py,sha256=befMeXAc7XXiK7emF8Ep2cd1GuhZ-zyYPbbPqS2lcQI,7214
26
26
  flashforge/tcp/__init__.py,sha256=hpnqoWHeRtTwJPzdsVlwGt1njKbAkrgIHKADkLSIRec,1317
27
27
  flashforge/tcp/a3_client.py,sha256=a1jdDcBnTSNrzJFKTuVV13fSLbZmxKEZ94n3cGf3wOA,15603
@@ -39,8 +39,8 @@ flashforge/tcp/parsers/print_status.py,sha256=4q9ZlJfO0c7_t1o15tgxbguMxpDjEW9pMy
39
39
  flashforge/tcp/parsers/printer_info.py,sha256=QY6LECfcOhVHSIdsvQZwJago0OjXroUwiX0H-uQaH2A,5411
40
40
  flashforge/tcp/parsers/temp_info.py,sha256=9Waf68tt-4QBcChyUwfMHDwWdIzM4mmDpZAKeAzklgs,7908
41
41
  flashforge/tcp/parsers/thumbnail_info.py,sha256=ZmxdEbVFOzqR1AfhXXZyjENVI66BdRdE7Q8LQ8an9FY,10201
42
- flashforge_python_api-1.2.2.dist-info/METADATA,sha256=fgIgmb7nLlupuynCJcbY5V-fF_g4hNI48e9d61Qym0s,4787
43
- flashforge_python_api-1.2.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
44
- flashforge_python_api-1.2.2.dist-info/entry_points.txt,sha256=AkOxlsLvQ7cvMLxn7tlzfKp_DCH2hXhbVceHIXxawpU,66
45
- flashforge_python_api-1.2.2.dist-info/licenses/LICENSE,sha256=-cTA-hrmvlb3pqlQrBZQXUnKayhUjsLJMPb7TD91frM,1067
46
- flashforge_python_api-1.2.2.dist-info/RECORD,,
42
+ flashforge_python_api-1.2.3.dist-info/METADATA,sha256=8Gji1l3nedh4E53ZM5AE7wkP0JoPBGOucAoBIK_yEO4,4787
43
+ flashforge_python_api-1.2.3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
44
+ flashforge_python_api-1.2.3.dist-info/entry_points.txt,sha256=AkOxlsLvQ7cvMLxn7tlzfKp_DCH2hXhbVceHIXxawpU,66
45
+ flashforge_python_api-1.2.3.dist-info/licenses/LICENSE,sha256=-cTA-hrmvlb3pqlQrBZQXUnKayhUjsLJMPb7TD91frM,1067
46
+ flashforge_python_api-1.2.3.dist-info/RECORD,,