[RELEASE] Alpha WyzeSense Integration [Code no longer being updated]

Yeah, I saw your post about dev/hidraw0 and checked. I believe this says it's correctly hidraw0:

If I understand you correctly about the Node Red part, at the 6 hour mark, you want the sequence to check one more time before alerting? Is that the question?

Yes basically if before it hit the sequence if you can have a device node that show both are connected then reroute back to the timer?. I don't know if it can be done? But if you have a device node it shows if they are connected or not. I 'm going to mess around with it and try to do it. I let you know if I have any luck.

image

Any idea how I could find and view any logs to get more detailed reason why Permission is getting denied? Everywhere I can find Googling said that using Sudo in front gives file permission. I have struggled trying to use the HousePanel dashboard app because the node server won't keep running and I wonder if this is related. It's frustrating because it says Permission denied but no further info.

Hey have you try this?

chmod +x /home/pi/WyzeSensePy-master/hubitat.py

Nothing happens. It just goes back to blinking cursor. What is supposed to happen?

Ok, so i moved Node Red and Pi Hole to my other Pi4 and reflashed the SD card and installed this from scratch. All of the sensors are back in!!! This is great news because I ordered more sensors on Tuesday and they get here Saturday. I am back in business!!!

Hey I'm glad you back in business. I'm glad all of your sensor came back? I just brought a PI-4 and put Ubuntu Mate on it just to try it out and so far it's good.

Hoping someone can assist me here. I installed Debian 10 on a spare machine I have an am attempting to set it up as my WyzeSense bridge instead of using a Pi. I was able to get everything installed successfully and my Hubitat will make a successful telnet connection, but I cannot get the WyzeHubUSB device to connect at all. The Hubitat log shows the command is being sent but nothing ever happens. I have been unable to track down any logs on the Debian box that tell me anything either. I have verified the WyzeBridge is on /dev/hidraw0 and if I manually run the command to start the hubitat.py script from the Debian box, it starts and runs successfully. I was even able to set up 2 devices on it successfully after manually starting it. I just cannot get it to run via Hubitat. Any ideas on what I am missing?

I was able to figure it out. I found some lines of code in the telnet driver file that I uncommented that gave a little more detail in the Hubitat logs. It was asking for the sudo password for the account. To get around it, I had to remove the sudo requirement for the hubitat.py file and for the /dev/hidraw0 device. I added the following line to my sudoers file to fix the hubitat.py file. Sub in your user's username for "username".
sk ALL=NOPASSWD:/home/username/WyzeSensePy-master/hubitat.py

I then had to create a udev rule to add my user's group to the hidraw device. Create a file in /etc/udev/rules.d named something like 99-hidraw-permissions.rules. Add the folowing line to it, subbing in your user's group name.
KERNEL=="hidraw0", SUBSYSTEM=="hidraw", MODE=="0664", GROUP="usergroupname"

After that I reboot and everything came up fine and I was able to connect the USB hub from Hubitat. Hope this helps someone else that may want to run this without a Pi.

@kellykoehn128 or anyone else really. I have everything working now, but noticed that the hubitat.py python script is consuming 100% of the cpu while the bridge is connected. Is this common? It doesn't seem to be causing any issues but seems like such a simple script shouldn't be maxing out an i5 processor. Does the script constantly poll for changes?

I haven't noticed only because am not sure how I would check. So... How would I check how much cpu the script is running on my Pi?

When logged into your Pi, just run 'top' and you'll be able to see the CPU usage of the script.

So the CPU usage may be 100% if you were to look at top... but linux displays CPU usage a little differently. If you are running a single-core machine (such as an earlier Pi), you will likely max out the CPU. In my case, I'm running a quad-core Pi so I have more headroom to deal with. Currently my CPU is running at 137% CPU but that is only one core being used. If you look at the load values, my load is only 1.18 and can go a max of 4 because I have 4 cores -- using that same math, 400% CPU in top would represent all cores of my CPU being consumed.

While the telnet connection stays running, it uses very little CPU. The biggest CPU usage is Python constantly watching the serial line waiting for another response (because it has to always be watching).

You can use the following one-liner to see the top CPU usage:
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head

To see what the polling script is using, run:
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | grep python

In the case of my system, that outputs the following:
2018 2017 python /home/pi/WyzeSensePy 0.9 134
which means .9 % RAM and 134% CPU used.

Hopefully that clears some things up... being in IT and having to shift 200+ workers to WFH took over my personal life for a bit so I haven't been able to respond to the thread.

Interesting. Mine seems to max around 140% but I am running on a Pi 4 so, based on @kellykoehn128's explanation, I should be fine. Also, I only notice that max when a sensor has recently detected a change and I have 15 devices that are a 50/50 of motion and contact sensors. Otherwise, I seem to be running around 25%. After a few blips at the beginning, my integration has been running solid for weeks (knock on wood).

Got it. Its been a while since I ran a Linux box and forgot the load values needed multiplied by # cores. Mine runs around 1.15 so should be fine. Thanks for the clarification.

I am curious. I was telling my brother about this integration and he thought it would be cool to use. Unfortunately, he is new into the home automation game and really only has TP-Link Kasa wifi devices; a couple of MartinJerry wifi switches plus Alexa but no hub. He also has a Raspberry Pi so I have also been telling him about Node Red and it got me thinking...

Do you know if it would be possible to get the data stream out of what you created into Node Red instead of HE so that my brother could use a variation of what you created with Node Red and not need to buy a Hubitat hub? I am asking as a complete layman so please excuse my ignorance.

Can he not load Home Assistant on his raspberry pi and do it thru HA?

he could but he is at the beginning of the journey with home automation and i don't want to throw him in the deep end.

@kellykoehn128 did you get your Wyze locks and or you going to try and incorporated the lock with WyzeSense??

I did.. I've got one setup on the backdoor. They're a different beast entirely using their own gateway to communicate. I suspect they're using a customized Zigbee protocol because my hub only partially detected it when searching (it would find it,, but couldn't interact with it).

Until stuff work with and the whole COVID19 thing passes -- that project is on the back burner. I'm really waiting until the keypad is released so I can ensure the best WAF score.

Download the Hubitat app