Skip to content

Commit

Permalink
feat: Allow HEX number in configuration file (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinying authored Oct 28, 2024
1 parent adb869f commit 6324269
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modpoll/modbus_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _parse_config(self, csv_reader) -> List[Device]:
continue
device_name = row[1].strip()
try:
device_id = int(row[2])
device_id = int(row[2], 0)
except ValueError:
self.logger.error(f"Invalid device ID for {device_name}")
continue
Expand Down Expand Up @@ -359,8 +359,8 @@ def _create_poller(self, row, current_device):
return None
fc = row[1].lower()
try:
start_address = int(row[2])
size = int(row[3])
start_address = int(row[2], 0)
size = int(row[3], 0)
except ValueError:
self.logger.error("Invalid start address or size for poller")
return None
Expand Down Expand Up @@ -403,7 +403,7 @@ def _create_reference(self, row, current_device):
return None
ref_name = row[1].replace(" ", "_")
try:
address = int(row[2])
address = int(row[2], 0)
except ValueError:
self.logger.error(f"Invalid address for reference {ref_name}")
return None
Expand Down

0 comments on commit 6324269

Please sign in to comment.