Arduino MQTT


#22

i just now added a new wemos device without any problem.


#23

is that a relay board you have connected in the xyz button?


#24

Adding a board is not a problem as i said before, adding the sensors is.


#25

This is what i get when trying to add a relay. Unreachable. Also the values of my DHT22 temperature sensor is not correct.


#26

I just noticed in mobile app , ios, all devices-boards are disabled. What a disaster!!!


#27

Hi @ufrtgr,

If you have some time, let’s jump on a Skype call with @jcruz1 . I’d like to see exactly what you are saying is not working and help get you going in the right direction. Everything is working fine on our end.

Have you transitioned your Arduino’s to use the MQTT libraries? This post may help with that: Converting Cayenne Arduino LIbrary sketches to Cayenne MQTT Arduino

~Benny


#28

Hello Benny, i followed the transition information. Mobile app required an updated, its ok now. But i am not able to add an Relay-Actuator. I dont know whats the difference when adding a board like arduino, by selecting Bring your own thing or selecting an arduino from the Microcontrollers options. I have tried both solutions. If i choose Bring your own thing option, then custom widget doesnt work as Step:2 Add Widget doesnt work. If i’ll try to add the relay from actuators->Relay or Actuators-Generic, when selecting device, the board is not there, is not showing see picture below although “device25b1” is on network (but is grey, faded).

If i want to add an Actuator->Relay i have to choose only boards imported to Cayenne dashboard without “Bring your own thing” method, see below.


#29

I tried that way. Some things have already been able to make it work, but relays do not.


#30

@ufrtgr when a device is added using “Bring your own thing” use a custom button widget.


#31

i think i have managed to add an actuator. i managed to add a button from mobile. Tha dashboard from computer doesn’t allow me to add an actuator. But still there is seems some kind of lag when sending the command. Sometimes the relay changes state some seconds after the last command is executed.

Also with the DHT22 sensor i am using, the values in the dashboard goes to 0 for couple of seconds and afterwards they go back to normal.

Last, i wanted to ask if the old routines CAYENNE_OUT functions if they work or not? Also from the dashboard when adding a button and check the sketch file, it doesnt suggests to change the virtual pin from #define VIRTUAL_PIN 1 to const int VIRTUAL_PIN etc. Also what is the best procedure to use? The millis method in the loop function or we let cayenne automatically sends data? Another thing i have noticed is that if we change CAYENNE_OUT to void some_function(int VIRTUAL_PIN) method as it is suggested for the MQTT transition, in the loop function only the some_function(VIRTUAL_PIN) must be declared, otherwise statement like “Cayenne.virtualWrite(VIRTUAL_PIN)” doesnt seem to send data to cayenne, or maybe i am doing something wrong.


#32

I think i have replied to that. It doesn’t work. The step2: Add Widget button can not be clicked. Only from mobile i think is possible and only virtual channels. Also the invert logic is no longer there.


#33

@ufrtgr yes we will be fixing this bug soon! Thank you for helping to bring it to our attention!

~benny


#34

Hi @ufrtgr,
I have setup a BYOT device with a simple LED on Pin/Channel 2.
I was able to add a custom button by going to Add Widget > Custom Widget > Button > Filled in the info & set as Channel 2.
See here:

Then I was able to turn on/off the LED through this button:
image

Are these the steps you’re taking?
Maybe you can try my sketch file & see if this works for you?

// This example shows how to connect to the Cayenne MQTT broker using a WiFi shield and send some sample data.

#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTWiFi.h>

unsigned long lastMillis = 0;

int ledPin = 2;

char *ssid = “xxxxxxxx”;
char *wifiPassword = “xxxxxxxxxxx”;

char username[] = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
char password[] = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
char clientID[] = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;

void setup() {
Serial.begin(9600);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
pinMode(2,OUTPUT);
digitalWrite(2, HIGH);
Cayenne.virtualWrite(2, 0, “digital_actuator”, “d”);
}

void loop() {
Cayenne.loop();

if (millis() - lastMillis > 15000) {
    lastMillis = millis();
    //char buffer[64];
    //CayenneValueArray values(buffer, sizeof(buffer));
    //values.add("lat", 3.45);
    //values.add("long", 7.89);
    //Cayenne.virtualWrite(10, values, "gps");
    Cayenne.virtualWrite(0, lastMillis);
    Cayenne.virtualWrite(4, digitalRead(0), TYPE_PROXIMITY, UNIT_CENTIMETER);
    //Cayenne.virtualWrite(4, digitalRead(0),  TYPE_PROXIMITY, UNIT_MILLIMETER);
    Cayenne.celsiusWrite(1, 12.0);
    Cayenne.fahrenheitWrite(3, 89.0);
    //Cayenne.kelvinWrite(0, 12.25);
    //Cayenne.luxWrite(0, 13.25);
    //Cayenne.pascalWrite(0, 14.25);
    //Cayenne.hectoPascalWrite(0, 15.25);
    //Cayenne.relativeHumidityWrite(0, 16.25);
}

}

CAYENNE_CONNECTED()
{
CAYENNE_LOG(“CAYENNE_CONNECTED”);
}

CAYENNE_DISCONNECTED()
{
CAYENNE_LOG(“CAYENNE_DISCONNECTED”);
}

CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel , getValue.getId(), getValue.asString());
Serial.flush();
if (strcmp(getValue.asStr(), “error”) == 0) {
getValue.setError(“Error message”);
}
}

//Receive data on channel
CAYENNE_IN(2)
{
//Write state to the pin
digitalWrite(ledPin, getValue.asInt());
}
CAYENNE_OUT_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_OUT_DEFAULT”);
}

Thanks
-Jesse


#35

Does this code compiles in your sketch?


#36

Hi @ufrtgr,
Yes it does.
I’m using an Arduino Uno w/ an Arduino Wifi Shield.
Did you make sure to install the Cayenne MQTT Libraries?

What errors are you getting when trying to compile?

Thanks.
-Jesse


#37

I can not log in in my account. Who can help?

Regards

Michalis


#38

Hi @ufrtgr,

You can’t log into the community? Or into Cayenne?
What errors do you get?
Can you send screenshots?

Thanks.


#39

Community


#40

Hi @ufrtgr,

Try this: Go to cayenne.mydevices.com & login to your account.
Go to the upper right corner & log out. Close all tabs & windows.
Then go back to cayenne.mydevices.com & log back in.
Click Community on the upper right corner & try to login again.

Let me know if that works.
Thanks.


#41

No , same thing.

Login Error

There is a problem with your account. Please contact the site’s administrator.