vintlabs / fauxmoESP

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

Support for ESP32? #28

Closed pvint closed 5 years ago

pvint commented 6 years ago

Original report by Karthik (Bitbucket: karthikvvs, GitHub: karthikvvs).


Doesn't seem to work with ESP32.

pvint commented 6 years ago

Original comment by Frank Hellmann (Bitbucket: Sandman42, GitHub: Sandman42).


Have a look here: https://github.com/sandman72/Fauxmoesp

pvint commented 6 years ago

Original comment by Xose Pérez (Bitbucket: [Xose Pérez](https://bitbucket.org/Xose Pérez), ).


Released with 2.4.0

pvint commented 6 years ago

Original comment by Xose Pérez (Bitbucket: [Xose Pérez](https://bitbucket.org/Xose Pérez), ).


Removing milestone: 2.4.0 (automated comment)

pvint commented 6 years ago

Original comment by Darlington ADIBE (Bitbucket: dadibe, ).


Not sure ESP32 is well supported yet, can only discover one random device out of 5 device. any ideas

pvint commented 6 years ago

Original comment by Darlington ADIBE (Bitbucket: dadibe, ).


Okay with a little modification I was able to discover 10 out of 10 devices within 2 discovery commands consistently on the ESP32

First I enabled debug output, then i discovered that Eco will only query the first randomly selected device /setup.xml response

My first suspect was the UUID, not sure how Alexa uses it but I guess it wasn't unique enough So I changed it in the addDevice method to make the fixed "444556" more device unique

From this

#!Arduino

// Create UUID
    char uuid[15];
    snprintf_P(uuid, sizeof(uuid), PSTR("444556%06X%02X\0"), chip_id, device_id); // "DEV" + CHIPID + DEV_ID
    new_device.uuid = strdup(uuid);

to this

#!arduino

// Create UUID
    char uuid[15];
    snprintf_P(uuid, sizeof(uuid), PSTR("%02X4556%06X%02X\0"), device_id, chip_id, device_id); // "DEV" + CHIPID + DEV_ID
    new_device.uuid = strdup(uuid);

then i started discovering 2 to 3 devices, however i noticed the UDP response was coming fast and thick, so just maybe Alexa is been overwhelmed I increased the UDP_RESPONSES_INTERVAL from 250 to 2000 and decreased UDP_RESPONSES_TRIES from 5 to 3, BAM!! 10/10 devices at first discovery attempt

I do not know the full implication of this modification but it's working for now, i don't have ESP8266 to try and find out how it will behave with the modification

pvint commented 6 years ago

Original comment by Nils (Bitbucket: nilz90, GitHub: nilz90).


good job Darlington, I will test this later with my esp32 / 8266

can you fork the repository and push your changes into your fork?

pvint commented 6 years ago

Original comment by Xose Pérez (Bitbucket: [Xose Pérez](https://bitbucket.org/Xose Pérez), ).


@dadibe I can't reproduce your results but I reckon it looks like it only discovers one device.

On the other hand, your changes have the worst impact on ESP8266 devices. From ten out of ten with the original code, it can only discover one with your changes...

pvint commented 6 years ago

Original comment by Xose Pérez (Bitbucket: [Xose Pérez](https://bitbucket.org/Xose Pérez), ).


OK, I've been doing some tests both with ESP8266 and ESP32 boards. Only using v1 devices (I don't own any v2).

I've pushed some changes to the dev branch (commit 7442667). Testing them with 10 devices both with ESP8266 and ESP32 boards works great. 100% discovery ratio.

pvint commented 6 years ago

Original comment by Darlington ADIBE (Bitbucket: dadibe, ).


Yes, UDP_RESPONSES_INTERVAL might not need changing, but as I mentioned in my post after changing the UUID I did get some improvement (3 device discovery) but I also noticed that ESP32 will issue all UDP response for undiscovered devices long before Echo finish it discovery process

As I increased the UDP_RESPONSES_INTERVAL more devices was discovered at about 1500 I was discovering all 10 devices but I decided to set for 2000.

Maybe there are other variables, like Wi-Fi network traffic, version of software running on Echo e.t.c

pvint commented 6 years ago

Original comment by Darlington ADIBE (Bitbucket: dadibe, ).


Just tested with the dev branch and i was able to discover 15 devices with one discovery command consistently with ESP32

pvint commented 6 years ago

Original comment by Rulshid sm (Bitbucket: rulshid, GitHub: rulshid).


Hi sir , i'm using esp32 with ardino ide for programming .. ,my actual aim is to control the lights in my home using local-network and also from cloud, so for that i had loaded this program in my esp32 https://github.com/nahog/esp8266-web-mqtt-fauxmo/blob/master/esp8266-web-mqtt-fauxmo.ino

(it is actually written for esp8266 but with some editing i got the program running in esp32 ) now i want to communicate to this fauxmo device by using another esp32 ..please help me !!

pvint commented 6 years ago

Original comment by Xose Pérez (Bitbucket: [Xose Pérez](https://bitbucket.org/Xose Pérez), ).


Why don't you use MQTT to communicate both devices. Or UDP or any other means. This library is meant to be a client for a specific protocol based on SSDP, not a master.