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