kakopappa / sinric

Amazon Alexa Smart home skill / Google Home Action for ESP8266 / ESP32 / Arduino
https://sinric.com
285 stars 166 forks source link

wemos board control with Alexa #55

Open 4x1ks opened 6 years ago

4x1ks commented 6 years ago

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

kakopappa commented 6 years ago

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 notifications@github.com 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 .

4x1ks commented 6 years ago

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 4x1ks.mark@gmail.com 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 notifications@github.com 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 notifications@github.com 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 commented 6 years ago

this is my code

include

include

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 4x1ks.mark@gmail.com 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 4x1ks.mark@gmail.com 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 notifications@github.com 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 notifications@github.com 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 .

kakopappa commented 6 years ago

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 notifications@github.com wrote:

this is my code

include

include

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 4x1ks.mark@gmail.com 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 4x1ks.mark@gmail.com 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 notifications@github.com 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 notifications@github.com 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 .

4x1ks commented 6 years ago

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 notifications@github.com 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 notifications@github.com wrote:

this is my code

include

include

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 4x1ks.mark@gmail.com 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 4x1ks.mark@gmail.com 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 notifications@github.com 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 notifications@github.com 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 .

kakopappa commented 6 years ago

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

do the same for websocket

it's not that complicated.

4x1ks commented 6 years ago

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

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon notifications@github.com 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 commented 6 years ago

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 notifications@github.com 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 commented 6 years ago

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 4x1ks.mark@gmail.com 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 notifications@github.com 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 commented 6 years ago

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 4x1ks.mark@gmail.com 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 4x1ks.mark@gmail.com 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 <notifications@github.com

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 .

kakopappa commented 6 years ago

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 notifications@github.com 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 4x1ks.mark@gmail.com 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 < notifications@github.com> 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 .

4x1ks commented 6 years ago

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 notifications@github.com 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 notifications@github.com 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 4x1ks.mark@gmail.com 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 < notifications@github.com> 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 commented 6 years ago

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 4x1ks.mark@gmail.com 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 notifications@github.com 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 notifications@github.com 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 4x1ks.mark@gmail.com 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 < notifications@github.com> 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 .

kakopappa commented 6 years ago

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 notifications@github.com 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 notifications@github.com 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 notifications@github.com 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 4x1ks.mark@gmail.com 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 < notifications@github.com> 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 .

4x1ks commented 6 years ago

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 notifications@github.com 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 notifications@github.com 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 < notifications@github.com> 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 notifications@github.com 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 <4x1ks.mark@gmail.com

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 < notifications@github.com> 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 commented 6 years ago

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 4x1ks.mark@gmail.com wrote:

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

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon notifications@github.com 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 .

kakopappa commented 6 years ago

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 notifications@github.com 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 4x1ks.mark@gmail.com wrote:

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

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon notifications@github.com 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 .

4x1ks commented 6 years ago

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 notifications@github.com 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 notifications@github.com 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 4x1ks.mark@gmail.com wrote:

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

On Sun, Apr 1, 2018, 15:32 Aruna Tennakoon notifications@github.com 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 .

kakopappa commented 6 years ago

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);
}

4x1ks commented 6 years ago

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 notifications@github.com 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 .

kakopappa commented 6 years ago

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.. }

4x1ks commented 6 years ago

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

On Mon, Apr 2, 2018, 12:35 Aruna Tennakoon notifications@github.com wrote:

1.

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 .

kakopappa commented 6 years ago

still waiting ..

4x1ks commented 6 years ago

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 notifications@github.com 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 .

kakopappa commented 6 years ago

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

4x1ks commented 6 years ago

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

On Apr 5, 2018 5:46 AM, "Aruna Tennakoon" notifications@github.com 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 .

GaryLittlemore commented 6 years ago

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?

kakopappa commented 6 years ago

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 notifications@github.com 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 .

GaryLittlemore commented 6 years ago

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

Just need the relay code now ;-)

GaryLittlemore commented 6 years ago

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

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

kakopappa commented 6 years ago

in setup function you have to set the pinMode.

then change to high or low to turn on / off

https://arduinobasics.blogspot.com/2014/09/relay-module.html

GaryLittlemore commented 6 years ago

Thanks, I don't really understand that. I'm not a coder. I've been trying to follow along watching videos and replicating. Hopefully 4x1ks will be able to post their code. Don't worry I'm not doing the wiring with high voltage, a friend will be helping me there.

4x1ks commented 6 years ago

Hey Gary

Send me your email...I will get back to you.

Mark 4x1ks

On Thu, Apr 5, 2018, 13:02 Gary Littlemore notifications@github.com wrote:

Thanks I don't really understand that, I'm not a coder. I've been trying to follow along watching videos and replicating. Hopefully 4x1ks will be able to post their code. Don't worry I'm not doing the wiring with high voltage, a friend will be helping me there.

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

GaryLittlemore commented 6 years ago

gary (dot) littlemore (at) btinternet (dot) com

