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

echo dot can't find devices python 3 / Kind of working code end of 2022 #40

Open
justvam opened this issue Dec 26, 2022 · 13 comments
Open

Comments

@justvam
Copy link

justvam commented Dec 26, 2022

Alexa doesn't seem to find fauxmo, I tried changing model number to 1.0 in xml.
I tried replacing urn:Belkin:device:** in if data.find(b'M-SEARCH') == 0 and data.find(b'urn:Belkin:device:**') != -1: with upnp:rootdevice instead of urn:Belkin:device:**
because when I use urn:Belkin:device:** fauxmo doesn't responses at all.

Entering main loop                                         

Responding to search for office lights
Responding to search for kitchen lights
Responding to setup.xml for office lights
Responding to setup.xml for kitchen lights
Responding to search for office lights
Responding to search for kitchen lights
Responding to search for office lights
Responding to search for kitchen lights
Responding to search for office lights
Responding to search for kitchen lights

and then alexa says that she can't find anything.

maybe it's because of

message = bytes(message, 'utf-8')
socket.send(message)

and

message = bytes(message, 'utf-8')
temp_socket.sendto(message, destination)

but if I send it directly without bytes() than it gives me error
a bytes-like object is required, not 'str'

same for data.find('stuff')
If I don't make it data.find(b'stuff')
then I get argument should be integer or bytes-like object, not 'str'

code:

fauxmo.zip

@justvam
Copy link
Author

justvam commented Dec 26, 2022

I was figuring this out from 8 am, now it's 3pm.

I finally fixed the code and connection works.

now I need to fix the turning on and off;

Here's the code:

fauxmo.zip

@justvam
Copy link
Author

justvam commented Dec 26, 2022

I fixed everything now, Here's the fully working code, (At least for me it works perfectly)
I would create pull request if I wasn't lazy (And also I don't know how to do it properly), so I will just keep this issue opened.

fauxmo.zip

@justvam justvam changed the title echo dot can't find devices python 3 echo dot can't find devices python 3 / Working code end of 2022 Dec 27, 2022
@strunker
Copy link

strunker commented Dec 29, 2022

