Alexa now supports colored lights - here's my implementation with FastLED


#1

Enjoy!


Photon with TensorFlow Google's Artificial Intelligence Software
#2

Hi @AlbertZeroK, thanks for your contribution … maybe you canhelp me on my alexa-based project for interacting with Photon. In my particular case, i would like to fire an event from my photon device (via Particle.publish), and subscribe to it on the Lamda js code in order to reproduce a voice message on my alexa dot when the event occurs. For this purpose i’m trying to include on my Lambda code something simular to this:

...
    particle.getEventStream({ 
        deviceId: ..., 
        name: "coloris", 
        auth:... 
    }).then(function(stream) {
      stream.on('event', function(d) {
          var speechOutput = "The light is now " + d.data;
          HERE I WOULD LIKE TO SEND ALEXA THE MESSAGE TO SPEECH
          that.emit(":tell", speechOutput);      
        console.log("Event: " + d.data);
      });
    });  
...

… but it doen’s work. could you please help me on that? thanks!!!


#3

I was not aware that you could trigger Alexa to say something without asking it for something like through a skill… and I hope I am wrong. Can you direct me to the amazon docs on This? I would love to do this myself and am writing an update for this code now so perfect timing!


#4

Hi @AlbertZeroK … i’m not sure the it is possible too … :frowning:


#5

Hi!,
i’m using the following code on my Photon device for interacting with Lambda AWS in order to implement an Alexa-based application.

int brightnessInt;
char global_state[5];
char global_state_char;


void setup() {
   Serial.begin(9600);
   sprintf(global_state, "none");
   global_state_char = 'N';
   Particle.function("color", setLightColor);
   Particle.variable("global_state", global_state);
}

int setLightColor(String color) {
  Serial.println("color: " + color);

  if(color == "red") {
    Particle.publish("coloris", "red", 60, PRIVATE);
    sprintf(global_state, "red");
    global_state_char = 'R';
  }
  else if(color == "green") {
    Particle.publish("coloris", "green", 60, PRIVATE);
    sprintf(global_state, "green");
    global_state_char = 'G';
  }
  else if(color == "blue") {
    Particle.publish("coloris", "blue", 60, PRIVATE);
    sprintf(global_state, "blue");
    global_state_char = 'B';
  }
  else if(color == "white") {
    Particle.publish("coloris", "white", 60, PRIVATE);
    sprintf(global_state, "white");
    global_state_char = 'W';
  }
} 

From this code, my aim is that, when an intent is invoked from the lambda code from a defined Alexa skill, the funcion color is invoked in order to set a led connected to the Photon, to the desired color (not included in the posted code). Until that point, everything works well. My problem is that, after invoking the function color, i would like to subscribe to the event “coloris” on the Lambda code(via particle.getEventStream), and when it is triggered, send a message from the Lambda code to be speech on the Alexa dot … it is possible?. could anybody help me to implement that?


#6

Since you already got replies on this post I’ve closed and hidden the parallel/double post to prevent diverging discussions.


#7

@fbt the only time you can respond with text to a skill, is when you trigger that skill. There is no way to make Alexa talk without you starting the interaction.

If anyone knows a way to do this, let me know.


#8

You are right, @ScruffR. thanks


#9

New version coming as soon as amazon approves the new application

https://iotpimp.com/particle-io-bridge