google / python-laurel

Python control of C by GE Bluetooth lightbulbs
Apache License 2.0
58 stars 18 forks source link

"Setters" not doing anything #11

Open roshambo919 opened 3 years ago

roshambo919 commented 3 years ago

I'm trying to work with this repository. Using Ubuntu on my laptop. I have all the lights right around. I'm able to log in with my username and password and see my devices, then I'm even sometimes able to "connect" to the network calling devices.devices[0].network.connect() (it claims it works occasionally). But then when I go to interact with the devices, nothing ever happens. Sometimes it runs through the script, sometimes it just hangs at one of the "set" parts. Anyone have any suggestions?

The brightness and temperature components of "devices" are just the class defaults (i.e. 0). Nothing is being called to update those.

import laurel

with open('../login.txt') as f:
    login_data = f.read()
username = login_data.split(',')[0]
password = login_data.split(', ')[1]

print('Logging in...')
devices = laurel.laurel(username, password)
print('Successfully logged in!')
devices = devices.devices

idx = 5
print('Name: {}\nMAC: {}\nType: {}\nBrightness: {}\nTemperature: {}\n'.format(
    devices[idx].name,
    devices[idx].mac,
    devices[idx].type,
    devices[idx].brightness,
    devices[idx].temperature))

print('Connecting...')
devices[idx].network.connect(idx_start = idx)

print('Setting brightness')
devices[idx].set_brightness(10) # THIS DOES NOTHING OR HANGS SOMETIMES

print('Setting power')
devices[idx].set_power(False) # THIS DOES NOTHING OR HANGS SOMETIMES
roshambo919 commented 3 years ago

@williamkennyAK I tried your code (from a separate issue) as well, and it partially ran through but never did anything to the lights and then would eventually hang

williamkennyAK commented 3 years ago

@williamkennyAK I tried your code (from a separate issue) as well, and it partially ran through but never did anything to the lights and then would eventually hang

Unfortunately, I have no lights to test out. I only have the smart plug. I added a bunch of printf statements to find where exactly the code was hanging for me.

What version of python are you using?

mjg59 commented 3 years ago

Hi,

There's a bug in bluepy that means it'll tend to wedge when commands are sent. I have a workaround in a local branch until upstream merge it - can you please try upgrading to python-dimond 0.3 (you'll probably want to upgrade to python-laurel 0.5 as well) and see if that works any better?