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

Thank you @stephen_nutt! So, no camera needed. Just the starter kit. Gotcha! And I realized that after I turned off my ad blocker, the Wyze site makes more sense. I was clicking the different options and the picture would not change and I was trying to figure out what the difference was between them and what came in the starter pack. LOL

How hard was it for you to get everything running with the Pi and HE?

Again, thank you @stephen_nutt

Mine set up pretty easily. The biggest problem I had early on was remembering to restart the telnet and the bridge after a hub reboot. Now I've automated that with node red. if you have other USB devices plugged into your RPi, make sure that the setup is correct for the bridge

Thanks @stephen_nutt.

And which sensors are you using? Just contact and motion?

Thanks again.

I believe that is all that Wyze makes currently.

is there any way to add automation to this? so instead of me having to go in and click connecttelnet and connectbridge i can create a virtual button to do this for me?

I create this in rule machine.

@leeonestop where did you find the attributes at? from looking at the code, the only capability is "Telnet", and that's not an option to select for rules

I found it for the Trigger Event (Custom Attribute) but can't find it for the Actions to run

@dadarkgtprince what you need to do is go to the Wyze Telnet Link driver and add the following to the metadata : capability "Actuator" I put it right after the Telnet capability? then it will open the commands for you in rule machine.
under action I did the following?

  1. go to Set Mode or Variables or Run Custom Action and pick Actuator and after that you will be able to get to the commands.

If you run into any other issues let me know. Thanks

1 Like

that got it. thanks so much!

Your welcome. If you come up with a better rule please share. I been meaning to go back and revisit that rule so that If one was disconnected then it would restart the app but it been working good as is so I haven't.

Stephen, would you mind posting the export of the WyseSense flows you created?

If you look at around post 67 it is there just copy and paste.

Ah, missed that some how, thanks!

I'm not doing too much with it, just having it refresh every day at a specific time, but I do want to try teaming it up with @jwetzel1492's [UPDATED] iPhone WiFi Presence Sensor, so if I ever reboot the linux instance, I'll have it automatically restart the telnet and bridge. Probably gonna test that this weekend

I set up my rules like this:

  • install nginx on ubuntu server (need port 80 for presence device to work)
  • use iphone wifi presense device to ping server
    • I created a rule to ping it every 10 seconds. i also altered the rule to quickly mark the device as present/not present
  • create rule to run when device arrives

Since I'm running a Ubuntu VM, it's presence will be available before the Telnet can connect, so I put it on repeat. Outside of that, it's pretty similar to your rule

Thanks for the update. I like what you doing with the Ubuntu VM.

I noticed you said you were using an Ubuntu VM for your WyzeSense host. Did you do anything special to get it working? I've got one built and for the life of me can't get the telnet connection going between Hubitat and the new VM. In the logs it says the following.

dev:2702020-07-02 06:17:04.994 pm errorTelnet connection dropped...

dev:2702020-07-02 06:17:04.991 pm infotelnetStatus - error: receive error: Stream is closed

However, if I SSH into the VM and run sudo systemctl status inetd to show the status I see the following, emphasis on "Hubitat."

Active: active (running) since Thu 2020-07-02 22:08:11 UTC; 10min ago
Docs: man:inetd(8)
Main PID: 1832 (inetd)
Tasks: 2 (limit: 2317)
CGroup: /system.slice/inetd.service
├─1832 /usr/sbin/inetd
└─2679 in.telnetd: Hubitat

If I click disconnect from within Hubitat that connection goes away.

Thoughts?

Yes. I had to change the code to reflect a portion of my welcome message for Ubuntu. By default it's expecting the welcome message from a RPi

if (msg.contains("Welcome to Ubuntu")) {
    sendEvent(name: "TelnetSession", value: "Connected"); 
    log.debug "Telnet session opened!";
}

I also changed the def startBridge() function

def startBridge() {
    def msg = "sudo reset && sudo sh -c ${wyzeSensePyScriptPath}";
    log.debug "Starting Wyze Hub software...";
    sendMsg(msg);
}

The reason I did this was since I was running a VM, my Wyze hub wasn't the default device, so I had to update it to /dev/hidraw1 (your device may vary depending on how many USB devices you have). Then in my device, I specified my full path. Since I need to use quotes, I also have quotes listed in my path.

"/home/>user</WyzeSensePy-master/hubitat.py --device /dev/hidraw1"
image

I made the changes to the telnet link driver so it's now looking for the Ubuntu welcome message, which worked, so thank you very much for that!

I confirmed my dongle is hidraw1, so I made the changes to the driver you suggested above and still can't get the bridge to start. Looking at the HE log I see the following is being executed when I attempt to start the bridge:

sudo reset && sudo sh -c "/home/stircwazy/WyzeSensePy/hubitat.py --device /dev/hidraw1"

Running that same command while connected to the VM via SSH it works without issue displaying information about the dongle.

Gateway info:
MAC:779C5B94
VER:0.0.0.30 V1.4 Dongle UD3U
...

I greatly appreciate your assistance thus far, any chance you have any thoughts on this one?

I just remembered, one last thing I did was remove the password prompt for sudo on the VM.

I believe I had that issue because it was prompting for the sudo password. I was testing playing around having the code enter the password but it was too inconsistent, so I instead turned off the VM for asking for the sudo password using the steps in the link above