Danielhiversen / PyXiaomiGateway

PyXiaomiGateway
MIT License
152 stars 55 forks source link

attempt to fix binding of socket #172

Closed starkillerOG closed 4 years ago

starkillerOG commented 4 years ago

This is an attempt to resolve this issue: https://github.com/home-assistant/core/issues/37306

dshokouhi commented 4 years ago

All the changes here and mentioned in the ticket (https://github.com/home-assistant/core/issues/37306#issuecomment-653622458) have also resolved #171 for me

starkillerOG commented 4 years ago

Tested it and it still works for me. Although it has always worked on my setup....

@fliphess can you test to see if it also fixes your issue....

meichthys commented 4 years ago

@dshokouhi Could you outline how you tested this? Did you modify the existing integration in your instance, or did you setup a custom integration with the above changes?

If you modified your existing integration, could you let me know where you found the init.py file to modify? I can't seem to locate it on a HASOS install.

dshokouhi commented 4 years ago

@meichthys as I run my dev environment in a venv I am able to modify the system files directly. In my venv this file is located at:

/srv/homeassistant/lib/python3.7/site-packages/xiaomi_gateway/__init__.py

You can run the changes for Home Assistant in a custom component by copying all the files from the branch mentioned in the comment https://github.com/home-assistant/core/issues/37306#issuecomment-653622458. There is a lot going on here with this change because we need parent library updates from this PR as well as HA changes mentioned in the comment.

You'll need to find out where yours is located for your install, if you are on the HA discord you can just ask in the installation channel to get quick help.

meichthys commented 4 years ago

@dshokouhi Ok, Thanks. I asked in Discord and it sounds like it's recommended to just setup a custom component. I'll give it a shot and report back here with my results.

meichthys commented 4 years ago

I get this after setting up the custom component and rebooting: image Any ideas? @dshokouhi

dshokouhi commented 4 years ago

@meichthys thats what i was trying to explain to you. You can't just run a custom component here, you must include the parent library changes which requires either this PR to be merged a new release to be pubished to pypi or you need to modify the file directly. Custom components are only for the HA side of things.

meichthys commented 4 years ago

I see. I'll be patient and wait for the next release.

borland502 commented 4 years ago

I'll be a good boy too then. I can set up only one of the gateways through the flow process, where as prior to 114 both worked in yaml config. Edit: I was saved trying to be helpful by implementing a custom component and then asking the same questions

meichthys commented 4 years ago

For me I can’t even get a single instance of the integration working, although most others seem to only have issues with multiple instances.

starkillerOG commented 4 years ago

@syssi @Danielhiversen could you merge this? I have tested it on my enviroment and it actually also improves it for users not experiencing problems:

It schould also fix some issues for users experincing binding problems of the socket.

borland502 commented 4 years ago

I'm not sure this is useful, but as I said earlier... One gateway works, one does not now. However, even on another home assistant I cannot bind to the gateway that would not be bound, though it is discovered. I know I have the same generation, but different v3 gateway models because I had to perform surgery to open the software port. Does this potential problem have an issue even with different home assistants?

borland502 commented 4 years ago

Success. I updated the firmware on the non-responsive one to 1.4.1_176.0220 and was able to successfully configure both. The one that worked before is still on an older firmware.

starkillerOG commented 4 years ago

Thanks for merging!