Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT connection with username and password #3

Open
auriux opened this issue Aug 3, 2019 · 2 comments
Open

MQTT connection with username and password #3

auriux opened this issue Aug 3, 2019 · 2 comments

Comments

@auriux
Copy link

auriux commented Aug 3, 2019

Hi,
Thanks for amazing code, wanted to adapt it to my arduino uno r3 and fallen to first problem. How can i add username and password to MQTT broken connection inside your code? Tried:
client.connect("randomNAME", mqttUser, mqttPassword ) with no luck.
Thanks in advance.

@auriux
Copy link
Author

auriux commented Aug 3, 2019

fixed it, had to change the code to:
client.setServer(mqttServer, mqttPort);
client.setCallback(callback);
while (!client.connected()) {
Serial.println("Connecting to MQTT...");
if (client.connect("RandomNAME", mqttUser, mqttPassword )) {
Serial.println("connected");
} else {
Serial.print("failed with state ");
Serial.print(client.state());
delay(2000);
}
}
Now i need to figure out how to set rules in openHAB for button presses to toggle sonoff tasmota. Cannot achieve that yet, toggle action does not work from the rules. :/

@auriux
Copy link
Author

auriux commented Aug 4, 2019

No toggle.. Had to create two rules for one switch, one with command ON, second with command OFF. For every relay two rules in openHAB.. Maybe will need to try to learn NodeRED, i think there I should need to create double rules for one relay..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant