Buttons after update

FYI: I logged into my dashboard through Chrome on my laptop and the buttons appear to work properly so it seems most problems occur when I try to operate my devices via the mydevices.com dashboard through IOS (Ipad) using Chrome or Safari.

why don’t you use the cayenne app on the ipad?

Of all the ways I’ve tried to access/control my devices the IOS app seems to be the most troublesome. Issues like having to reconfigure my dashboard every time I access the app to buttons not functioning. Also, seems to stop communicating with your servers anytime the app loses focus on IOS device. I’ll try it though to see if working better now. Thanks.

Everything in the code seems fine. If you open the debug console in your browser do you see any errors when it doesn’t work?

Hi I am using Cayenne MQTT and I have same problems with buttons today, yesterday everything was fine. So I pressed button an it “waitng” forever, sometimes it works and I see value changed of button channel in debug serial of device. What can be wrong today?

yes, we are looking into this issue. will inform once we fix it.

@diygoodies can you test it now and let me know.

Yes , now its fine

2 Likes

Hi, its 2020 now and I’m new to this thing and I have encounter the same problem with the button continue spinning. I’m using;
Arduino Uno,
Cytron ESP wifi shield,
Servo motor,
firefox browser/ application in android phone (both have the same result of the button continue spinning)

this is the code that I am using;

define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>

// WiFi network info.
char ssid = “”;
char wifiPassword = “”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “”;
char password = “”;
char clientID = “”;

#define VIRTUAL_CHANNEL 1
#define ACTUATOR_PIN 5

// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
//#define EspSerial Serial1

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

ESP8266 wifi(&EspSerial);

void setup()
{
Serial.begin(9600);
delay(10);

// Set ESP8266 baud rate
EspSerial.begin(9600);
delay(10);

Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}

void loop()
{
Cayenne.loop();
}

// Enable or disable the motor based on value received on virtual channel.
CAYENNE_IN(VIRTUAL_CHANNEL)
{
int speed = 155;
// Read the integer value which should be 0 or 1.
int enabled = getValue.asInt();
if (enabled == 1) {
// Turn on the motor at the specified speed.
analogWrite(ACTUATOR_PIN, speed);
}
else {
// Turn off the motor.
analogWrite(ACTUATOR_PIN, 0);
}
}

can you share the serial monitor output with #define CAYENNE_DEBUG uncommented.

00:31:02.177 → [1652581] Disconnected
00:31:02.211 → [1652581] Connecting to mqtt.mydevices.com:1883
00:31:04.176 → [1654566] Connected
00:31:05.394 → [1655799] Publish: topic 4, channel 65534, value Arduino Uno, subkey , key
00:31:10.426 → [1660839] Publish: topic 6, channel 65534, value ATmega328P, subkey , key
00:31:15.449 → [1665878] Publish: topic 7, channel 65534, value 16000000, subkey , key
00:31:20.499 → [1670914] Publish: topic 5, channel 65534, value 1.3.0, subkey , key
00:31:25.532 → [1675947] Publish: topic 8, channel 65534, value ESP8266Shield, subkey , key
00:31:25.599 → [1675991] Connection ok
00:31:33.720 → [1684162] Message received: topic 2, channel 1
00:31:33.788 → [1684163] In: value 1, channel 1
00:31:33.821 → [1684182] publishState: topic 1 channel 1
00:31:33.855 → [1684226] Publish: topic 1, channel 1, value 1, subkey , key
00:31:38.894 → [1689319] Send response: tH2qqyuLJyzKtDK
00:31:43.903 → [1694348] Connection ok

it continues with “connection ok” but the widget still spinning

Is your device currently online?

yes it is online

can you private message me your cayenne account email id, so i can do some testing.

I am having an issue where the button spins and does nothing and then the device goes offline. This had worked fine previously but now when i went back on today it stopped working. I am sending a 1 or 0 to my code but it just spins until it goes offline after about 20 seconds or so.

can you share the code, serial monitor output and screenshot of your dashbaord.

code

I am trying to have it so that when the button is pressed either on or off it will run the function which should change my LCD display. This was previously working and now its not. When my script is run the device shows as online but when i press the button it keeps spinning and shortly after it goes offline even though the script is still running.

Follow this steps:

  1. add new —> device/widgets ----> arduino ----> this will give you MQTT credentials, add it into below code and run it.

     #!/usr/bin/env python
     import cayenne.client
     import time
     import logging
    
     # Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
     MQTT_USERNAME  = "MQTT_USERNAME"
     MQTT_PASSWORD  = "MQTT_PASSWORD"
     MQTT_CLIENT_ID = "MQTT_CLIENT_ID"
    
    
     # The callback for when a message is received from Cayenne.
     def on_message(message):
         print("message received: " + str(message))
         if (message.channel == 4) and (message.value == "1"):
             ranum()
         else:
              ranum()
         
     client = cayenne.client.CayenneMQTTClient()
     client.on_message = on_message
     client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID, loglevel=logging.INFO)
     # For a secure connection use port 8883 when calling client.begin:
     # client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID, port=8883, loglevel=logging.INFO)
    
     i=0
     timestamp = 0
    
     while True:
         client.loop()
         
         if (time.time() > timestamp + 10):
             client.virtualWrite(1, i)
             timestamp = time.time()
             i = i+1
    
  2. add new —>device/widgets ----> actuators ----> generic —>digtal output–> fill all details and add.

You need to send some data at an interval to keep the device online which is done using client.virtualWrite(1, i). this will create a green widget, add it to your dashboard by clicking on `+~
You can also see if there is any issue in the logs.

Thanks. This is connecting me however it is not running my function even though it is receiving the message on the correct channel and the correct message value.