Skip to content

Commit

Permalink
Update AsynBinary to verify ZNAM and ONAM are set in convert
Browse files Browse the repository at this point in the history
An warning will be printed if they are not set
  • Loading branch information
GDYendell committed Feb 20, 2024
1 parent 8c08731 commit ecf0c82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pvi/_convert/_asyn_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ class AsynBinary(AsynParameter):
read_widget: ReadWidgetUnion = Field(LED())
write_widget: WriteWidgetUnion = Field(ToggleButton())

def model_post_init(self, __context: Any) -> None:
if self.write_record is not None:
if not all(f in self.write_record.fields for f in ("ZNAM", "ONAM")):
print(
f"WARNING: ZNAM/ONAM not set for {self.write_record.pv}. "
"Button labels will be blank."
)


class AsynBusy(AsynBinary):
"""Asyn Busy Parameter and records"""
Expand Down

0 comments on commit ecf0c82

Please sign in to comment.