sinric icon indicating copy to clipboard operation
sinric copied to clipboard

wemos board control with Alexa

Open 4x1ks opened this issue 7 years ago • 39 comments

Newbie alert...I have an arduino d1 mini. I added the sinric skill to alexa smart home. I uploaded code to turn the BUILTIN_LED on and off. The mini shows up on my wifi. The alexa app finds my device "bigrelay."

When I ask Alexa to turn on or off the device, she says "ok" but nothing happens. The LED does not change state.

I think my code is ok, it isn't mine..I copied it. I also tried the code to control 5v to a pin to a relay and this also did not work. I'm thinking that it isn't the code, it is the Alexa / Wemos connection.

Any help is appreciated very much.

Mark

4x1ks avatar Apr 01 '18 08:04 4x1ks

When you ask to turn on or off does it print anything in serial console?

On Sun, Apr 1, 2018 at 3:29 PM 4x1ks [email protected] wrote:

Newbie alert...I have an arduino d1 mini. I added the sinric skill to alexa smart home. I uploaded code to turn the BUILTIN_LED on and off. The mini shows up on my wifi. The alexa app finds my device "bigrelay."

When I ask Alexa to turn on or off the device, she says "ok" but nothing happens. The LED does not change state.

I think my code is ok, it isn't mine..I copied it. I also tried the code to control 5v to a pin to a relay and this also did not work. I'm thinking that it isn't the code, it is the Alexa / Wemos connection.

Any help is appreciated very much.

Mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIM5imeFjSCwP9OTFNboacyG3CZRCMhks5tkI_mgaJpZM4TCwfP .

kakopappa avatar Apr 01 '18 08:04 kakopappa

Thanks for writing me.

No text in serial print except for the WIFI connecting message and my Lan port.. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 13:27 mark rosenberg [email protected] wrote:

Thanks for writing me.

This is what get when I upload. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 11:58 Aruna Tennakoon [email protected] wrote:

When you ask to turn on or off does it print anything in serial console?

On Sun, Apr 1, 2018 at 3:29 PM 4x1ks [email protected] wrote:

Newbie alert...I have an arduino d1 mini. I added the sinric skill to alexa smart home. I uploaded code to turn the BUILTIN_LED on and off. The mini shows up on my wifi. The alexa app finds my device "bigrelay."

When I ask Alexa to turn on or off the device, she says "ok" but nothing happens. The LED does not change state.

I think my code is ok, it isn't mine..I copied it. I also tried the code to control 5v to a pin to a relay and this also did not work. I'm thinking that it isn't the code, it is the Alexa / Wemos connection.

Any help is appreciated very much.

Mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55, or mute the thread < https://github.com/notifications/unsubscribe-auth/AHIM5imeFjSCwP9OTFNboacyG3CZRCMhks5tkI_mgaJpZM4TCwfP

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377772947, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqC4o7ydUWihDKmFpMyh4AgNIFBnDks5tkJavgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 10:04 4x1ks

this is my code

#include <Arduino.h> #include <ESP8266WiFi.h> #include "fauxmoESP.h"

#define WIFI_SSID "Sura Office" #define WIFI_PASS "password" #define SERIAL_BAUDRATE 115200

fauxmoESP fauxmo;

//

// Wifi //

void wifiSetup() {

// Set WIFI module to STA mode
WiFi.mode(WIFI_STA);

// Connect
Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS);

// Wait
while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(100);
}
Serial.println();

// Connected!
Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n",

WiFi.SSID().c_str(), WiFi.localIP().toString().c_str()); }

void callback(uint8_t device_id, const char * device_name, bool state) { Serial.print("Device "); Serial.print(device_name); Serial.print(" state: "); if (state) { Serial.println("ON"); digitalWrite(D4,HIGH); } else { Serial.println("OFF"); digitalWrite(D4,LOW); } }

