simplyprint: add power device fallback

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-08-08 19:42:14 -04:00
parent 3424f1b3e2
commit 413e3b2f4f
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 6 additions and 0 deletions

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 "]