Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Espalexa aways returns 255 #49

Open
CodeNoMore opened this issue Feb 9, 2019 · 32 comments
Open

Espalexa aways returns 255 #49

CodeNoMore opened this issue Feb 9, 2019 · 32 comments

Comments

@CodeNoMore
Copy link

Using a previously working sketch it was rebuilt using the latest Espalexa 2.3.3 and the release 2.5.0 for the ESP8266. The return value is always 255 for On or Off much like what occurred with 2.4.2 without the webserver file hack. My understanding was that issue which is related to the Alexa itself was corrected in the 2.5.0 but yet the behavior of the sketch has reverted back to how it worked without the 8266 library hack.
Have you seen this behavior or is there something else I need to do with the 2.3.3 and the 2.5.0?

Thanks, your support is appreciated.

@MrDadaGuy
Copy link

MrDadaGuy commented Feb 10, 2019

I just started using this library today, and when I say "Alexa turn (device) green" it always returns 255 each for R, G, and B.
It does correctly set the brightness. However with color there is never any difference, it's always 255,255,255. I noticed this is the case from Echo Show as well as from the Alexa app on android. If I select a color, it always comes through as 255,255,255.

@MrDadaGuy
Copy link

Quick update, I removed the devices from Alexa and re-initialized. This time it came up as "Royal Philips Electronics smart device" upon discovery -- previously it was something else.
Now it's working great!! Fantastic project, thanks a million!!

@CodeNoMore
Copy link
Author

MrDadaGuy provided a good hint. When I looked in my device list I have for the Espalexa devices "Light Strip" and "Royal Philips Electronics smart device" on each device. When I had Alexa Forget the "Light Strip" device everything works as designed. The issue is if I rerun Discovery it adds all the same devices with "Light Strip" and I have to go in and delete them for things to work correctly.
How can I prevent the "Light Strip" device from showing up on discovery?
Thanks.

@Aircoookie
Copy link
Owner

Interesting, never heard of that issue yet! I always only get the "Royal Philips Electronics smart device". Do you have multiple Echo devices on the network? And do you discover via app or voice? I think it might be possible that the device gets added twice because two Echos discover it in different ways...

@MrDadaGuy
Copy link

MrDadaGuy commented Feb 10, 2019

"Light Strip" -- yes, that's the other device I had previously removed.

To answer @Aircoookie - I have multiple Echo devices -- a couple of Echo Gen 1, a few Dot gen 2, an Echo Show (this has a Hue hub I believe). I was discovering using the Android Echo app. I was also using the android app for most of my testing, and validated using Show and Dot once I got my code working.
My code is here: https://bitbucket.org/veggiebenz/moonlight-esp8266/

Edit: I might have initially discovered using the Web interface https://alexa.amazon.com/spa/index.html#appliances

@MrDadaGuy
Copy link

I've done some more testing and subsequent discoveries (through web interface) will usually result in duplicate devices, one that's a Light Strip, and another Royal Philips Electronics smart device. I am deleting the Light Strip device and things are behaving well.
Thanks again for a great project!

@CodeNoMore
Copy link
Author

I have multiple Echo devices (Gen1, Gen2, maybe one Gen3 not sure on that) but it does not matter if you use voice Discovery or the Web interface it still discovers the two different devices for each physical device.
What in the library is the origin of the "Light Strip" descriptor?
Thanks.

@brentbrooks70
Copy link

brentbrooks70 commented Feb 14, 2019

