File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -388,8 +388,8 @@ class Device:
388388 definition : Definition | None = None
389389 states : States = field (factory = States )
390390 type : ProductType
391- ui_class : UIClass | None = None
392- widget : UIWidget | None = None
391+ ui_class : UIClass = field ( default = None ) # type: ignore[assignment]
392+ widget : UIWidget = field ( default = None ) # type: ignore[assignment]
393393 identifier : DeviceIdentifier = field (init = False , repr = False )
394394 oid : str | None = field (repr = obfuscate_id , default = None )
395395 place_oid : str | None = None
@@ -411,6 +411,9 @@ def __attrs_post_init__(self) -> None:
411411 if self .widget is None and self .definition .widget_name :
412412 self .widget = UIWidget (self .definition .widget_name )
413413
414+ if self .ui_class is None or self .widget is None :
415+ raise ValueError (f"Device { self .device_url } is missing ui_class or widget" )
416+
414417 def supports_command (self , command : str | OverkizCommand ) -> bool :
415418 """Check if device supports a command."""
416419 return self .definition is not None and str (command ) in self .definition .commands
You can’t perform that action at this time.
0 commit comments