mirror of
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git
synced 2025-12-14 05:46:49 +01:00
add json config
This commit is contained in:
@@ -7,11 +7,11 @@ MqttPlugin::MqttPlugin(MqttConfig cfg)
|
||||
mqttConfig.clientName = cfg.clientName;
|
||||
mqttConfig.inTopicRoot = cfg.inTopicRoot;
|
||||
mqttConfig.outTopicRoot = cfg.outTopicRoot;
|
||||
mqttConfig.fromFile("/mqttConfig.json");
|
||||
}
|
||||
|
||||
void MqttPlugin::activate(Scheduler *scheduler)
|
||||
{
|
||||
mqttConfig.fromFile("/mqttConfig.json");
|
||||
client = new PubSubClient(mqttConfig.brokerHost, mqttConfig.brokerPort, bind(&MqttPlugin::downstreamHandler, this, _1, _2, _3), wifiClient);
|
||||
enableConnectTask(scheduler);
|
||||
enableProcessTask(scheduler);
|
||||
|
||||
@@ -26,7 +26,7 @@ void setup()
|
||||
});
|
||||
sprocket->addTask(publishHeap);
|
||||
sprocket->addPlugin(
|
||||
new MqttPlugin({"sprocket", "192.168.1.2", 1883, "wirelos/mqttSprocket-in/", "wirelos/mqttSprocket-out/"}));
|
||||
new MqttPlugin({"sprocket", "broker.lan", 1883, "wirelos/mqttSprocket-in/", "wirelos/mqttSprocket-out/"}));
|
||||
|
||||
network = new WiFiNet(
|
||||
SPROCKET_MODE,
|
||||
|
||||
Reference in New Issue
Block a user