DS18B20 --- Reading while getting other chores done

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
doceave
Posts: 22
Joined: Fri Feb 14, 2020 4:02 pm

Re: DS18B20 --- Reading while getting other chores done

Post by doceave » Wed Feb 19, 2020 7:28 pm

I really do hope this will help with troubleshooting.... :| :
>>> import uasyncio as asyncio
>>> dir(asyncio)
['__class__', '__name__', '__path__']
>>>

kevinkk525
Posts: 648
Joined: Sat Feb 03, 2018 7:02 pm

Re: DS18B20 --- Reading while getting other chores done

Post by kevinkk525 » Wed Feb 19, 2020 7:29 pm

this means you have not installed uasyncio correctly.. your uasyncio directory has an empty __init__.py would be my guess.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

doceave
Posts: 22
Joined: Fri Feb 14, 2020 4:02 pm

Re: DS18B20 --- Reading while getting other chores done

Post by doceave » Wed Feb 19, 2020 8:18 pm

I will again attempt installation. Sadly ampy does not allow movement of entire folders so I will have to re-create the folder structure (which looks rather odd) on the ESP32.

This is the structure I was using. Would you mind casting an eye over this before I repeat the process?:

/uasyncio/uasyncio/uasyncio/__init__.py
/uasyncio/uasyncio.core/uasyncio/core.py
/uasyncio/uasyncio.synchro/uasyncio/synchro.py
/uasyncio/uasyncio.queues/uasyncio/queues.py

When I import the script you shared, which I names uasync.py, I get the following error:
>>> import uasync.py
I (262840) modsocket: Initializing
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "uasync.py", line 1, in <module>
File "uasyncio/__init__.py", line 4, in <module>
ImportError: no module named 'uasyncio.core'
>>>
This speaks to me of __init__.py that cannot find uasyncio.core for some reason despite it being in the correct folder as described above.

I have tried every permutation of file/folder locations with no joy....
Last edited by doceave on Wed Feb 19, 2020 9:06 pm, edited 1 time in total.

kevinkk525
Posts: 648
Joined: Sat Feb 03, 2018 7:02 pm

Re: DS18B20 --- Reading while getting other chores done

Post by kevinkk525 » Wed Feb 19, 2020 9:03 pm

all files belong into /uasyncio/

/uasyncio/__init__.py
/uasyncio/core.py
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

User avatar
pythoncoder
Posts: 4030
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: DS18B20 --- Reading while getting other chores done

Post by pythoncoder » Thu Feb 20, 2020 8:00 am

@doceave Given that you're using an ESP32, if you connect it to the internet the easy way to install libraries is with upip as described in my tutorial. It will create the correct directory structure (as described by Kevin).
Peter Hinch

doceave
Posts: 22
Joined: Fri Feb 14, 2020 4:02 pm

Re: DS18B20 --- Reading while getting other chores done

Post by doceave » Thu Feb 20, 2020 2:11 pm

It is absolutely super that you guys look after the community at this level. I am amazed and feel so honored.

Will test folder structure as described by Kev asap and revert with results.

doceave
Posts: 22
Joined: Fri Feb 14, 2020 4:02 pm

Re: DS18B20 --- Reading while getting other chores done

Post by doceave » Thu Feb 20, 2020 4:02 pm

Totally amazing! :) It works! So excited to put it through its paces now!

Thanks so so much to everyone!

User avatar
jimmo
Posts: 1440
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: DS18B20 --- Reading while getting other chores done

Post by jimmo » Fri Feb 21, 2020 3:02 am

Great!!! Sorry I gave you slightly vague and not immediately actionable advice. I can't wait until the "new" asyncio is merged and we can just say "do it this one way" (that happens to look exactly like the regular Python 3.8 way).

But yes, very excited about asyncio and the power it has to really make it easy to write reliable and robust embedded code. Once you get over the initial hurdle, I'm constantly amazed about how much it simplifies things.

Post Reply