Hello to All Blynkers,
first I have to thank you for this super-easy library for iot projects. It’s real great job.
I started a month ago learning the blynk library using nodejs and python as well. As my project grows up and I use more widgets for many sensors I came into the following issue when I deal with blynk for python library which I found https://github.com/vshymanskyy/blynk-library-python.
What I want to do is to use user tasks in the same python script for updating more than one widgets with different reading rate eachone using push. I followed the easy example provided here https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/07_user_task.py expanding it with a second set.user_task() function. The problem I face is that only one of the two user_task calls works at a time and this is the last one call.
My code looks like this
import BlynkLib import time BLYNK_AUTH = 'YourAuthToken' blynk = BlynkLib.Blynk(BLYNK_AUTH) def my_user_task(): print('Action') blynk.virtual_write(2, time.ticks_ms() // 1000) def my_user_task2(): print('Action 2') blynk.virtual_write(3, time.ticks_ms() // 1000) blynk.set_user_task(my_user_task, 3000) blynk.set_user_task(my_user_task2, 5000) blynk.run()
I’m not sure if this is the right way to do that and also I don’t want to use @blynk.VIRTUAL_READ for each widget with different reading rate as this way doesn’t update the superchart when you close the aplication.
What should I do to push updates to the widgets with different frequency on the same script?
Thank you in advance,