jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
96 stars 14 forks source link

Light switch support #34

Closed boothmusic closed 1 year ago

boothmusic commented 1 year ago

It’d be great if you were able to add support for the light switch. It’s such a great product but utilizing IFTT is super slow and usually unresponsive, because you can program each press to be a specific command to the WYZE app, it’d be great to utilize apples automations to control specific lights in your house while maintaining constant power to the smart bulbs.

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

tek9r commented 1 year ago

Looking for this aswell

lp86 commented 1 year ago

Looking for this too, added a new switch and spent way too much time troubleshooting just to check that it's not on the supported list :)

jfarmer08 commented 1 year ago

It is on my plan

boothmusic commented 1 year ago

![Uploading D81F93A3-5D70-4E68-A837-A1B8EFBD37E6.gif…]()

boothmusic commented 1 year ago

Wondering if there was an update on this? More out of curiosity than impatience

jfarmer08 commented 1 year ago

I have been working on this and will be posting a release within the next few weeks. I do have switch support on my test system at this time.

boothmusic commented 1 year ago

This is very exciting. Does it work well with the automations inside apples HomeKit?

jfarmer08 commented 1 year ago

I will be posting a beta within the next week or so, but have not test automation with them.

jfarmer08 commented 1 year ago

If anyone know how to update files in home bridge then feel free to download the remodel branch and test it output keep in mind there is a lot of changes. So good some bad. Clean will come soon.

boothmusic commented 1 year ago

trying to figure out how to do the update files, a bit of a whirlwind for me. I know on other home bridge versions you can easily download a beta by utilizing their "install alternate version" is there a way for us to do that?

jfarmer08 commented 1 year ago

I have not created a beta yet, but I will

jfarmer08 commented 1 year ago

@boothmusic Do you have a test system, if not I would recommend one.

boothmusic commented 1 year ago

I don’t, but I’d like to figure out how to do one

jfarmer08 commented 1 year ago

https://github.com/jfarmer08/homebridge-wyze-smart-home/releases/tag/v0.5.25-beta.1

I would recommend using a test system.

boothmusic commented 1 year ago

Please note that I'm writing all of this with the understanding that it is a beta. I figured I'd share what I'm experiencing on my end currently.

So I'm able to get it loaded into my homebridge platform and setup an automation. The light switch itself has multiple functions to it (single press, double press, triple press, long press). Currently HomeKit is only able to distinguish an on off position (which is totally fine)

Secondly While I'm able to get the switch added into HomeKit, the status of the switch is not communicating (i.e., if I press the switch at the wall, HomeKit does not see that any action is changed, and if I enable something inside of HomeKit it does not see the changes being made to the physical switch (i.e. I press the switch on my phone, the physical switch does not see the change)

I'm really impressed that you were able to get the switch added to your plugin, and thank you so much for doing that. if none of what I said was helpful, my apologies.

jfarmer08 commented 1 year ago

@boothmusic new beta release. Hopefully this one goes a little better.

Currently only Single Press is supported.

boothmusic commented 1 year ago

@jfarmer08 looks like the problem still persists. if its helpful to know, if you change the status from the wyze app (i.e. turning the switch OR their outlets on/off; that change in status does not report over to home bridge)

boothmusic commented 1 year ago

@jfarmer08 upon further testing. if I power the smart outlet off physically, it takes about 45 seconds for home bridge to recognize its status.

if I power the switch on or off physically home bridge does not recognize it

jfarmer08 commented 1 year ago
Screen Shot 2022-12-07 at 6 21 11 PM

Which one do you have checked? How many Switch?

jfarmer08 commented 1 year ago

What is your refresh interval set at? I can control the switches fine, but the status is delayed. I think I have a solution for that. You might want to turn on debug and make sure you're not seeing any errors in the background.

boothmusic commented 1 year ago

I've got mine set to smart control because I want it to control automation of smart bulbs in the house. when I try and change the interval on the application its set to 1x a minute. I can't have it go any lower than that.

boothmusic commented 1 year ago

60000ms is the interval setting right now

jfarmer08 commented 1 year ago

Yes. The config is limited to 60 seconds, but you can override this in the config file. I dont recommend setting it too low and anything under 30 will get you locked out.

I changed mine over to Smart Control and have seen some issues also. I will keep working on it as time allows

boothmusic commented 1 year ago

sounds good, thank you!

tbsaunders1 commented 1 year ago

i loaded the beta.2 file just now, and my switches are working as expected in HomeKit! no impacts to two of my other wyze items (two plugs on lights that i can see right now) - i'll confirm the rest of my wyze accessories are functioning as expected in the next couple of days. thanks so much for pushing this out - SUPER helpful - this brand of device is relatively affordable and having the ability to control their in-wall switches in HomeKit is huge. i have several still in the box that i have been anticipating this plugin's switch update for some time now - glad it's up and running!!! great work!!!

if i can do anything to help you with data or setup config items i'll do what i can to help. i probably have a dozen or more wyze accessories in my setup at present.

jfarmer08 commented 1 year ago

After a week of testing how does it look? I have one more beta to put out in the next few days and I would like to fix any thing that I can with the switches. So for my testing it's working ok.

My setup I am running docker with the latest version of homebridge and beta 2 of wyze. I have 3 switch's setup as classic control. I did change them over to IOT control and didn't see any thing major. I am not currently running 2fa at this time. For my other accessories I have 3 locks, 15 lights, 2 outdoor plugs and 6 plugs. Everything seems to be working fine.

For the next release I have focused on the amount of calls to wyze. I really don't want to be in a situation where we have to shut this down. As your have notice the default time for refresh was moved to 60 seconds. I am starting to store the device last known state in the config file and when one device ask for a update I will be able to store the value for all devices. And so when another device wants a update I can reference the config and determine if I can use that value or request a new one. It will take some time to get this right, but the over performance will be better.

mammerman commented 1 year ago

I've been testing the beta 3 today with a light switch and it's working great. So far no issues. I have it in an automation in Home with a motion sensor and it works almost instantaneously.

Other accessories include 10 smart plugs and 2 outdoor smart plugs.

jfarmer08 commented 1 year ago

@mammerman Thank you for the update. There will be a new beta release soon to address a couple of things with the switch, but also adding more support for other items. A lot of the code has changed and so it will be hard.

jfarmer08 commented 1 year ago

@mammerman what type of sensors are you using?

Glennkh commented 1 year ago

I tested v0.5.2-5.beta.3 today. I have a wyze motion sensor v2 and a wyze switch (classic control) added to homebridge and I am able to control the switch without any issues from homekit. I tried setting up some automation with homekit.

When wyze motion sensor v2 detects motion -> turn wyze switch on

This was inconsistent for me sometimes it worked sometimes it didn't. When it did work it took about 20 - 30 seconds for the light switch to turn on after motion was detected.

jfarmer08 commented 1 year ago

This I can understand. The polling limit is 60 seconds.

anderfrank commented 1 year ago

Just wanted to say thank you to everyone who helped get this working. Just installed the latest beta and it works great for my two switches!

jfarmer08 commented 1 year ago

https://www.npmjs.com/package/homebridge-wyze-smart-home/v/0.5.25-dev.0

So things go mixed up, and so I am releasing a dev version for the wall switch. After its in dev awhile I will move it back to Beta and from there to production.

A lot of changes in this release so beware.

jfarmer08 commented 1 year ago

Please open a new ticket for any issues found.