void setup() { // Init serial port and clean garbage Serial.begin(SERIAL_BAUDRATE); Serial.println("FauxMo demo sketch"); Serial.println("After connection, ask Alexa/Echo to 'turn on' or 'off'");

pinMode (D4,OUTPUT);

// Wifi
wifiSetup();

// Fauxmo
fauxmo.addDevice("Fish Tank");
fauxmo.onMessage(callback);

}

void loop() { fauxmo.handle(); }

On Sun, Apr 1, 2018 at 1:30 PM, mark rosenberg [email protected] wrote:

Thanks for writing me.

No text in serial print except for the WIFI connecting message and my Lan port.. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 13:27 mark rosenberg [email protected] wrote:

Thanks for writing me.

This is what get when I upload. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 11:58 Aruna Tennakoon [email protected] wrote:

When you ask to turn on or off does it print anything in serial console?

On Sun, Apr 1, 2018 at 3:29 PM 4x1ks [email protected] wrote:

Newbie alert...I have an arduino d1 mini. I added the sinric skill to alexa smart home. I uploaded code to turn the BUILTIN_LED on and off. The mini shows up on my wifi. The alexa app finds my device "bigrelay."

When I ask Alexa to turn on or off the device, she says "ok" but nothing happens. The LED does not change state.

I think my code is ok, it isn't mine..I copied it. I also tried the code to control 5v to a pin to a relay and this also did not work. I'm thinking that it isn't the code, it is the Alexa / Wemos connection.

Any help is appreciated very much.

Mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AHIM5imeFjSCwP9OTFNboacyG3CZRCMhks5tkI_mgaJpZM4TCwfP> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377772947, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqC4o7ydUWihDKmFpMyh4AgNIFBnDks5tkJavgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 10:04 4x1ks

You are using fauxmoESP library.. this is nothing to do with sinric.

If you want to use Sinric:

Go to sinric examples in the github repo

Copy the switch example

Change the API key

Flash

Ask Alexa to discover devices

On Sun, Apr 1, 2018 at 5:34 PM 4x1ks [email protected] wrote:

this is my code

#include <Arduino.h> #include <ESP8266WiFi.h> #include "fauxmoESP.h"

#define WIFI_SSID "Sura Office" #define WIFI_PASS "password" #define SERIAL_BAUDRATE 115200

fauxmoESP fauxmo;

//


// Wifi //


