Add user/ password to mqtt connection
HydrelioxGitHub opened this issue · 3 comments
HydrelioxGitHub commented
My mqtt server does not accept anonymous connection. I missed if there is any example about using username and password to connect to mqtt server in json config file.
sparten11740 commented
hey @HydrelioxGitHub, good point. The MQTT source accepts a username and password such as shown in the example below. I personally haven't tested this since my MQTT server is not password protected, but it should work. Maybe you could try that out and let me know? If it doesn't work I will setup a secured MQTT server and get that fixed. I will also add an example to the wiki.
{ "Sources" : [{
"Type": "Mqtt",
"Server": "192.168.1.2",
"Port": 1883,
"Username": "your username",
"Password": "your password",
"Topics": {
"Result": "stat/sonoff-1144-dimmer-5/RESULT"
},
}]
}
HydrelioxGitHub commented
Your example seems to work flawlessly !
PS E:\Logiciels Standalone\AllmyLights> .\AllMyLights.exe
2021-03-18 18:49:32 (INFO): Configuring 1 sources
2021-03-18 18:49:32 (INFO): Configuring 1 sinks
2021-03-18 18:49:35 (INFO): Connection to mqtt server xxx.xxx.xxx.xxx established
2021-03-18 18:49:35 (INFO): Attempting to subscribe to stat/sonoff-1144-dimmer-5/RESULT
2021-03-18 18:49:35 (INFO): Succesfully subscribed to stat/sonoff-1144-dimmer-5/RESULT
sparten11740 commented
That's good to hear :) I also added the example to the wiki.