Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mqtt connection empty queue error #25

Open
LauraFlem opened this issue Apr 18, 2019 · 4 comments
Open

mqtt connection empty queue error #25

LauraFlem opened this issue Apr 18, 2019 · 4 comments

Comments

@LauraFlem
Copy link

I'm getting an error when I try to collect data from the environmental sensors, using the following code in a loop:
devices = dyson_account.devices() connected = devices[0].connect("192.168.0.76") env_state=devices[0].environmental_state current_voc = env_state.volatile_organic_compounds devices[0].disconnect()

It works for 4 iterations of my loop and then crashes with the following error:

'File "dyson.py", line 39, in connected = devices[0].connect("192.168.0.76") File "/home/lfleming/anaconda3/lib/python3.6/site-packages/libpurecool/dyson_pure_cool_link.py", line 148, in connect return self._mqtt_connect() File "/home/lfleming/anaconda3/lib/python3.6/site-packages/libpurecool/dyson_pure_cool_link.py", line 159, in _mqtt_connect self._connected = self._connection_queue.get(timeout=10) File "/home/lfleming/anaconda3/lib/python3.6/queue.py", line 172, in get raise Empty queue.Empty'

If anyone has come across this issue or has any ideas how to fix it please let me know!

@exking
Copy link

exking commented Apr 19, 2019

Not sure why would you use loops? Just subscribe to the message. device.add_message_listener(on_message_listener_procedure)

@LauraFlem
Copy link
Author

LauraFlem commented Apr 20, 2019

HI there! Thanks for the reply! I'm not really familiar with how to implement message listeners, ive tried to below but I amn't get any values returned:

def update_state(message): env_state=fan.environmental_state current_pm25 = env_state.particulate_matter_25 print(current_pm25)

devices = dyson_account.devices() \n fan = devices[0] \n connected = fan.connect("192.168.0.76") \n fan.add_message_listener(update_state)

Im trying to access the sensor data to feed its values into controller I have designed for a project, so any advice on how to collect this data would be greatly appreciated.

@exking
Copy link

exking commented Apr 20, 2019

Take a look at my project https://github.com/exking/udi-dyson-poly/blob/master/dyson-poly.py DysonPureFan is an example

@LauraFlem
Copy link
Author

Hi there! Thank you so much for showing me your project! Would you by any chance have an example of how to use that class to send the commands or call for information? Sorry just trying to figure out how each step works.

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

No branches or pull requests

2 participants