Skip to content

Commit

Permalink
Fixed slave name
Browse files Browse the repository at this point in the history
  • Loading branch information
samson0v committed Dec 18, 2024
1 parent fe31783 commit 7c78245
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions thingsboard_gateway/connectors/modbus/slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ def __init__(self, connector, logger, config):
self.stopped = False
self._log = logger
self.connector = connector
self.name = "Modbus slave processor for unit " + str(config['unitId']) + " on host " + str(
config['host']) + ":" + str(config['port']) + ' ' + config['deviceName']
self.type = config.get('type', 'tcp').lower()

if self.type == 'serial':
self.name = "Modbus slave processor for unit " + str(config['unitId']) + " on port " + str(config['port']) + ' ' + config['deviceName']
else:
self.name = "Modbus slave processor for unit " + str(config['unitId']) + " on host " + str(
config.get('host')) + ":" + str(config['port']) + ' ' + config['deviceName']

self.callback = connector.callback

self.unit_id = config['unitId']
self.host = config.get('host')
self.port = config['port']
self.type = config.get('type', 'tcp').lower()
self.method = config['method']
self.tls = config.get('tls', {})
self.timeout = config.get('timeout')
Expand Down

0 comments on commit 7c78245

Please sign in to comment.