Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

"Setters" not doing anything #11

Open
roshambo919 opened this issue Jan 24, 2021 · 3 comments
Open

"Setters" not doing anything #11

roshambo919 opened this issue Jan 24, 2021 · 3 comments

Comments

@roshambo919
Copy link

roshambo919 commented Jan 24, 2021

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
Copy link
Author

@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
Copy link

@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
Copy link
Contributor

mjg59 commented Apr 25, 2021

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants