From babfaca3cca07eb1344199b8a92113ccb28e6a8e Mon Sep 17 00:00:00 2001 From: Daniel Havlik Date: Sun, 29 May 2022 09:41:19 +0200 Subject: [PATCH] change default client id to include the inverter model --- SunGather/exports/mqtt.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SunGather/exports/mqtt.py b/SunGather/exports/mqtt.py index 2adfaa6..4838fa8 100644 --- a/SunGather/exports/mqtt.py +++ b/SunGather/exports/mqtt.py @@ -11,11 +11,12 @@ class export_mqtt(object): # Configure MQTT def configure(self, config, inverter): + model = inverter.getInverterModel(True) self.mqtt_config = { 'host': config.get('host', None), 'port': config.get('port', 1883), - 'client_id': config.get('client_id', 'SunGather'), - 'topic': config.get('topic', "inverter/{model}/registers").replace('{model}', inverter.getInverterModel(True)), + 'client_id': config.get('client_id', f'SunGather-{model}'), + 'topic': config.get('topic', f"inverter/{model}/registers"), 'username': config.get('username', None), 'password': config.get('password',None), 'homeassistant': config.get('homeassistant',False)