mirror of
https://github.com/alexhopeoconnor/SunGather.git
synced 2026-10-23 02:52:10 +10:00
change default client id to include the inverter model
This commit is contained in:
@@ -11,11 +11,12 @@ class export_mqtt(object):
|
|||||||
|
|
||||||
# Configure MQTT
|
# Configure MQTT
|
||||||
def configure(self, config, inverter):
|
def configure(self, config, inverter):
|
||||||
|
model = inverter.getInverterModel(True)
|
||||||
self.mqtt_config = {
|
self.mqtt_config = {
|
||||||
'host': config.get('host', None),
|
'host': config.get('host', None),
|
||||||
'port': config.get('port', 1883),
|
'port': config.get('port', 1883),
|
||||||
'client_id': config.get('client_id', 'SunGather'),
|
'client_id': config.get('client_id', f'SunGather-{model}'),
|
||||||
'topic': config.get('topic', "inverter/{model}/registers").replace('{model}', inverter.getInverterModel(True)),
|
'topic': config.get('topic', f"inverter/{model}/registers"),
|
||||||
'username': config.get('username', None),
|
'username': config.get('username', None),
|
||||||
'password': config.get('password',None),
|
'password': config.get('password',None),
|
||||||
'homeassistant': config.get('homeassistant',False)
|
'homeassistant': config.get('homeassistant',False)
|
||||||
|
|||||||
Reference in New Issue
Block a user