I fixed everything now, Here's the fully working code, (At least for me it works perfectly) I would create pull request if I wasn't lazy (And also I don't know how to do it properly), so I will just keep this issue opened.

fauxmo.zip

So weird because I was literally JUST trying to update this to work with Py 3+ and I ran into this exact same error. And while I am no longer receiving the error, using your code, the devices are still not getting discovered for me sadly.

image

@justvam
Copy link
Author

justvam commented Dec 30, 2022

@strunker try replugging echo dot (it actually helped me) and try at least 2 times to discover devices without restarting the script. Sometimes alexa just sends different requests. I've left in the code something like
#dbg("Responding with: " + str(message) + "\n") and
#dbg("Receiving " + str(data) + "\n")

basicly uncomment every dbg()

Alexa should send something like this:

image
image

@strunker
Copy link

@Vamaka12 so I actually do see replies but the switches dont ever seem to get discovered by Alexa. You can see on the right side. Am I doing something wrong there? All I should have to do is simply scan for them after starting up fauxmo right?
image

@justvam
Copy link
Author

justvam commented Dec 30, 2022

@Vamaka12 so I actually do see replies but the switches dont ever seem to get discovered by Alexa. You can see on the right side. Am I doing something wrong there? All I should have to do is simply scan for them after starting up fauxmo right? image

Yup you just have to simply scan for them after starting up fauxmo
and it looks like you didn't uncommented all dbg(), can you uncomment all of them please?

After echo dot get's setup.xml it should respond with this
image

I was stuck at the same problem you have now. Here's last things that I did after which it started working:

  • I checked that http://192.168.0.143:54001/setup.xml and http://192.168.0.143:54002/setup.xml (for you it's http://10.1.1.238:54001/setup.xml and http://10.1.1.238:54002/setup.xml) was opening in browser while script is running
  • I was changing SETUP_XML multiple of times (I spend 1-2 hour on it didn't helped, last xml which I am using is already in code)
  • I added "Wemo" skill to alexa app (you need to create wemo account and link it)
  • And then I replugged echo dot

After I replugged I waited untill the blue light turned off and tried searching for 2 times (on second time it worked).

first time I searched through app, and second time I tried asking "Alexa, find devices"

so, check that you can open setup.xml in your browser, add wemo skill to alexa app and replug echo dot.

@strunker
Copy link

strunker commented Dec 30, 2022

@Vamaka12 so I actually do see replies but the switches dont ever seem to get discovered by Alexa. You can see on the right side. Am I doing something wrong there? All I should have to do is simply scan for them after starting up fauxmo right? image

Yup you just have to simply scan for them after starting up fauxmo and it looks like you didn't uncommented all dbg(), can you uncomment all of them please?

After echo dot get's setup.xml it should respond with this image

I was stuck at the same problem you have now. Here's last things that I did after which it started working:

  • I checked that http://192.168.0.143:54001/setup.xml and http://192.168.0.143:54002/setup.xml (for you it's http://10.1.1.238:54001/setup.xml and http://10.1.1.238:54002/setup.xml) was opening in browser while script is running
  • I was changing SETUP_XML multiple of times (I spend 1-2 hour on it didn't helped, last xml which I am using is already in code)
  • I added "Wemo" skill to alexa app (you need to create wemo account and link it)
  • And then I replugged echo dot

After I replugged I waited untill the blue light turned off and tried searching for 2 times (on second time it worked).

first time I searched through app, and second time I tried asking "Alexa, find devices"

so, check that you can open setup.xml in your browser, add wemo skill to alexa app and replug echo dot.

So I uncommented the last of the dbg() My responses look differe than yours, I never see any posts? I also can reach in browser. I downloaded the mobile app setup a new account, unlinked relinked the alexa skill as well, still nothing for me.

There must be something else going on for me though becaus ethere is a new maintained python 3 version of this, you can find it below. And that doesnt work for me either. You may find it of interest though so linking it here. The xml that generates is entirely different from the one this project generates. In either case neither are working for me sadly.

https://pypi.org/project/fauxmo/

image
image

@justvam
Copy link
Author

justvam commented Dec 30, 2022

@strunker
I don't have any ideas other than that I send you the wrong code (Could be a possibility, sorry if that's the case)

I don't think that it will change something but still try this one:
fauxmo.zip

for me it looks like that with the exact code that I posted above:
image

Just in case I use python 3.10.4

Also I've tried https://pypi.org/project/fauxmo/
but I just couldn't get it to run

@strunker
Copy link

@strunker I don't have any ideas other than that I send you the wrong code (Could be a possibility, sorry if that's the case)

I don't think that it will change something but still try this one: fauxmo.zip

for me it looks like that with the exact code that I posted above: image

Just in case I use python 3.10.4

Also I've tried https://pypi.org/project/fauxmo/ but I just couldn't get it to run

Thanks for trying to help, and yeah it seems to be the problem for me that I never get anything back from the echo device. I have my firewall turned compeltely off on this machine, and turned off my sec product so cant imagine the incoming port is being blocked. I can also browse the .../setup.xml file from a different computer, not just locally to this machine, which indicates there isnt a port issue. Just odd, I never get the Post back, which I asume comes from the echo? As some type of acknowledgement that the switch was added? What do the switches look like in your Alexa app?

@justvam
Copy link
Author

justvam commented Dec 30, 2022

@strunker

You're welcome, The first Post you recieve after setup.xml is to get current status of the switch/plug and I guess it also works as a confirmation.
image

Sure:
image
image

If you will find any solution you can write it here, will be interesting to read how you fixed it.

@strunker
Copy link

@strunker

You're welcome, The first Post you recieve after setup.xml is to get current status of the switch/plug and I guess it also works as a confirmation. image

Sure: image image

If you will find any solution you can write it here, will be interesting to read how you fixed it.

Interesting so they show up as smart plugs then not switches. TY again.

@justvam justvam changed the title echo dot can't find devices python 3 / Working code end of 2022 echo dot can't find devices python 3 / Kind of working code end of 2022 Dec 31, 2022
@c240amg
Copy link

c240amg commented Feb 18, 2024

I've forked this repo and have added your code @Vamaka12 so that we can see the differences in a PR.

I've had issues with my belkins, as they only seem to work with a 1st Gen echo device. My 2nd/3rd/4th gen devices don't recognise them at all...

@justvam
Copy link
Author

justvam commented Feb 18, 2024

Sure, feel free to do anything with the code. I git cloned your fork and it works, out of the box.

Never had belkins, and I only have a single gen 4 echo, so can't really help you with that.

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

3 participants