-
Notifications
You must be signed in to change notification settings - Fork 100
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
Added the ability to auto configure hidraw device #44
Conversation
…h for dongle via USB IDs
Also, there are bunch of spots in 0.0.5 that say '0.0.4' in the debug logs. I didn't fix those, but they're present. |
Nice ... This will remove my need to add a custom udev rule. I keep having issues where the device path changes. Sometimes it But this is the workaround I'm currently testing... On the host run: echo 'SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e024", SYMLINK+="wyze"' | sudo tee /etc/udev/rules.d/99-wyze.rules > /dev/null \
&& sudo udevadm control --reload \
&& sudo udevadm trigger Then the device should be available at |
I was doing something similar, but hass.io (which I run in Docker on an Intel machine) completely ignores any symlinks you set up. It's probably possible to change the component so that the "device: auto" isn't needed in configuration.yaml, but I don't know enough about the custom_component architecture to make that work correctly. I know for a fact my code won't run on a Windows install, but I don't think this component ran on Windows to start with. |
Good to know ... I may run into the same thing then ... i haven't actually switched over to Edit: Sure enough ... looks like docker is not passing through the symlinked device 😞 ... so hopefully this gets picked up soon-ish 😀 |
FWIW, i've just uninstalled my existing ha-wyzesense and installed the one from this PR and so far so good 👍 I'm running Hass.io via Docker on a Ubuntu 18.04.3 server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we make it auto
by default by updating this line...
from:
vol.Required(CONF_DEVICE): cv.string,
to
vol.Optional(CONF_DEVICE, default="auto"): cv.string,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had some nit picky comments, but I think these changes should be good. Though to be fair I've only really dealt with ubuntu servers, so can't really speak to how that ls -la /sys/class/hidraw
comes through in other servers.
def findDongle(): # wmm | ||
df = subprocess.check_output(["ls", "-la", "/sys/class/hidraw"]).decode('utf-8') | ||
for l in df.split('\n'): | ||
if ("e024" in l and "1a86" in l) or ("E024" in l and "1A86" in l): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be better to do something like:
ll = l.lower()
if ("e024" in ll and "1a86" in ll):
This way take out 2 extra searches in each string plus reduces the chance that someone updates one set, but not the other.
|
||
def setup_platform(hass, config, add_entites, discovery_info=None): | ||
|
||
if config[CONF_DEVICE] == 'auto': #wmm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make this ignore case too? Sorry ... nit picking here 😀
if config[CONF_DEVICE].lower() == 'auto'
Made changes less sensitive to inconsistencies in capitalization.
Those are quality suggestions ammmze. I had tried changing that vol.Required line to vol.Optional before, but I did not know to add the ', default = "auto"' part. I tested these changes and they worked for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👍 great work
This PR has been completed for a month, is there any plan to implement this into Master? The ability to auto detect the proper hidraw device would prevent a lot of headache. |
I can confirm this has fixed my problem of hidraw number change on reboot. The change works for me on a linux system runinng on a NUC. Thanks for the help! |
Sorry all, I've been totally away from the project trying to finish up my undergrad. I'm adding another community member as a maintainer for now until I can get back on this. |
Enter the following config data for wyzesense:
The custom_component will use the contents of /sys/class/hidraw to determine which hidraw device is the Wyze receiver dongle and then use that info to initialize the dongle.