vintlabs / fauxmoESP

Add voice control of your ESP32 and ESP8266 devices using Amazon Alexa
MIT License
391 stars 71 forks source link

How to send a message(String) from Alexa to ESP32? #154

Closed DeathStrokeAlpha-VA closed 3 years ago

DeathStrokeAlpha-VA commented 3 years ago

I have built a gateway that works on ESP32. The gateway controls the peripheral devices via ESP-NOW protocol. Is there a way by which Alexa can simply forward a string to ESP32, like, if the user says "Alexa, turn on light in kitchen", then, Alexa should forward "TURN ON LIGHT IN KITCHEN" to ESP32.

sebkouba commented 3 years ago

As I understand it sending a string like you asked is not possible.

If you look at the callback function you can see what is and is not possible at the moment: fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value)

The bool state can only be true or false. The unsigned char can be 0-255. Fauxmo emulates a Philips Hue, according to the documentation, so you can only da what you can do to a light. In this case switch it on and off and send a value (for brightness I assume, originally).

I'm not sure what more is possible with more coding work but as I understand that's what we have right now.

DeathStrokeAlpha-VA commented 3 years ago

Thanks for the answer but I think this isn't possible with Alexa. I would have to create an Alexa Skill and point it to my MQTT server.

pvint commented 3 years ago

Yeah, not directly possible without creating an Alexa skill. Having said that, you can interpret what the command was by what the values are as @sebkouba said.