vintlabs / fauxmoESP

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

Alexa can't discover devices #166

Open gabriel-lando opened 3 years ago

gabriel-lando commented 3 years ago

I was using the latest version (v3.2) for a while (since February 8th, 2021) and it has been working very well so far (also, the devices continue to work with Alexa).

Today, I decided to add a new light and Alexa couldn't detect this device.

I tried using my custom code and it didn't work (it did last month). So, I tried with the example fauxmoESP_basic from the library and I had the same result: Alexa cound't find any new device.

So, I tried with the version 2.4.4 (an implementation of the Wemo Switch that I already used on the past) and it worked using the basic example: Alexa could find a "switch one" smart switch device.

So, I tried with the version 3.1.1 (from de same repository, latest before the migration for GitHub) and I had the same issue.

Apparently, Alexa can't discover devices using the Philips Hue implementation.

Also, I tried using the latest commit on master and the result was the same :(

My Echo devices:

I tried with both Echo devices and they can't find this device.

Also, I tried removing one of my working devices from the Alexa app and tried to discover this device again and Alexa couldn't detect it.

My upload configuration: Board: Wemos D1 R1 Upload Speed: 921600 CPU Frequency: 80 MHz Flash Size: 4MB (FS:2MB OTA:~1019KB) Debug port: Disabled Debug Level: None lwIP Variant: v1.4 Higher Bandwidth VTables: Flash Exceptions: Legacy (new can return nullptr) Erase Flash: Only Sketch SSL Support: All SSL ciphers (most compatible)

OBS: Also, on the basic example, I tried to remove all devices and keep only the "yellow lamp" (as I saw in other issue #149 ) and the result was the same :/

Edit: ESP8266 Core version: 2.7.4

gabriel-lando commented 3 years ago

Hey, I'm adding some fauxmo logs

I've uncommented this line #define DEBUG_FAUXMO Serial and changed these two: #define DEBUG_FAUXMO_VERBOSE_TCP true and #define DEBUG_FAUXMO_VERBOSE_UDP true.

fauxmoESP_Logs.txt

kzkaram commented 3 years ago

I have noticed the same thing. It was working ok until just a few days ago. It looks like the discovery process doesn't like something in the response containing the list of discoverable devices properties and IDs so doesn't proceed to the next stage of requesting information on individual devices in that list. Perhaps some update to Echo firmware now means this profile is no longer supported e.g due to Hue Hub V1 no longer supported?

SatyamThakur30 commented 3 years ago

Same issue facing from last few days. Please update if any fix it.

Aircoookie commented 3 years ago

Facing the same issue in my Espalexa library (which FauxmoESP has borrowed some concepts from, albeit adapted for way better code quality than mine) and have not yet been able to fix it either.

@kzkaram I can confirm your findings. Discovery is fine until the complete api/key/lights list is requested. Dot 3 continues to request API key (request to /api with body {"devicetype": "Echo"} and api/key/lights in a loop, but never individual lights, e.g. api/key/lights/1. My first wild guess is that it doesn't like a value presented in the device list, perhaps a JSON property is missing or has a value that is rejected by the Alexa code for some reason. Still it doesn't make sense that the Echo would request the API key again (which it subsequently uses for the /lights request).

My next attempt will be to spoof every property of the JSON object for a bulb returned by an actual V2 bridge (current implementation both of Espalexa and FauxmoESP leave out quite a few properties), but I have not yet had time to test that. This is definitely a critical issue as discovery fails from Dot 3, Dot 2, Echo Plus and the app (and likely all other devices).

barneyz commented 3 years ago

@Aircoookie, can you post a log "of the JSON object for a bulb returned by an actual V2 bridge" in both ESPalexa and Fauxmoesp-discussions/issues? This could help to fix it...

Aircoookie commented 3 years ago

Sure thing! Adding more properties is the first thing we might want to try, although this will further limit the amount of devices that can be emulated from a single ESP due to the length of the aggregate /lights object... Well better to be able to emulate a single device than none at all.

Response to /api/key/lights/1 by Espalexa 2.5.0 (for EspalexaDeviceType::extendedcolor) ```json { "state": { "on": true, "bri": 199, "hue": 0, "sat": 0, "effect": "none", "xy": [0.48, 0.42], "ct": 500, "alert": "none", "colormode": "xy", "mode": "homeautomation", "reachable": true }, "type": "Extended color light", "name": "Garage", "modelid": "LCT015", "manufacturername": "Philips", "productname": "E4", "uniqueid": "fabc20bb2e01", "swversion": "espalexa-2.5.0" } ```
Response to /api/key/lights/1 by V2 Hue Bridge (for genuine Hue Color & Ambiance E27 bulb V3) ```json { "state": { "on": false, "bri": 42, "hue": 5214, "sat": 254, "effect": "none", "xy": [ 0.5853, 0.3881 ], "ct": 153, "alert": "none", "colormode": "xy", "mode": "homeautomation", "reachable": true }, "swupdate": { "state": "noupdates", "lastinstall": "2020-03-04T13:47:05" }, "type": "Extended color light", "name": "Dodekaeder", "modelid": "LCT015", "manufacturername": "Signify Netherlands B.V.", "productname": "Hue color lamp", "capabilities": { "certified": true, "control": { "mindimlevel": 1000, "maxlumen": 806, "colorgamuttype": "C", "colorgamut": [ [ 0.6915, 0.3083 ], [ 0.17, 0.7 ], [ 0.1532, 0.0475 ] ], "ct": { "min": 153, "max": 500 } }, "streaming": { "renderer": true, "proxy": true } }, "config": { "archetype": "sultanbulb", "function": "mixed", "direction": "omnidirectional", "startup": { "mode": "safety", "configured": true } }, "uniqueid": "00:17:88:01:03:7f:54:41-0b", "swversion": "1.50.2_r30933", "swconfigid": "772B0E5E", "productid": "Philips-LCT015-1-A19ECLv5" } ```
pvint commented 3 years ago

@Aircoookie That is really great info - thank you!

I'm just starting to dig in to this. For reference here is the /lights response from FauxmoESP 3.2:

{"1":{"type":"Extended color light","name":"yellow lamp","uniqueid":"2d925343b020","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}}
Aircoookie commented 3 years ago

@pvint Success! (at least I hope so, it is yet to be seen that this works widely, but I just had a working discovery of an Espalexa device on Dot 3) Alexa doesn't like the 12-hex digit syntax of our "uniqueid" field any longer apparently. Espalexa community member @oponyx found that the syntax "uniqueid":"F0:08:D1:D8:3B:00:00:11-01" causes the device to be found and controllable again, which I can confirm.

Using the following code to generate the field:

uint8_t mac[6];
WiFi.macAddress(mac);

sprintf(out, "%02X:%02X:%02X:%02X:%02X:%02X:00:11-%02X", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], idx);

where idx is the device number.

gabriel-lando commented 3 years ago

Hi, thanks @Aircoookie :) I tried this and it worked very well. All my devices are working with fauxmoESP with this solution

kzkaram commented 3 years ago

@Aircoookie Thanks for that info. Must admit when I saw the different unique ID structure I did wonder if that may be the culprit as it's not the first time there has been a change in acceptance based on unique ID length or in this case structure. I have tried some code with all the hex numbers generated randomly (including the xx-yy at the end) and this seemed to still work ok. Not suggesting that this is a good way to ensure a unique ID but was just wondering if something within this needs to adhere to some specific value or value sets - seems not. (tested using Dot 2 BTW)

pvint commented 3 years ago

@Aircoookie Good stuff, many thanks!!

I've made some similar changes here, and it appears to be working fine now. I've committed it to the master branch and will try to get a new release out quickly.

oponyx commented 3 years ago

Hi, glad to hear that. Hope amazon doesn't break things again! 😉

pvint commented 3 years ago

I've released version 3.3 to address this, and it should be good with that or the current master branch.

Let me know, thanks! Paul

cleiton2193 commented 3 years ago

Olá, obrigado @Aircoookie :) Tentei fazer isso e funcionou muito bem. Todos os meus dispositivos estão funcionando com fauxmoESP com esta solução

Bom dia. Estou vendo aqui que vc conseguiu uma solução para a Alexa voltar a descobrir dispositivos. Eu tinha tudo funcionando em minha casa, e comprei um outro roteador, deletei os dispositivos, para minha surpresa, nada foi encontrada mais, vc pode me ajudar?

cleiton2193 commented 3 years ago

Eu lancei a versão 3.3 para resolver isso, e deve ser bom com isso ou com o branch master atual.

Me avise, obrigado! Paulo

Bom dia. Pode me ajudar? Onde consigo essa versão 3.3? Aqui TB, a Alexa não descobre mais nada!

cleiton2193 commented 3 years ago

Boa noite ,testei a versão 3.3, sem resultado. Não encontra dispositivos. Como vc pediu para deixar aqui os resultados. Muito obrigado, conseguindo algo, me avise por favor.

barneyz commented 3 years ago

fauxmo 3.3 with basic example is working fine (5 new devices detected), newest espalexa-libary 2.7.0 is also working fine! (Wemos D1 mini, Echo plus V 2, 1.4 high bandwith,)

  1. I search always new devices with the alexa app, scenes ->search for new scenes.
  2. sometimes a further remove/deleted "old" device (with another unique-id) is not really deleted in the alexa database. You can't see it in the alexa-app, but on the website "https://alexa.amazon.xxx" (on smart-home page) , which must be removed there. If it has the name of the device you will find again, it will block the discovery
  3. be sure you when you exchange the library-version and you compile the code, that .o and .d-files of the library and sketch are really build new(i had this problem a year ago, i think reason was that new fauxmoESP.cpp was older than fauxmoESP.cpp.o/.d, buildung new did not change the .o/.d files
cleiton2193 commented 3 years ago

Obrigado pelo comunicado. Vou fazer teste com menos dispositivos, pois na minha placa eu adicionava 16 dispositivos, e nunca tive problema

cleiton2193 commented 3 years ago

Boas notícias, realmente adicionado até 10 dispositivos , aceitou na minha programação. Obrigado pessoal. FauxmoEsp 3.3

cleiton2193 commented 3 years ago

11 dispositivos já não consegue adicionar nada, só para ajudar as pessoas que devem estar sofrendo igual eu sofri nesses dias. Mais muito obrigado pessoal, 10 já é um bom número.

b1gmans commented 3 years ago

Hi - My system stopped working a week or so ago - I have just tried updating to V3.3 and it still is not working. My Echo Dot wont find any of my devices anymore. I have even tried the example source and it woint find those coloured lamp test devices either.

cleiton2193 commented 3 years ago

Bom dia Bg1 gmans. Meu microcontrolador é um esp32, só testei com esse ainda ,mais está funcionando sim. Só que não está conseguindo emular mais de 10 dispositivos. Assim que vc mudar a biblioteca fauxmo Para 3.3, não esqueça de eliminar a outra biblioteca. Reinicie a ide do arduino.

b1gmans commented 3 years ago

After a lot of experimentation I eventually got 3.3 to work - I had 15 devices defined, had to trim down to 10 max as suggested by cleiton2193

cleiton2193 commented 3 years ago

Que bom que conseguiu meu amigo B1 gmans Creio que em breve vai poder adicionar mais dispositivos. Abraço.

b1gmans commented 3 years ago

So Why is there now a limit on the number of devices I can create? is it the json text length - I note there is a lot more info for each item being sent?

cleiton2193 commented 3 years ago

Creio que não é um limite, mais o novo comprimento do texto parece que diminui a quantidade de dispositivos que podem ser descobertos. E pelo jeito é algo sem volta, pois a mudança foi feita pela Amazon. Eu vou entrar no aluta para criar a minha própria skill da Alexa . Dessa forma vai ser mais fácil de trabalhar.

cleiton2193 commented 3 years ago

Novidade meu amigo. Esp32. Com 13 dispositivos funciona TB. Pode fazer um experimento. Funcionou aqui de boa. Esp01, funciona 2 dispositivos

b1gmans commented 3 years ago

I created this shortened version:

// Add in a short version for the ALL PROGMEM const char FAUXMO_DEVICE_JSON_TEMPLATE_SHORT[] = "{" "\"type\": \"Extended color light\"," "\"name\": \"%s\"," "\"uniqueid\": \"%s\""

"}"; and called that whenever the request for ALL is made. It works perfectly - I can now add all my 15 devices, and probably a lot more.

cleiton2193 commented 3 years ago

Que legal B1 gmans. Parabéns por ter conseguido. Onde faço essas alterações, na biblioteca fauxmo, ou adiciono na própria programação na ide do arduino? Meu e-mail é: cleitonleal.1982@hotmail.com. Se puder me ajudar com mais detalhes. Desde já um muito obrigado.

b1gmans commented 3 years ago

Que legal B1 gmans. Parabéns por ter conseguido. Onde faço essas alterações, na biblioteca fauxmo, ou adiciono na própria programação na ide do arduino? Meu e-mail é: cleitonleal.1982@hotmail.com. Se puder me ajudar com mais detalhes. Desde já um muito obrigado.

Hi, I have emailed you - but also for anyone else:

I made changes to the fauxmo library - zipped files here src.zip

fauxmoesp.cpp:

  1. add deviceJsonShort
  2. call deviceJsonShort from fauxmoESP::_onTCPList

fauxmoesp.h:

  1. Add String _deviceJsonShort(unsigned char id);

templates.h:

  1. add FAUXMO_DEVICE_JSON_TEMPLATE_SHORT
cleiton2193 commented 3 years ago

Blz meu amigo. Você vai nos ajudar muito. Obrigado mesmo, de coração. Você já chegou em pensar em criar uma skill na Alexa? Com esse conhecimento seu, creio que seria tranquilo para você. Quando tiver um tempo, da uma olhada a respeito. Eu preciso de criar uma, pois eu possuo placa de automação e estou pensando em começar a comercializar. Quem sabe agente entrava em um acordo e eu te pagaria para vc criar para mim.

cleiton2193 commented 3 years ago

Hoje mesmo eu já vou começar a ler a respeito, mais o tempo aqui é meu inimigo, trabalho longe da minha casa, gasto muito tempo na estrada. Vi alguns artigos relacionados, não parece ser difícil.

cleiton2193 commented 3 years ago

https://forum.homeassistantbrasil.com.br/t/tenha-seu-home-assistant-na-google-assistant-manual/132

Nesse site explica a respeito B1 gmans. Dessa forma só usa o código fonte próprio da amazon, e os dispositivo é adicionados automaticamente quando encontra a sua placa.

b1gmans commented 3 years ago

https://forum.homeassistantbrasil.com.br/t/tenha-seu-home-assistant-na-google-assistant-manual/132

Nesse site explica a respeito B1 gmans. Dessa forma só usa o código fonte próprio da amazon, e os dispositivo é adicionados automaticamente quando encontra a sua placa.

https://github.com/matwerber1/aws-alexa-smart-home-demo

cleiton2193 commented 3 years ago

Obrigado. Vou dar uma olhada nesses documentos.

Obter o Outlook para Androidhttps://aka.ms/AAb9ysg


From: b1gmans @.> Sent: Thursday, April 1, 2021 7:35:22 AM To: vintlabs/fauxmoESP @.> Cc: cleiton2193 @.>; Comment @.> Subject: Re: [vintlabs/fauxmoESP] Alexa can't discover devices (#166)

https://forum.homeassistantbrasil.com.br/t/tenha-seu-home-assistant-na-google-assistant-manual/132

Nesse site explica a respeito B1 gmans. Dessa forma só usa o código fonte próprio da amazon, e os dispositivo é adicionados automaticamente quando encontra a sua placa.

https://github.com/matwerber1/aws-alexa-smart-home-demo

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/vintlabs/fauxmoESP/issues/166#issuecomment-811817834, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKKH3FWWO6SABE2XU7KJ3Y3TGRD6VANCNFSM4ZELWH4A.

pvint commented 3 years ago

@b1gmans - Thanks for the investigation. In investigating the original problem I had added a few items to the template in the hopes of reducing the chance of similar failures in the future. I knew it could impact the number of devices, but honestly I didn't test specifically for that and it appears it had a greater impact than I predicted.

I'll trim it down and try to get a new release out quickly.

b1gmans commented 3 years ago

@pvint - great - I couldnt create a PR - but if you look at the zip file I posted above, you can see my code changes - basically I trimmed the template right down for when there is an "ALL" devices request - to just the bare min - but it works and is acceptable to alexa.

cleiton2193 commented 3 years ago

Parabéns B1 gmans, acabei de testar a suas modificações, está funcionando perfeito, nunca consegui encontrar mais de 3 dispositivos com o esp01, testei com 5 dispositivos agora e funcionou perfeitamente. E encontrou os dispositivos na primeira busca. Parabéns novamente.

UweHeinritz commented 3 years ago

Hi, with the changes of b1gmans the Echo Dots were able to discover the lamps again. Unfortunately, it still doesn't work with my Echo Show 5 devices. I will try it again later with a reduced number of lamps (currently 14).

UweHeinritz commented 3 years ago

With the new version of FauxmoESP (and 14 lamps), the ESP32 freezes after a few seconds. I managed to update the ESP (wireless) with restarting the device while my computer was compiling the new firmware. I only used 2 lamps in the new firmware. This time the ESP32 was responding also after a few minutes. The best thing: also the Echo Show 5 devices did discover the lamps. I will check later what is the max possible device count for the Echo Show 5.

cleiton2193 commented 3 years ago

Boa tarde . @WueHeinritz, se puder fazer esse teste com o wcho show 5 e nos informar, vai nos ajudar muito. Quantos dispositivos ele realmente aceita e que funciona bem. Aqui com echo dot 3 geração, funcionando muito bem com 18 dispositivos.

pvint commented 3 years ago

I've implemented changes as suggested by @b1gmans (Thanks!) and it is now in the master branch and I created a new release 3.4 which should be available in Arduino and PlatformIO in the next 24 hours.

I tested with 16 devices on ESP32 (that's as high as I went because I grow weary of deleting all the devices from Alexa!), and got up to 10 devices on ESP8266, so it's actually better than in the past!

cleiton2193 commented 3 years ago

Muito obrigado @pvint, assim que estiver disponível, irei fazer o teste, mais com a mudança do b1gmans já está funcionando muito bem ,será que com essa mudança, vai resolver o problema com a incompatibilidade do echo show 5 , que o nosso colega colocou documentou logo a cima? Desde já um muito obrigado, bom final de semana a todos.

pvint commented 3 years ago

I believe that it will fix the Echo Show 5 issue, but I cannot be sure, since I do not have one to test.

cleiton2193 commented 3 years ago

Entendi, muito obrigado.

UweHeinritz commented 3 years ago

Hi, I upgraded to FauxmoESP 3.4 and compiled a new firmware für the ESP32 with 10 lamps. The lamps get discovered the Echo Dot 4 and from the Echo Show 5 also. Good work!!! The only problem which is left, is that all names with german umlauts (ä,ö,ß) are read in incorrectly by the Echo devices and thus do not work with voice commands. In the alexa app the lamp with name "LED weiß" get shown as "LED weiÃ▯".

If I open the "lights" website of the ESP32 (/api/2WLEDHard...../lights) in a browser on my computer, the names are OK. There the lamp is correctly shown as "LED weiß".

barneyz commented 3 years ago

Hi, you can rename devices in the Alexa app. I defined Kuechenlicht and Kuechenschranklicht in the sketch, Alexa could switch Kuechenschranklicht by voice, but not Kuechenlicht. I renamed Kuechenlicht to Küchenlicht in the Alexa app and now all was ok.

rezendeneto commented 3 years ago

Hi, I'm using the Amazon Alexa app for android with the ESP32 running the fauxmoESP_basic example but the app can't find anything... any ideas?

cleiton2193 commented 3 years ago

Boa tarde. Vc pegou a última atualização da Biblioteca fauxmo?

cleiton2193 commented 3 years ago

Versão 3.4