simplyprint: add power device fallback

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan committed 2022-08-08 19:48:13 -04:00
1 parent 3424f1b3e2
commit 413e3b2f4f
1 file changed
+6
+6
View File
@@ -126,6 +126,12 @@ class SimplyPrint(Subscribable):
"Section [simplyprint], option 'power_device': Unable "
f"to locate configuration for power device {power_id}"
)
else:
power_pfx = config.get_prefix_sections("power ")
if len(power_pfx) == 1:
name = power_pfx[0][6:]
if "printer" in name.lower():
self.power_id = name
self.filament_sensor: str = ""
fsensor = config.get("filament_sensor", None)
fs_prefixes = ["filament_switch_sensor ", "filament_motion_sensor "]