I am also experiencing an issue where the device shows up as Light Strip and not Royal Philips Electronics smart device. I am running v2.3.3 on Adafruit Feather32 (ESP32) core 1.0.1 on Arduino IDE 1.8.7. To make things even more interesting the device worked great for about 2.25 days but as of this morning, I had 4 (the number of devices declared in my ESPAlexa sketch) new devices all of the Light Strip variety where they all had been Royal Philips Electronics smart device previously. I did not initiate a new discovery but cannot guarantee no one else in my house did not. The ESP32 device did not reboot during this period (i have it report it's uptime via MQTT to my backend) but since the new devices showed up this morning everything is reported as full brightness and white. I have deleted the Light Strips and run a new discovery but still show up as Light Strip. I have run discoveries from the Android app, Apple app, Show v1, Dot v2 & v3 and Echo Plus with Smart Hub built in. I even tried reflashing the same code just too see what happened (same results). I am at a loss as to what to try next...any suggestions would be greatly appreciated. Great project, when it works it is awesome!! Here is a screenshot showing the details of one of the lights in question.
screenshot_20190214-091548_amazon alexa

@brentbrooks70
Copy link

Okay, after removing my Dot Gen3 from my environment, deleting my 4 discovered devices, running a discovery from any of the previously mentioned devices/apps finds them as Royal Philips Electronics smart device!?! I will leave the Gen3 offline for a few days and see what happens, if all continues normally I will re-introduce it and let you know what happens. Again, great library

@CodeNoMore
Copy link
Author

I want to clarify/correct on my previous statement in that I have only Gen1 and Gen2 devices and they are running the latest firmware. The "Light Strip" only shows up in the app under devices when I run discovery from the app and it does not show up when I run it using voice from either the Gen1 or Gen 2 devices. Using voice I get the "Royal Philips Electronics smart device" and everything works as designed. I have noticed after a router reboot that the "Light Strip" shows up again but that needs to be confirmed to be 100% that the reboot is what caused it to appear.

@CodeNoMore
Copy link
Author

I had checked at night and no "Light Strip" was present but this morning it came back. No discovery was initiated by me and the router had not rebooted so it seems that Amazon issued a "Discover Devices" overnight and maybe it is done at some preset intervals. When the "Light Strip" appears you can only turn the devices on but not off so until you delete the "Light Strip" which could be at least once a day it cripples usage.

@brentbrooks70
Copy link

@Aircoookie I concur with @CodeNoMore that during the night last night a non-requested discovery took place again replacing the Royal Philips Electronics smart device with Light Strip. I deleted ran voice discovery from Show v1 and all come back to Royal Philips Electronics smart device. 5 hours later they were all back to Light Strip, again with no requested discovery??? I am able to discover Royal Philips Electronics smart device via the Android app sporadically, 2 out of 20 tries during last round of testing, other 18 times shows as Light Strip. Is there anything I can provide, code, debugging logs, etc to help diagnose?

@brentbrooks70
Copy link

I am not sure if it matters, but I do have a Phillips Hue Gen2 Hub in my environment, just thought I'd throw that out there.

@Aircoookie
Copy link
Owner

Ok, I just had my devices replaced with "light strips" without discovering as well!
I can still control on/off/dim wtih those, but even though they claim to support color, it has no effect.
I have a hunch this is because the modelid in the device JSON is "LST001", which is the 1st gen Hue light strip. Probably Alexa hasn't taken that into account before, but now does.

I'll get back to you once I have something to report!

@Aircoookie
Copy link
Owner

Okay, I just pushed an update to mitigate this!
It seems like my huch about the modelid was correct for my environment at least. Color as well as dimmable devices show up as "Royal Philips Electronics smart device" again and work as expected.
Please get back to me on whether this fixes the issue for you as well!

@brentbrooks70
Copy link

brentbrooks70 commented Feb 15, 2019

@Aircoookie I have updated the library and reflashed the board (the library is not yet available via Arduino IDE). All devices were still showing as Royal Philips Electronics smart device so I did not delete them. Everything seems to be working well, will update later. Thanks for the quick update!!

@brentbrooks70
Copy link

Everything worked great until this morning, now instead of Light Strip my devices have become Color Light and exhibit the same symptoms (all 255) as before. Since I had not deleted the previous devices prior to this update I have now done that and we are back to working. Will update again later tonight or tomorrow if this happens, or not, again.

@Aircoookie
Copy link
Owner

@brentbrooks70 what Echo model are you using? If it is an Echo Dot, you are likely experiencing #6. Downgrading the esp8266 arduino core to v2.3.0 or using #define ESPALEXA_ASYNC could help. This wouldn't explain why it worked last night for you though (except if you have multiple Echos, where one discovers correctly and the other one overrides it with the broken configuration).

@brentbrooks70
Copy link

@Aircoookie I am not running on an esp8266, I am using an esp32 (Adafruit Huzza Feather32) with core 1.0.1. I have several gen2 Dots, an Echo Plus (zigbee hub built in), couple gen1 Shows and a gen3 Dot which I unplugged couple days ago during testing and this seemed to help with the application discover.

I think my issue yesterday was because I had not deleted the devices after deploying the new library. When I updated the library my defined devices all still worked so I left them and ultimately they turned into the “Color Light” (which I’m guessing is what you changed Lst001 to ). Since deleting them almost 24 hours ago and re-discovering they have worked perfectly. I will update again in another day to let you know if it is still working or sooner if not. I appreciate all the help,!

@Aircoookie
Copy link
Owner

Ah sorry, forgot to mention that important detail! Deleting the old device with the wrong type manually (and probably re-discovering once) seems to be required.

@CodeNoMore
Copy link
Author

I just tested the 2.3.4 library and I do not get two devices on a discovery however the single device I get is "Dimmable Light". This always responds with a 255 for a On or Off command so things are different but still not working here. I did delete all the devices before the Discovery and repeated it twice.
Thanks.

@Aircoookie
Copy link
Owner

Aircoookie commented Feb 17, 2019

@CodeNoMore you are affected by #6! Try #define ESPALEXA_ASYNC or use esp8266 arduino core 2.3.0 or 2.5.0 beta 1.

@CodeNoMore
Copy link
Author

I change my code per your suggestion to use the async webserver as I have used that library before. I am glad you put support for it in this project. Things do now work as designed with the minor nuisance of two virtual devices showing up on each physical device in the list. I have several devices so it creates a bit of clutter and confusion. There is a "Royal Philips Electronics smart device" and a "Dimmable Light" the difference being from before is that control functions correctly in spite of having two devices listed for the same physical device. It would be nice to only get one virtual device per physical device showing up in the device list if you know a solution to that issue.
Thanks.

@Aircoookie
Copy link
Owner

@CodeNoMore ok, good that it's at least working for now. The two virtual devices are created because of the implementation differences between Echo Dots (1st and 2nd gen) and other Echos (Dot 3rd gen and most big Echos). I don't have an option to patch this, Amazon will need to patch the earlier gen Echo Dots to exhibit the same behavior the other models do. You can try unplugging all your Echo Dots Gen 1 and 2, deleting all devices and discover again to only keep the "Royal Philips Electronics smart device". I don't know how it will take though until "Dimmable Light" appears again after turning on the Dots, since it seems like Echos periodically discover devices automatically without being asked to do so.

@CodeNoMore
Copy link
Author

Thanks for the explanation. Unfortunately I spoke a bit too soon as when I add more physical devices some stop or will not work at all with all showing the two virtual names. From my tests it seems that Amazon at least does a discovery every night and maybe more so it does make this basically unusable. Doesn't seem like any options at this point from what you have said since it is 100% on Amazons side.
Thanks.

@Aircoookie
Copy link
Owner

I have a slight hunch right now. Can you try deleting all devices in the app, but discovering via voice on your Echo (not Dot) 2 or Echo Dot 3 (you should have one of those, otherwise you shouldn't get Royal Philips devices). That should yield only functional devices, if I'm correct.

Otherwise, I'll get back to you once I have news on how to get the library to work properly.

@CodeNoMore
Copy link
Author

I disconnected all but one of the ESPAlexa devices to keep it simple and ran voice discovery from the Gen1 Echo (tall). What showed up in the list was "Royal Philips Electronics smart device" and "Dimmable Light".
As a second experiment I did do voice discovery from a Gen2 Dot and it found "Dimmable Light" however after repeating the voice discovery a second time then the "Royal Philips Electronics smart device" showed up as well. That may have just been a timing issue why it did not show up on the first attempt.

Hope this helps.
Thanks.

@Aircoookie
Copy link
Owner

Aircoookie commented Feb 19, 2019

Interesting, this negates my theory that a device is only added from the Echo you voice discover with!

@everyone Contrary to what I said previously, 2.5.0 beta 1 apparently DOES have the Content-type bug with the empty body and resulting "always 255" behavior. Please use 2.3.0, 2.4.x with workaround #6 or the async version until the issue is resolved.

"Always 255" is unrelated to the "Dimmable Light" vs "Royal Philips Electronics smart device" behavior, although the "Royal Philips Electronics smart device" will work with any Arduino core version because those Echos don't send an invalid content type.

@CodeNoMore
Copy link
Author

This has been a bit of a conflaguration as this issue has morphed from how it started. After changing to the async webserver the original 255 issue was corrected as you have stated it should be but I thought that issue was still occurring because of the two different virtual device name which induced the original issue before migrating to the async webserver. That as it turns out was not the case. The two virtual device names for each physical device were being counted against the max number of devices set to 10 in the library. The number of counted devices was times two from the physical so I ran out of devices with the default setting and things stopped working correctly and somewhat erratically. Once I determined this I increase the number of devices using "#define ESPALEXA_MAXDEVICES" and now everything works as designed. Unfortunately there are still two names for each device cluttering up the list but hopefully that will be resolved at some point.
Thanks.

@Aircoookie
Copy link
Owner

Aircoookie commented Feb 19, 2019

@CodeNoMore so you are saying, for every espalexa.addDevice() call, two devices are actually being added to the library? Please check the [esp-ip]/espalexa page, do the devices appear there twice too?

@CodeNoMore
Copy link
Author

Hmmm... I checked the IP/espalexa and it only shows one device like it should so that indicates it is only assigning one device within espalexa like it should. I guess at this point I don't have an explanation for what was causing the second issue I was seeing after the switch to the async webserver which ultimately corrected the always 255 issue.
Thanks.

@brentbrooks70
Copy link

@Aircoookie Sorry for the delay in reporting back... Since I last updated I have had to delete my discovered devices again, about 70 hours ago, as they had become "Color Light" once more and of course, began returning the ambiguous 255s again. Since then I have had no issue with any unrequested discovery but I have yet to return my Dot gen3 into service. I will do so this evening and see if that changes anything.

Again please let me know if I can perform any additional testing for you from my current type board (ESP32) or I have a few 8266s around I could load any combination library/core and have access to Show gen1, Echo Plus gen1, Dot gen2 & 3 and a Look. I do have several VLAN segregated WiFi networks so I could completely isolate a particular board and Echo device to be sure only they could discover/communicate with each other. Not sure if that would be of any value or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants