OpenWonderLabs / python-host

The python code running on Raspberry Pi or other Linux based boards to control SwitchBot.
Apache License 2.0
376 stars 84 forks source link

Library fails to connect on first command #12

Open nemccarthy opened 4 years ago

nemccarthy commented 4 years ago

Hi

I’m using a raspberry pi 4 and a 3b and both have problems connecting to the switchbots on the first connection attempt. Generally after the first try the second command works fine.

Is this a known issue. I don’t believe there are range issues and the switchbot is about 2m away with direct line of sight.

Thanks

GadgetAngel commented 4 years ago

I own a GE window air/heat conditioner and my model number is GE AHE08AXL1. I have found that with this unit , (and maybe your unit has the same issue), if you watch how the unit behaves the LCD display will either timeout (go off) after 1 minute or 2 minutes depending on your model number. When the LCD display goes off the unit is no longer awake to receive commands from Bluetooth or IR remote!!

But if your LCD display is still “on” then the unit will receive Bluetooth and IR commands. Therefore to “wake up” the LCD display the first command received will always turn on the display if the display is off. To get around this problem, I ALWAYS SEND an “AUTao” button command first. I have found that the AUTO button will act as a “do nothing” command if the unit is already on “Mode Air or Mode Heat”. This way , if I just got done manually adjusting the temperature (the LCD display is in the ON state) and my automation routine gets triggered it will work. If I have not touched the unit for over two minutes (on my model) the LCD Display turns off automatically. So if two minutes has passed and my models’s LCD display turns off, and my automation routine gets triggered the extra AUTO button ends up waking up the LCD display and then my automation routine still works correctly.

nemccarthy commented 4 years ago

Thanks. This is an error with the switchbot itself not the device it’s controlling