SAIC-iSmart-API / saic-python-mqtt-gateway

MIT License
66 stars 20 forks source link

Improvement : Condition to test if publisher to MQTT server is enable #74

Open lbourdel opened 1 year ago

lbourdel commented 1 year ago

For my case, I don't need to send informations to MQTT server, I only need to send them to abrp live data.

Is it possible to disable MQTT publisher if mqtt_uri is not provided.

Thanks

lbourdel commented 1 year ago

I found a workaround to not run MQTT publisher:

class MqttGateway: def __init__(self, config: Configuration): ... # test to not publish to MQTT if self.configuration.mqtt_host != '0.0.0.0': self.publisher.connect()

Then give MQTT server's IP=0.0.0.0

In cmdline : -mtcp://0.0.0.0:1883