Thanks Mark

nizamaj commented 5 years ago

Hi Machan kakopappa , Thanks for the wonderful work .. i am planing to flash my LinkNode R4 to work with alexa (https://www.amazon.com/LinkNode-R4-controller-4-Channel-Module/dp/B01FUC9U58/ref=cm_cr_arp_d_product_top?ie=UTF8) and found out your old code .. (https://github.com/CharlesJGantt/LinkNode-R4-Controlled-By-Amazon-Alexa/tree/master) .. My question is .. is there a way i can include sinric to this code ?? or do i need to change entire libraries and codes ?

kakopappa commented 5 years ago

I think old method still can be used but unrealiable. It used to emulate a Belkin WeMos switch. Sometimes it work sometimes not.

If you do not have access to Sinric Skill you have to use the old method.

nizamaj commented 5 years ago

Exactly the old method sometimes it working sometime don't .. planing to flash my LinkNode with new code .. is there any link to know how to add Sinric to the old code ??

Dr-Bundolo commented 3 years ago

First of all Thanks for creating the library and all the time you've spent trying to help all of us newbies. I've spent the better part of two days trying to get my D1 mini to work with Alexa. I'm very close. As you can see from the screen shot of the serial monitor the sketch works. If I press test on Sinric, or power on with Alexa it registers on the Com. Great! The problem is that it does NOT turn on the relay. I've tried the relay on numerous pins (changing the pin assignment in the program) with no change in the result. I've tried numerous boards (right now I'm using WeMos D1 R1, but I've tried the generic board as well. Still won't trigger the relay. I've tried different program with the same result. I've tested the D1 with a blink program - works. Tried different relays with the same result. Any advice COM3_SCREEN Here's the Code ` #include

include

include

include // https://github.com/kakopappa/sinric/wiki/How-to-add-dependency-libraries

include // https://github.com/kakopappa/sinric/wiki/How-to-add-dependency-libraries

include

ESP8266WiFiMulti WiFiMulti; WebSocketsClient webSocket; WiFiClient client;

define MyApiKey "f0e87a67-bcca-469e-b593-3a2882e60ca3" // TODO: Change to your sinric API Key. Your API Key is displayed on sinric.com dashboard

define MySSID "kuggle's_condo_2" // TODO: Change to your Wifi network SSID

define MyWifiPassword "jakesnak" // TODO: Change to your Wifi network password

define HEARTBEAT_INTERVAL 300000 // 5 Minutes

const int relayPin = 5;

uint64_t heartbeatTimestamp = 0; bool isConnected = false;

void setPowerStateOnServer(String deviceId, String value); void setTargetTemperatureOnServer(String deviceId, String value, String scale);

// deviceId is the ID assgined to your smart-home-device in sinric.com dashboard. Copy it from dashboard and paste it here

void turnOn(String deviceId) { if (deviceId == "600dce7798845d1692f01e0e") // Device ID of first device {
Serial.print("Turn on device id: "); Serial.println(deviceId); digitalWrite(relayPin, HIGH); digitalWrite(relayPin, HIGH); // turn on relay with voltage HIGH } else { Serial.print("Turn on for unknown device id: "); Serial.println(deviceId);
digitalWrite(relayPin, LOW);
}
}

void turnOff(String deviceId) { if (deviceId == "5600dce7798845d1692f01e0e") // Device ID of first device {
Serial.print("Turn off Device ID: "); Serial.println(deviceId);

 digitalWrite(relayPin, LOW);  // turn off relay with voltage LOW

} else { Serial.print("Turn off for unknown device id: "); Serial.println(deviceId);
} }

void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) { switch(type) { case WStype_DISCONNECTED: isConnected = false;
Serial.printf("[WSc] Webservice disconnected from sinric.com!\n"); break; case WStype_CONNECTED: { isConnected = true; Serial.printf("[WSc] Service connected to sinric.com at url: %s\n", payload); Serial.printf("Waiting for commands from sinric.com ...\n");
} break; case WStype_TEXT: { Serial.printf("[WSc] get text: %s\n", payload); // Example payloads

    // For Switch or Light device types
    // {"deviceId": xxxx, "action": "setPowerState", value: "ON"} // https://developer.amazon.com/docs/device-apis/alexa-powercontroller.html

    // For Light device type
    // Look at the light example in github

if ARDUINOJSON_VERSION_MAJOR == 5

    DynamicJsonBuffer jsonBuffer;
    JsonObject& json = jsonBuffer.parseObject((char*)payload);

endif

if ARDUINOJSON_VERSION_MAJOR == 6

    DynamicJsonDocument json(1024);
    deserializeJson(json, (char*) payload);      

endif

    String deviceId = json ["deviceId"];     
    String action = json ["action"];

    if(action == "setPowerState") { // Switch or Light
        String value = json ["value"];
        if(value == "ON") {
            turnOn(deviceId);
        } else {
            turnOff(deviceId);
        }
    }
    else if (action == "SetTargetTemperature") {
        String deviceId = json ["deviceId"];     
        String action = json ["action"];
        String value = json ["value"];
    }
    else if (action == "test") {
        Serial.println("[WSc] received test command from sinric.com");
    }
  }
  break;
case WStype_BIN:
  Serial.printf("[WSc] get binary length: %u\n", length);
  break;

} }

