Aircoookie / Espalexa

Alexa voice control for ESP8266/ESP32 (including brightness and color!)
MIT License
541 stars 134 forks source link

Change manufacturer and device name #9

Open bkrajendra opened 6 years ago

bkrajendra commented 6 years ago

Every example I searched for ESP8266 / ESP32 and alexa integration found out to be just a faking of some existing device protocol like Philips Hue or WemO

You have done a great work as this is only code that work seamlessly with my devices, and my Alexa Echo dot discovered all added device immediately.

But what i'm searching for is to add native discovery to my device. Like Alexa should be able to understand my device name and company/manufacturer name after discovery, as i want to use for production purpose. I need similar SSDP like functionality for my devices.

I tried searching for it but could find a proper documentation. Do you have any idea about how it can be done?

Aircoookie commented 6 years ago

I'm glad that you like my code, thank you!

Alexa is fully closed source, which means sadly we can only use the protocols that are supported, as-is. I'm only aware of the WeMo and Philips protocols which work locally without an external server. I've just tested if I could change the manufacturer name in the protocol, but as soon as I change it to anything but "Royal Philips Electronics", discovery fails.

Furthermore, I don't understand why Alexa doesn't have a properly customizable and reliable local API... Beause hue lights primarily rely on a cloud service also, even this Philips local API may get removed without notice, rendering Espalexa and any projects relying on it useless. I hope this will happen later rather than sooner, but for this reason and because it's not possible to change the manufacturer name, I have to advise against using Espalexa for anything but hobbyist use, as much as I'd love to see it deployed on a production scope.

If you are a smart device manufacturer, Amazon seems to expect you to have a fully working cloud service that can control your devices and to be willing and able to write an Alexa "skill" to support it. Of course, having such a complicated online infrastructure is near impossible to achieve for individuals and smaller companies and also introduces other risk factors like downtimes, account management and security. It makes me really sad that there isn't an "official" way to connect local devices and in my opinion, this is a big oversight from the Alexa development team.

I'm so sorry that I'm not currently in the position to offer something to you that would satisfy your use case.

eos1d3 commented 5 years ago

This is what I think too. Using cloud service is too much for just a few devices at home. And each user has to make an account is another issue.

What about Google Assistant. I found this but not yet fully understand it.

https://medium.com/google-developers/announcing-the-java-kotlin-client-library-for-actions-on-google-217828dead?linkId=62399239

Aircoookie commented 5 years ago

As far as I understand, the article you linked is about a Java/Kotlin library which doesn't run on ESP. Also, it still seems to use the Google cloud instead of a local API. But thank you, I'll look into Google assistant soon again, maybe there are some other new options!

bkrajendra commented 5 years ago

Ive done this finally long back, as was searching through many docs of Alexa Voice service and found one method to do it officially.

Obviously you cant do it locally. Ive setup my cloud with oAuth2 user and device management support. And my device has MQTT running on it.

So Flow is like: Alexa App->Alexa-skill->AWS Auth->My Cloud Page for login and Auth->Returns Auth Token for reuse latter.->Skill Connected for a user.->Back to skill->Run Device Discovery

Run Device Discovery from ALexa or Run Device Discovery from Alexa App->Check for user Auth->AWS Lambda with discovery code->Connec to My cloud with last token->Fetch all Registered devices->Alexa speaks # devices discovered.

Alexa Voice command->Alexa Device->Alexa-skill->AWS Lambda for skill->Call MQTT command with specific topic for that device to turn on/off

You need write code for AWS lambda with python or node-js, I preferred node js as its easy for me. And create AWS app server for each region you are targeting.

Lot of work but I have everything.. So working fine.

Im still searching for better MQTT security with oAuth and other things. Hope this will help someone as Ive not found any blog or docs for this yet.