void wifiSetup() {

// Set WIFI module to STA mode WiFi.mode(WIFI_STA);

// Connect Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID); WiFi.begin(WIFI_SSID, WIFI_PASS);

// Wait while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(100); } Serial.println();

// Connected! Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str()); }

void callback(uint8_t device_id, const char * device_name, bool state) { Serial.print("Device "); Serial.print(device_name); Serial.print(" state: "); if (state) { Serial.println("ON"); digitalWrite(D4,HIGH); } else { Serial.println("OFF"); digitalWrite(D4,LOW); } }

void setup() { // Init serial port and clean garbage Serial.begin(SERIAL_BAUDRATE); Serial.println("FauxMo demo sketch"); Serial.println("After connection, ask Alexa/Echo to 'turn on' or 'off'");

pinMode (D4,OUTPUT);

// Wifi wifiSetup();

// Fauxmo fauxmo.addDevice("Fish Tank"); fauxmo.onMessage(callback); }

void loop() { fauxmo.handle(); }

On Sun, Apr 1, 2018 at 1:30 PM, mark rosenberg [email protected] wrote:

Thanks for writing me.

No text in serial print except for the WIFI connecting message and my Lan port.. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 13:27 mark rosenberg [email protected] wrote:

Thanks for writing me.

This is what get when I upload. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 11:58 Aruna Tennakoon [email protected] wrote:

When you ask to turn on or off does it print anything in serial console?

On Sun, Apr 1, 2018 at 3:29 PM 4x1ks [email protected] wrote:

Newbie alert...I have an arduino d1 mini. I added the sinric skill to alexa smart home. I uploaded code to turn the BUILTIN_LED on and off. The mini shows up on my wifi. The alexa app finds my device "bigrelay."

When I ask Alexa to turn on or off the device, she says "ok" but nothing happens. The LED does not change state.

I think my code is ok, it isn't mine..I copied it. I also tried the code to control 5v to a pin to a relay and this also did not work. I'm thinking that it isn't the code, it is the Alexa / Wemos connection.

Any help is appreciated very much.

Mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AHIM5imeFjSCwP9OTFNboacyG3CZRCMhks5tkI_mgaJpZM4TCwfP> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment-377772947 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AkNvqC4o7ydUWihDKmFpMyh4AgNIFBnDks5tkJavgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377777602, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIM5rAdt-L4-cc3SLMzEr3nkCHH7p-sks5tkK0ggaJpZM4TCwfP .

kakopappa avatar Apr 01 '18 10:04 kakopappa

Thanks for the ideas.

I got a lot of error messages. Looks like I have to edit in web socket, Arduinojson, and other things that I really don't have experience in.

If there was an smart home app that could be enabled to run fauxmo then I guess I would be up and running.

I am trying to set up a Arduino d1 mini and relays to turn on and off. The code that I found calls for me to load sinric as the smart home app to enable, but clearly this doesn't work.

thanks

On Sun, Apr 1, 2018 at 1:39 PM, Aruna Tennakoon [email protected] wrote:

You are using fauxmoESP library.. this is nothing to do with sinric.

If you want to use Sinric:

Go to sinric examples in the github repo

Copy the switch example

Change the API key

Flash

Ask Alexa to discover devices

On Sun, Apr 1, 2018 at 5:34 PM 4x1ks [email protected] wrote:

this is my code

#include <Arduino.h> #include <ESP8266WiFi.h> #include "fauxmoESP.h"

#define WIFI_SSID "Sura Office" #define WIFI_PASS "password" #define SERIAL_BAUDRATE 115200

fauxmoESP fauxmo;

//



// Wifi //



void wifiSetup() {

// Set WIFI module to STA mode WiFi.mode(WIFI_STA);

// Connect Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID); WiFi.begin(WIFI_SSID, WIFI_PASS);

// Wait while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(100); } Serial.println();

// Connected! Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str()); }

void callback(uint8_t device_id, const char * device_name, bool state) { Serial.print("Device "); Serial.print(device_name); Serial.print(" state: "); if (state) { Serial.println("ON"); digitalWrite(D4,HIGH); } else { Serial.println("OFF"); digitalWrite(D4,LOW); } }

void setup() { // Init serial port and clean garbage Serial.begin(SERIAL_BAUDRATE); Serial.println("FauxMo demo sketch"); Serial.println("After connection, ask Alexa/Echo to 'turn on' or 'off'");

pinMode (D4,OUTPUT);

// Wifi wifiSetup();

// Fauxmo fauxmo.addDevice("Fish Tank"); fauxmo.onMessage(callback); }

void loop() { fauxmo.handle(); }

On Sun, Apr 1, 2018 at 1:30 PM, mark rosenberg [email protected] wrote:

Thanks for writing me.

No text in serial print except for the WIFI connecting message and my Lan port.. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 13:27 mark rosenberg [email protected] wrote:

Thanks for writing me.

This is what get when I upload. When I ask to turn on or off the device I get no response on the serial print. But the Alexa app does show the device on or off...and when I upload the sketch I get a momentary click of the relay that is attached to the wemos...after the sketch is fully uploaded there is no change in the relay or lights at all....

On Sun, Apr 1, 2018, 11:58 Aruna Tennakoon [email protected] wrote:

When you ask to turn on or off does it print anything in serial console?

On Sun, Apr 1, 2018 at 3:29 PM 4x1ks [email protected] wrote:

Newbie alert...I have an arduino d1 mini. I added the sinric skill to alexa smart home. I uploaded code to turn the BUILTIN_LED on and off. The mini shows up on my wifi. The alexa app finds my device "bigrelay."

When I ask Alexa to turn on or off the device, she says "ok" but nothing happens. The LED does not change state.

I think my code is ok, it isn't mine..I copied it. I also tried the code to control 5v to a pin to a relay and this also did not work. I'm thinking that it isn't the code, it is the Alexa / Wemos connection.

Any help is appreciated very much.

Mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AHIM5imeFjSCwP9OTFNboacyG3CZRCMhks5tkI_mgaJpZM4TCwfP> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment- 377772947 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AkNvqC4o7ydUWihDKmFpMyh4AgNIFBnDks5tkJavgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377777602, or mute the thread <https://github.com/notifications/unsubscribe-auth/AHIM5rAdt-L4- cc3SLMzEr3nkCHH7p-sks5tkK0ggaJpZM4TCwfP>

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377777912, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqDRszB-rK9xs4A6jC1zxDXcI91XVks5tkK53gaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 12:04 4x1ks

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

kakopappa avatar Apr 01 '18 12:04 kakopappa

I haven't programmed since college....35 years...thanks...I will try

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon [email protected] wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 12:04 4x1ks

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon [email protected] wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 12:04 4x1ks

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg [email protected] wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon [email protected] wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 13:04 4x1ks

in the serial print it started printing

[MAIN] Free heap: 45088 bytes

over and over and over...continuously....but at least it is talking to the serial print

On Sun, Apr 1, 2018 at 4:16 PM, mark rosenberg [email protected] wrote:

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg [email protected] wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon <[email protected]

wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 13:04 4x1ks

Goto sinric.com

Create an account

Create a device inside Sinric. There you can give a device name

Copy the API key in the dashboard.

Paste the API key in the arduino sketch. Flash

Install the Srinric smart home skill using Alexa app

Link the skill using above created account

Then you can use turn on / off device name commands

Step by step instructions also on sinric.com home page

On Sun, Apr 1, 2018 at 8:16 PM 4x1ks [email protected] wrote:

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg [email protected] wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon < [email protected]> wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread < https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377786153, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIM5prm7Mz9JsyB0EMvZGUGWD_NPBASks5tkNMggaJpZM4TCwfP .

kakopappa avatar Apr 01 '18 13:04 kakopappa

ok...you're a genius. The commands are showing up in the serial print. on and off...

but....how do I define the pin that will control the relay? Is there a line in the code? There must be....

On Sun, Apr 1, 2018 at 4:20 PM, Aruna Tennakoon [email protected] wrote:

Goto sinric.com

Create an account

Create a device inside Sinric. There you can give a device name

Copy the API key in the dashboard.

Paste the API key in the arduino sketch. Flash

Install the Srinric smart home skill using Alexa app

Link the skill using above created account

Then you can use turn on / off device name commands

Step by step instructions also on sinric.com home page

On Sun, Apr 1, 2018 at 8:16 PM 4x1ks [email protected] wrote:

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg [email protected] wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon < [email protected]> wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377786153, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AHIM5prm7Mz9JsyB0EMvZGUGWD_NPBASks5tkNMggaJpZM4TCwfP>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377786446, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqOv9l2GugQwEA6IapoX1evklgJCIks5tkNQzgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 13:04 4x1ks

i think I need the "set power state" code...there is sample code at amazon, but can I use that?

On Sun, Apr 1, 2018 at 4:42 PM, mark rosenberg [email protected] wrote:

ok...you're a genius. The commands are showing up in the serial print. on and off...

but....how do I define the pin that will control the relay? Is there a line in the code? There must be....

On Sun, Apr 1, 2018 at 4:20 PM, Aruna Tennakoon [email protected] wrote:

Goto sinric.com

Create an account

Create a device inside Sinric. There you can give a device name

Copy the API key in the dashboard.

Paste the API key in the arduino sketch. Flash

Install the Srinric smart home skill using Alexa app

Link the skill using above created account

Then you can use turn on / off device name commands

Step by step instructions also on sinric.com home page

On Sun, Apr 1, 2018 at 8:16 PM 4x1ks [email protected] wrote:

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg [email protected] wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon < [email protected]> wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment- 377783655>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AkNvqClqTH aYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377786153, or mute the thread <https://github.com/notifications/unsubscribe-auth/AHIM5prm7 Mz9JsyB0EMvZGUGWD_NPBASks5tkNMggaJpZM4TCwfP>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377786446, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqOv9l2GugQwEA6IapoX1evklgJCIks5tkNQzgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 13:04 4x1ks

Learn to turn on / off relay in another sketch.

There are lots of examples already on internet.

Then you can copy the code to sinric that will be easy .

Be careful when you are playing with high voltage

On Sun, Apr 1, 2018 at 8:42 PM 4x1ks [email protected] wrote:

ok...you're a genius. The commands are showing up in the serial print. on and off...

but....how do I define the pin that will control the relay? Is there a line in the code? There must be....

On Sun, Apr 1, 2018 at 4:20 PM, Aruna Tennakoon [email protected] wrote:

Goto sinric.com

Create an account

Create a device inside Sinric. There you can give a device name

Copy the API key in the dashboard.

Paste the API key in the arduino sketch. Flash

Install the Srinric smart home skill using Alexa app

Link the skill using above created account

Then you can use turn on / off device name commands

Step by step instructions also on sinric.com home page

On Sun, Apr 1, 2018 at 8:16 PM 4x1ks [email protected] wrote:

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg [email protected] wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon < [email protected]> wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment-377786153 , or mute the thread <https://github.com/notifications/unsubscribe-auth/ AHIM5prm7Mz9JsyB0EMvZGUGWD_NPBASks5tkNMggaJpZM4TCwfP>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377786446, or mute the thread < https://github.com/notifications/unsubscribe-auth/AkNvqOv9l2GugQwEA6IapoX1evklgJCIks5tkNQzgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377787771, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIM5p76jAT3ewgTcYGqAhB-Zpe18xYEks5tkNlJgaJpZM4TCwfP .

kakopappa avatar Apr 01 '18 13:04 kakopappa

when you say " Then you can copy the code to sinric that will be easy ."

you mean copy the code into the sketch? There is no way to copy the code to sinric ..you must mean to write it into the sketch, yes?

I think I am very close to having it work now.

are you referring to the code that is at:

developer.amazon.com/docs/device-apis/alexa-powercontroller.html ??

On Sun, Apr 1, 2018 at 4:47 PM, Aruna Tennakoon [email protected] wrote:

Learn to turn on / off relay in another sketch.

There are lots of examples already on internet.

Then you can copy the code to sinric that will be easy .

Be careful when you are playing with high voltage

On Sun, Apr 1, 2018 at 8:42 PM 4x1ks [email protected] wrote:

ok...you're a genius. The commands are showing up in the serial print. on and off...

but....how do I define the pin that will control the relay? Is there a line in the code? There must be....

On Sun, Apr 1, 2018 at 4:20 PM, Aruna Tennakoon < [email protected]> wrote:

Goto sinric.com

Create an account

Create a device inside Sinric. There you can give a device name

Copy the API key in the dashboard.

Paste the API key in the arduino sketch. Flash

Install the Srinric smart home skill using Alexa app

Link the skill using above created account

Then you can use turn on / off device name commands

Step by step instructions also on sinric.com home page

On Sun, Apr 1, 2018 at 8:16 PM 4x1ks [email protected] wrote:

I managed to put websocketsclient.h and the json onto the sketch. It compiled with no errors.

Where can I give a name to the switch? For example, if I want to call it "relay" or "wemosrelay"

In the other code, I was able to give it a name.

thanks

On Sun, Apr 1, 2018 at 3:49 PM, mark rosenberg <[email protected]

wrote:

websocketsclient.h is not a zip file to be uploaded into the library. It is a page of code. So how do you get it into your library? The arduino.json was easy because it was already in my library.

thanks

On Sun, Apr 1, 2018 at 3:32 PM, Aruna Tennakoon < [email protected]> wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment- 377786153 , or mute the thread <https://github.com/notifications/unsubscribe-auth/ AHIM5prm7Mz9JsyB0EMvZGUGWD_NPBASks5tkNMggaJpZM4TCwfP>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment-377786446 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AkNvqOv9l2GugQwEA6IapoX1evklgJCIks5tkNQzgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377787771, or mute the thread <https://github.com/notifications/unsubscribe- auth/AHIM5p76jAT3ewgTcYGqAhB-Zpe18xYEks5tkNlJgaJpZM4TCwfP>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377788063, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqPo_DH7u_YMLLOwPL5fGa_XA9165ks5tkNpygaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 13:04 4x1ks

these are the error messages I got from the code I copied from Amazon's website on power setting. Do these error codes make sense to you?


Arduino: 1.8.5 (Windows 10), Board: "WeMos D1 R2 & mini, 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

C:\Users\Radio Room\Desktop\sinric_sketch1\sinric_sketch1.ino: In function 'void webSocketEvent(WStype_t, uint8_t*, size_t)':

sinric_sketch1:81: error: expected ';' before ':' token

"directive": {

          ^

sinric_sketch1:258: error: expected '}' at end of input

}

^

sinric_sketch1:258: error: expected '}' at end of input

sinric_sketch1:258: error: expected '}' at end of input

sinric_sketch1:258: error: expected '}' at end of input

exit status 1 expected ';' before ':' token


This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

On Sun, Apr 1, 2018 at 3:33 PM, mark rosenberg [email protected] wrote:

I haven't programmed since college....35 years...thanks...I will try

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon [email protected] wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP .

4x1ks avatar Apr 01 '18 14:04 4x1ks

What I meant was to learn to ten on off relay first and then copy that code inside sinric sketch

Error seems to be related to a missing ;

On Sun, Apr 1, 2018 at 9:09 PM 4x1ks [email protected] wrote:

these are the error messages I got from the code I copied from Amazon's website on power setting. Do these error codes make sense to you?


Arduino: 1.8.5 (Windows 10), Board: "WeMos D1 R2 & mini, 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

C:\Users\Radio Room\Desktop\sinric_sketch1\sinric_sketch1.ino: In function 'void webSocketEvent(WStype_t, uint8_t*, size_t)':

sinric_sketch1:81: error: expected ';' before ':' token

"directive": {

^

sinric_sketch1:258: error: expected '}' at end of input

}

^

sinric_sketch1:258: error: expected '}' at end of input

sinric_sketch1:258: error: expected '}' at end of input

sinric_sketch1:258: error: expected '}' at end of input

exit status 1 expected ';' before ':' token


This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

On Sun, Apr 1, 2018 at 3:33 PM, mark rosenberg [email protected] wrote:

I haven't programmed since college....35 years...thanks...I will try

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon [email protected] wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655, or mute the thread < https://github.com/notifications/unsubscribe-auth/AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377789363, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIM5sWAhgxRKSQ5B-1j-sbdVVhgZjpSks5tkN-XgaJpZM4TCwfP .

kakopappa avatar Apr 01 '18 14:04 kakopappa

good morning

So I went to the site:

// https://developer.amazon.com/docs/device-apis/alexa-powercontroller.html still not sure how to integrate that code into the existing sketch to make it work.

I noticed in my sketch that it DOES communicate between alexa and sinric, by listing the commands on the serial print.

In the github example that I am using, there is a line that says:

// {"deviceId": xxxx, "action": "setPowerState", value: "ON"}

this is a comment line, but

obviously I must fill in xxxx, "action" : setPowerState", value: "ON" ......these variables must be linked somehow to the 4 on / off examples that are on the amazon developer site....I can't figure out how to do that.

I also did not find any other on/off sketches for sinric that look like they will work with the existing sketch.

Any help is greatly appreciated. I've gotten close to making it work now that Alexa is identifying voice commands, but obviously that is not enough to get the d1 mini to trigger the relay.

thanks

Mark

On Sun, Apr 1, 2018 at 5:32 PM, Aruna Tennakoon [email protected] wrote:

What I meant was to learn to ten on off relay first and then copy that code inside sinric sketch

Error seems to be related to a missing ;

On Sun, Apr 1, 2018 at 9:09 PM 4x1ks [email protected] wrote:

these are the error messages I got from the code I copied from Amazon's website on power setting. Do these error codes make sense to you?



Arduino: 1.8.5 (Windows 10), Board: "WeMos D1 R2 & mini, 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

C:\Users\Radio Room\Desktop\sinric_sketch1\sinric_sketch1.ino: In function 'void webSocketEvent(WStype_t, uint8_t*, size_t)':

sinric_sketch1:81: error: expected ';' before ':' token

"directive": {

^

sinric_sketch1:258: error: expected '}' at end of input

}

^

sinric_sketch1:258: error: expected '}' at end of input

sinric_sketch1:258: error: expected '}' at end of input

sinric_sketch1:258: error: expected '}' at end of input

exit status 1 expected ';' before ':' token


This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

On Sun, Apr 1, 2018 at 3:33 PM, mark rosenberg [email protected] wrote:

I haven't programmed since college....35 years...thanks...I will try

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon [email protected] wrote:

Follow this youtube link to install Arduinojson. https://www.youtube.com/watch?v=GUTpaY1YaXo

do the same for websocket

it's not that complicated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/kakopappa/sinric/issues/55#issuecomment-377783655 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AkNvqClqTHaYcwRczSXcNr8cIs0lAxXUks5tkMjTgaJpZM4TCwfP

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377789363, or mute the thread <https://github.com/notifications/unsubscribe-auth/AHIM5sWAhgxRKSQ5B-1j- sbdVVhgZjpSks5tkN-XgaJpZM4TCwfP>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377790834, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqCM37_KqQOUhreyGogAqei-MgONjks5tkOT4gaJpZM4TCwfP .

4x1ks avatar Apr 02 '18 06:04 4x1ks

Hello

// {"deviceId": xxxx, "action": "setPowerState", value: "ON"}

xxx here is the device id displayed in your dashboard. device id is used to identify which device is this command related to when you have multiple smart home devices.

if (deviceId == "5axxxxxxxxxxxxxxxxxxx") // <--- copy device id from the dashboard and paste here {
Serial.print("Turn off Device ID: "); Serial.println(deviceId); } else if (deviceId == "5axxxxxxxxxxxxxxxxxxx") // <-- another device id if you have created multiple switches { Serial.print("Turn off Device ID: "); Serial.println(deviceId); } else { Serial.print("Turn off for unknown device id: "); Serial.println(deviceId);
}

kakopappa avatar Apr 02 '18 06:04 kakopappa

hello:

1: do I need to add the device id number in place of xxxx ...and also uncomment the line? right now the line has // in front of it and no numerical device id in place of xxxx

  1. I added the following 3 lines...to see if this would solve the problem

#define MYPIN D4

then I also added in the turn device on routine

digitalWrite(MYPIN, HIGH);

and then in the turn device off routine I added

digitalWrite(MYPIN, LOW);

This did not help. There is still no response form pin d4 on the arduino

On Mon, Apr 2, 2018 at 9:45 AM, Aruna Tennakoon [email protected] wrote:

Hello

// {"deviceId": xxxx, "action": "setPowerState", value: "ON"}

xxx here is the device id displayed in your dashboard. device id is used to identify which device is this command related to when you have multiple smart home devices.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377868118, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqFk7KzLZsZ24Hh6jEjTKzAZvXL9hks5tkckEgaJpZM4TCwfP .

4x1ks avatar Apr 02 '18 09:04 4x1ks

if (deviceId == "your device id from dashboard") { Serial.print("Turn off Device ID: "); Serial.println(deviceId); }

  1. In the setup you have to set the pinmode

void setup(){ pinMode(MYPIN, OUTPUT); // rest of the code below.. }

kakopappa avatar Apr 02 '18 09:04 kakopappa

It is working!!!!!! Thanks....I will send you chocolate!

On Mon, Apr 2, 2018, 12:35 Aruna Tennakoon [email protected] wrote:

if (deviceId == "your device id from dashboard") { Serial.print("Turn off Device ID: "); Serial.println(deviceId); }

  1. In the setup you have to set the pinmode

void setup(){ pinMode(MYPIN, OUTPUT); ..... }

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-377894827, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqNo0X_-zj6PoisWddpT3z7YphY0Qks5tkfDwgaJpZM4TCwfP .

4x1ks avatar Apr 02 '18 09:04 4x1ks

still waiting ..

kakopappa avatar Apr 04 '18 02:04 kakopappa

Yes...it works just great! Thanks. If you tell me how to mail it..then I will send you chocolate!

Next I am going to add more features to the sketch...

On Wed, Apr 4, 2018, 05:53 Aruna Tennakoon [email protected] wrote:

still waiting ..

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-378463997, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqMHoxYA7P8tB17B408HqCvRVQTLPks5tlDWcgaJpZM4TCwfP .

4x1ks avatar Apr 04 '18 04:04 4x1ks

becareful when you are working with high voltage. don't burn your house down

https://paypal.me/arunat

I am planning to make a bigger's video this weekend

kakopappa avatar Apr 05 '18 02:04 kakopappa

I am a ham radio operator and welder.....I deal with high voltages often....thanks!

On Apr 5, 2018 5:46 AM, "Aruna Tennakoon" [email protected] wrote:

becareful when you are working with high voltage. don't burn your house down

https://paypal.me/arunat

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-378804802, or mute the thread https://github.com/notifications/unsubscribe-auth/AkNvqL8t3EwjinibdRjmHbJ5MHUSaC5Iks5tlYWOgaJpZM4TCwfP .

4x1ks avatar Apr 05 '18 04:04 4x1ks

4x1ks I'm also a Noob trying to get this working with a relay shield. Any chance you could post your working .ino code please?

I'm also confused about this device id, the TODO says "MyApiKey", "MySSID" & "MyWifiPassword", it don't mention I have to get a deviceId?

GaryLittlemore avatar Apr 05 '18 09:04 GaryLittlemore

To get a device Id you have to signup at https://sinric.com and create a smart home device. Once you create a device dashboard will show device id. Copy that id and modify the if statment in Arduino sketch.

I have updated the switch example as well. Thanks

On Thu, Apr 5, 2018 at 4:10 PM Gary Littlemore [email protected] wrote:

4x1ks I'm also a Noob trying to get this working with a relay shield. Any chance you could post your working .ino code please?

I'm also confused about this device id, the TODO says "MyApiKey", "MySSID" & "MyWifiPassword", it don't mention I have to get a deviceId?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/55#issuecomment-378870469, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIM5hv8gxEsW_gM3R5phg4SG455vI-Xks5tld-KgaJpZM4TCwfP .

kakopappa avatar Apr 05 '18 09:04 kakopappa

Thanks for that, I've found it. maybe the code needs to have the "// TODO" on it.

Just need the relay code now ;-)

GaryLittlemore avatar Apr 05 '18 09:04 GaryLittlemore

Where in the .ino code should the relay code be placed? Line number?

void setup(){ pinMode(MYPIN, OUTPUT); // rest of the code below.. }

GaryLittlemore avatar Apr 05 '18 09:04 GaryLittlemore