void setup() { Serial.begin(115200);

// Relay PIN eg: https://github.com/wemos/D1_mini_Examples/blob/master/examples/04.Shields/Relay_Shield/Blink/Blink.ino pinMode(relayPin, OUTPUT);

WiFiMulti.addAP(MySSID, MyWifiPassword); Serial.println(); Serial.print("Connecting to Wifi: "); Serial.println(MySSID);

// Waiting for Wifi connect while(WiFiMulti.run() != WL_CONNECTED) { delay(500); Serial.print("."); } if(WiFiMulti.run() == WL_CONNECTED) { Serial.println(""); Serial.print("WiFi connected. "); Serial.print("IP address: "); Serial.println(WiFi.localIP()); }

// server address, port and URL webSocket.begin("iot.sinric.com", 80, "/");

// event handler webSocket.onEvent(webSocketEvent); webSocket.setAuthorization("apikey", MyApiKey);

// try again every 5000ms if connection has failed webSocket.setReconnectInterval(5000); // If you see 'class WebSocketsClient' has no member named 'setReconnectInterval' error update arduinoWebSockets }

void loop() { webSocket.loop();

if(isConnected) { uint64_t now = millis();

  // Send heartbeat in order to avoid disconnections during ISP resetting IPs over night. Thanks @MacSass
  if((now - heartbeatTimestamp) > HEARTBEAT_INTERVAL) {
      heartbeatTimestamp = now;
      webSocket.sendTXT("H");          
  }

}
}

// If you are going to use a push button to on/off the switch manually, use this function to update the status on the server // so it will reflect on Alexa app. // eg: setPowerStateOnServer("deviceid", "ON")

// Call ONLY If status changed. DO NOT CALL THIS IN loop() and overload the server. void setPowerStateOnServer(String deviceId, String value) {

if ARDUINOJSON_VERSION_MAJOR == 5

DynamicJsonBuffer jsonBuffer; JsonObject& root = jsonBuffer.createObject();

endif

if ARDUINOJSON_VERSION_MAJOR == 6

DynamicJsonDocument root(1024);

endif

root["deviceId"] = deviceId; root["action"] = "setPowerState"; root["value"] = value; StreamString databuf;

if ARDUINOJSON_VERSION_MAJOR == 5

root.printTo(databuf);

endif

if ARDUINOJSON_VERSION_MAJOR == 6

serializeJson(root, databuf);

endif

webSocket.sendTXT(databuf); }

//eg: setPowerStateOnServer("deviceid", "CELSIUS", "25.0")

// Call ONLY If status changed. DO NOT CALL THIS IN loop() and overload the server. void setTargetTemperatureOnServer(String deviceId, String value, String scale) {

if ARDUINOJSON_VERSION_MAJOR == 5

DynamicJsonBuffer jsonBuffer; JsonObject& root = jsonBuffer.createObject();

endif

if ARDUINOJSON_VERSION_MAJOR == 6

DynamicJsonDocument root(1024);

endif

root["action"] = "SetTargetTemperature"; root["deviceId"] = deviceId;

if ARDUINOJSON_VERSION_MAJOR == 5

JsonObject& valueObj = root.createNestedObject("value"); JsonObject& targetSetpoint = valueObj.createNestedObject("targetSetpoint");

endif

if ARDUINOJSON_VERSION_MAJOR == 6

JsonObject valueObj = root.createNestedObject("value"); JsonObject targetSetpoint = valueObj.createNestedObject("targetSetpoint");

endif

targetSetpoint["value"] = value; targetSetpoint["scale"] = scale;

StreamString databuf;

if ARDUINOJSON_VERSION_MAJOR == 5

root.printTo(databuf);

endif

if ARDUINOJSON_VERSION_MAJOR == 6

serializeJson(root, databuf);

endif

webSocket.sendTXT(databuf); } `

Dr-Bundolo commented 3 years ago

Okay, A day later I have solved my problem. As always it was a series of problems. The first was making sure I had the proper drivers downloaded. Then it was testing all my USB cables until I found one that worked and the computer recognized the port. That was a biggie. But still couldn't get the program to work. Alexa would turn on and off the device. You could see the BLUE LED come on when Alexa turned it on, and turn off when Alexa turned it off.... so close. then after searching more on the internet the final piece fell in place. As is the usual case I had the relay powered from the VCC. I checked it with a volt meter and it was getting 4.75. But the relay would not trigger. Finally I read someone suggested trying using the 3.3V output on the board. I was not convinced as my experience is that voltage is too low to trigger the relay, but low and behold it worked! So If your getting everything but the relay working, change to 3.3v. It will work. Hope this helps.