Can not connect to remote device


#1

I have a WeMos mini connected to a motor and am trying to get Cayenne to turn it on for a variable period of time.

I have been able to modify ESP8266.ino to achieve this.

I created the device on my dashboard, added a button and a slider. The button turns the motor on/off and the slider turns it on for a variable amount of time set by the slider. The ‘uptime’ display from the ESP8266 code displays the number of mS since powerup.

All works well from either Chrome or Firefox on my Mac.

On my Samsung S6 and my Nexus7 - both running android Cayenne - The On/Off button works, and the “uptime” value that I left in from the original example works, however the slider gives “can not connect to remote device”.

Anybody have any ideas about this?


Help with ESP8266 compilation warning
#2

@jcruz1 @bestes tagging for this bug.


#3

Hey, i really need your help. i want to understand all of this stuff so help


#4

@sagalyusuf3 what problem are you facing?


#5

I’m trying to learn how each device work but it’s not working for me


#6

you have to be more specific and give a bit more information about the problem you are facing.


#7

I am not sure how the replies relate to the problem or the request for ideas.


#8

@jmarchbold the bug you are facing is a new one and the team needs to find the cause between it.


#9

How can I help?

Here is the code:

D5, D6, D7 identify the WeMos pins.
Only D5 is presently used.
D6, D7 relate to the encoder software.

`
// This example shows how to connect to Cayenne using an ESP8266 and send/receive sample data.
// Make sure you install the ESP8266 Board Package via the Arduino IDE Board Manager and select the correct ESP8266 board before compiling.

//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
// #include <Encoder.h>

// WiFi network info.
char ssid[] = "xxxxxx";
char wifiPassword[] = "xxxxx;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";

unsigned long lastMillis = 0;

#define TIME_CHANNEL 3
#define CONTROL_CHANNEL 2
Encoder myEnc(D6, D7);
#define MotorPin D5  // Turn motor on/off
int MotorTime;

void setup() {
	Serial.begin(9600);
  pinMode(MotorPin, INPUT);
  digitalWrite(MotorPin, HIGH);
	Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

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

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
	// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
	Cayenne.virtualWrite(0, millis());
	// Some examples of other functions you can use to send data.
	//Cayenne.celsiusWrite(1, 22.0);
	//Cayenne.luxWrite(2, 700);
	//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}

// This function is called when data is sent from Cayenne.
CAYENNE_IN(TIME_CHANNEL)
{
  MotorTime = getValue.asInt(); // 0 to 255
  CAYENNE_LOG("Channel %d, pin %d, value %d", TIME_CHANNEL, MotorPin, MotorTime);
  // Write the value received to the PWM pin. analogWrite accepts a value from 0 to 255.
  if (MotorTime > 0) {
    Serial.print("Running for ");
    Serial.print(MotorTime);
    Serial.print(" seconds - ");
    pinMode(MotorPin, OUTPUT);
    digitalWrite(MotorPin, LOW);
    delay(MotorTime*1000);
    Serial.println("Stopped");
    pinMode(MotorPin, INPUT);
    digitalWrite(MotorPin, HIGH);    
  }
  else {
    Serial.println("Stopped");
    pinMode(MotorPin, INPUT);
    digitalWrite(MotorPin, HIGH);
  }
}

// This function is called when data is sent from Cayenne.
CAYENNE_IN(CONTROL_CHANNEL)
{
  CAYENNE_LOG("Channel %d, pin %d, value %d", CONTROL_CHANNEL, MotorPin, getValue.asInt());
  // Write the value received to the PWM pin. analogWrite accepts a value from 0 to 255.
  if (getValue.asInt() > 0) {
    Serial.println("Running...");
    pinMode(MotorPin, OUTPUT);
    digitalWrite(MotorPin, LOW);   
  }
  else if (getValue.asInt() == 0) {
    Serial.println("Stopped...");
    pinMode(MotorPin, INPUT);
    digitalWrite(MotorPin, HIGH);
  }
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
	CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
	//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}

`

Here is the screen shot on Mac:


#10

Samsung S6 screenshots:


#11

Thank you so much


#12

Any progress - at the moment I have to take my Mac with me! I would much rather use the Nexus


#13

Any progress?