tzachi-dar / LibreAllHouse

Use Raspberry pi devices to have all house coverage using the miaomiao device.
16 stars 12 forks source link

Problem with MiaoMiao 2 ? #11

Open bordeb opened 3 years ago

bordeb commented 3 years ago

Dear @tzachi-dar , yesterday I have made a switch from MiaoMiao 1 to MiaoMiao 2 and it seams that LibreAllHouse is not collecting data any more. Is it a compatibility issue with MiaoMiao 2 or am I missing something? We are using libreallhouse for at least 3 years and I am afraid that this is a compatibility issue which I was not aware till now. Is there anything I could do to resolve this? THANK YOU very much in advance!

bordeb commented 3 years ago

Now I have noticed the new info in the documentation https://docs.google.com/document/d/1955quKMUfaVHyQZLw3k8IEkPFv3od00bA0AoJKY96xE/edit?usp=sharing Sorry for not seeing it earlier. Can I now just proceed to build bluepy from sources as it is suggested in documentation or do I need to start from the begining, because the Pi that is serving for libreallhouse is all prepared in accordance with the guidance for miaomiao 1 ?

tzachi-dar commented 3 years ago

You can install it on the sam rpi. I have noticed that on new pi's installation, there is a need to also copy the files manually, but I don't think it will be a problem with old rpis.

bordeb commented 3 years ago

Dear @tzachi-dar thank you very much on your valuable time spent to provide support!! When going through the documentation and trying to execute sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/ it returns error that cp target is not a directory. Probably there is some issue with python 3 version? I started from scratch with blank installation of 2018-03-13-raspbian-stretch as it is suggested in the latest version of guidance. Can you please provide some guidance!

tzachi-dar commented 3 years ago

What happens if you don't do this step? Doesn't the program work without it?

On Sun, 23 May 2021 at 19:54, bordeb @.***> wrote:

Dear @tzachi-dar https://github.com/tzachi-dar thank you very much on your valuable time spent to provide support!! When going through the documentation and trying to execute sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/ it returns error that cp target is not a directory. Probably there is some issue with python 3 version? I started from scratch with blank installation of 2018-03-13-raspbian-stretch as it is suggested in the latest version of guidance. Can you please provide some guidance!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846593141, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZD5MNHFAGYMTEWMRA3TPEXOBANCNFSM45LNX2RQ .

bordeb commented 3 years ago

I will report it here. Now I have started the apt-get upgrade but it takes long time as it is RPI-zero. Thanks for such a quick response

bordeb commented 3 years ago

Hi @tzachi-dar Here is my report. Unfortunately it does not work for me. Here is the exact steps

clean install of the 2018-03-13-raspbian-stretch and then following commands:

`sudo apt-get update

sudo apt-get install git

sudo apt-get install screen

sudo apt-get install python3-pip build-essential libglib2.0-dev

sudo pip3 install bluepy

sudo pip3 install pymongo

sudo pip3 install dnspython

git clone https://github.com/IanHarvey/bluepy.git

cd bluepy

python3 setup.py build

sudo python3 setup.py install

git clone https://github.com/tzachi-dar/LibreAllHouse.git

cd LibreAllHouse

sudo nano config.cfg MAC address of the MM2 inserted manually

sudo nano /etc/rc.local /usr/bin/screen -L /home/pi/LibreAllHouse/screen.log -dmS tomato python3 /home/pi/LibreAllHouse/main.py

tail -F ~/LibreAllHouse/screen.log ` The screen log says: 2021-05-23 19:10:42.991: event wait ended, ret = False INFO 2021-05-23 19:11:25,149 restarting since time from last packet is 298 already acumulated 60 10 2021-05-23 19:11:42.998: event wait ended, ret = False INFO 2021-05-23 19:16:33,268 cought btle.BTLEException Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: random Connecting... 2021-05-23 19:17:52.970: event wait ended, ret = False Services... Service Service Service Service charterstics... Characteristic <6e400002-b5a3-f393-e0a9-e50e24dcca9e> Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> nrfGattCharacteristic = [<bluepy.btle.Characteristic object at 0xb5c10330>] NOTIFY Init called. b'\xf0' INFO 2021-05-23 19:18:09,945 restarting since time from last packet is 136 already acumulated 0 021-05-23 19:18:52.979: event wait ended, ret = False 2021-05-23 19:19:52.986: event wait ended, ret = False 2021-05-23 19:20:52.994: event wait ended, ret = False 2021-05-23 19:21:53.003: event wait ended, ret = False

EDIT: Something must be happening regarding Bluetooth connection as it seams that RPI is somehow connecting to MM2 because it is not visible for other devices until the RPI is shut down. Then it becomes visible. Nevertheless, the glucose data is not transmitted.

tzachi-dar commented 3 years ago

So, now please continue with:

$ sudo apt-get install git build-essential libglib2.0-dev

$ git clone https://github.com/IanHarvey/bluepy.git

$ cd bluepy

$ python3 setup.py build

$ sudo python3 setup.py install

Tru running the code again, and see if it will start to run.

If it does not work. Please do:

sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/

sudo cp ./build/lib.linux-armv7l-2.7/bluepy/bluepy-helper /usr/local/lib/python3.7/dist-packages/bluepy/bluepy-helper If this directories do not exist, please look at what version of python you are using, and what version of lib.linux you are using.

Thanks Tzachi

On Sun, 23 May 2021 at 22:12, bordeb @.***> wrote:

Hi @tzachi-dar https://github.com/tzachi-dar Here is my report. Unfortunately it does not work for me. Here is the exact steps

clean install of the 2018-03-13-raspbian-stretch and then following commands:

`sudo apt-get update

sudo apt-get install git

sudo apt-get install screen

sudo apt-get install python3-pip build-essential libglib2.0-dev

sudo pip3 install bluepy

sudo pip3 install pymongo

sudo pip3 install dnspython

git clone https://github.com/IanHarvey/bluepy.git

cd bluepy

python3 setup.py build

sudo python3 setup.py install

git clone https://github.com/tzachi-dar/LibreAllHouse.git

cd LibreAllHouse

sudo nano config.cfg MAC address of the MM2 inserted manually

sudo nano /etc/rc.local /usr/bin/screen -L -Logfile /home/pi/LibreAllHouse/screen.log -dmS tomato python3 /home/pi/LibreAllHouse/main.py

tail -F ~/LibreAllHouse/screen.log ` The screen log says: 2021-05-23 19:10:42.991: event wait ended, ret = False INFO 2021-05-23 19:11:25,149 restarting since time from last packet is 298 already acumulated 60 10 2021-05-23 19:11:42.998: event wait ended, ret = False

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846610662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZHKXLX243DJWHTLZMDTPFHSPANCNFSM45LNX2RQ .

tzachi-dar commented 3 years ago

Please send the logs, like you have done before if this doesn't work.

On Sun, 23 May 2021 at 23:27, Tzachi Dar @.***> wrote:

So, now please continue with:

$ sudo apt-get install git build-essential libglib2.0-dev

$ git clone https://github.com/IanHarvey/bluepy.git

$ cd bluepy

$ python3 setup.py build

$ sudo python3 setup.py install

Tru running the code again, and see if it will start to run.

If it does not work. Please do:

sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/

sudo cp ./build/lib.linux-armv7l-2.7/bluepy/bluepy-helper /usr/local/lib/python3.7/dist-packages/bluepy/bluepy-helper If this directories do not exist, please look at what version of python you are using, and what version of lib.linux you are using.

Thanks Tzachi

On Sun, 23 May 2021 at 22:12, bordeb @.***> wrote:

Hi @tzachi-dar https://github.com/tzachi-dar Here is my report. Unfortunately it does not work for me. Here is the exact steps

clean install of the 2018-03-13-raspbian-stretch and then following commands:

`sudo apt-get update

sudo apt-get install git

sudo apt-get install screen

sudo apt-get install python3-pip build-essential libglib2.0-dev

sudo pip3 install bluepy

sudo pip3 install pymongo

sudo pip3 install dnspython

git clone https://github.com/IanHarvey/bluepy.git

cd bluepy

python3 setup.py build

sudo python3 setup.py install

git clone https://github.com/tzachi-dar/LibreAllHouse.git

cd LibreAllHouse

sudo nano config.cfg MAC address of the MM2 inserted manually

sudo nano /etc/rc.local /usr/bin/screen -L -Logfile /home/pi/LibreAllHouse/screen.log -dmS tomato python3 /home/pi/LibreAllHouse/main.py

tail -F ~/LibreAllHouse/screen.log ` The screen log says: 2021-05-23 19:10:42.991: event wait ended, ret = False INFO 2021-05-23 19:11:25,149 restarting since time from last packet is 298 already acumulated 60 10 2021-05-23 19:11:42.998: event wait ended, ret = False

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846610662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZHKXLX243DJWHTLZMDTPFHSPANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Hi @tzachi-dar , tnx very much

After runing the code again nothing improved so I continued with two making copies of the two files:

My python is 3.5 so I was able to copy with the first command sligthly changed to: sudo cp bluepy/*.py /usr/local/lib/python3.5/dist-packages/bluepy/

But with the seconda command I have no luck and can not detect exact numbers version to change. I have detected that my rpi os is armv6l instead of armv7l , but other two numbers can not detect. I have tried with 2.6 and 2.7 and also without them but no luck here:?

sudo cp ./build/lib.linux-armv6l-?.?/bluepy/bluepy-helper /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper

tzachi-dar commented 3 years ago

I must say that I did not test it with rpi zero only with rpi 3 and rpi 4.

you can use the following command to find where you have built bluepy-helper

find /home/pi/bluepy -name bluepy-helper

Than you can find the dest of it running

find /usr/local/lib -name bluepy-helper

Each command might return more than one of these. From the source, please look at the dates of the files and copy the most recent one.

On the dest, copy to all of them.

In order to get some more debug information: In the file main.py there is a line

btle.Debugging = True

please remove the # from it (remove the comment). After that it will create some more logging including when bluepy-helper was built.

Thanks Tzachi

On Mon, 24 May 2021 at 00:29, bordeb @.***> wrote:

Hi @tzachi-dar https://github.com/tzachi-dar , tnx very much

After runing the code again nothing improved so I continued with two making copies of the two files:

My python is 3.5 so I was able to copy with the first command sligthly changed to: sudo cp bluepy/*.py /usr/local/lib/python3.5/dist-packages/bluepy/

But with the seconda command I have no luck and can not detect exact numbers version to change. I have detected that my rpi os is armv6l instead of armv7l , but other two numbers can not detect. I have tried with 2.6 and 2.7 and also without them but no luck here:?

sudo cp ./build/lib.linux-armv6l-?.?/bluepy/bluepy-helper /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846627037, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZA2IXVK26I3JRCPU4DTPFXRXANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Thank you very much on your support! Seams that I have broken something with this coping. Now the logs says

File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe

I am not sure what is happening. MM1 works for years with RPI Zero W. Maybe I should try again from clean install od the raspbian and then update to the latest "stretch" version. This will update the python to 3.5.3 so it might work better. I think python 3.5.3 is latest for now on raspbian stretch. Should I try to manually install python 3.7?

tzachi-dar commented 3 years ago

I think that right now the simplest thing to try is either instal a new version of rpi OS or use a bigger pi. I have recently installed lately "Raspbian GNU/Linux 10 (buster)" on pi 4 and this works well.

Thanks Tzachi

On Mon, 24 May 2021 at 01:33, bordeb @.***> wrote:

Thank you very much on your support! Seams that I have broken something with this coping. Now the logs says

File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe

I am not sure what is happening. MM1 works for years with RPI Zero W. Maybe I should try again from clean install od the raspbian and then update to the latest "stretch" version. This will update the python to 3.5.3 so it might work better. I think python 3.5.3 is latest for now on raspbian stretch. Should I try to manually install python 3.7?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846634395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZHTDCSVABCO2O7EPBLTPF7EPANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Thanks so so much!! I have now prepared clean install fully updated (apt-get update) of the "stretch" raspbian OS version and will now proceed with the tutorial once more and report here the result.

If it goes wrong again, I will try "buster" then. On buster, is it also necessary to?:

$ sudo apt-get install git build-essential libglib2.0-dev $ git clone https://github.com/IanHarvey/bluepy.git $ cd bluepy $ python3 setup.py build $ sudo python3 setup.py install

?

tzachi-dar commented 3 years ago

Yes, this part is a must. The only question is whether doing the manual copy later is a must as well.

On Mon, 24 May 2021 at 11:50, bordeb @.***> wrote:

Thanks so so much!! I have now prepared clean install fully updated (apt-get update) of the "stretch" raspbian OS version and will now proceed with the tutorial once more and report here the result.

If it goes wrong again, I will try "buster" then. On buster, is it also necessary to?:

$ sudo apt-get install git build-essential libglib2.0-dev $ git clone https://github.com/IanHarvey/bluepy.git $ cd bluepy $ python3 setup.py build $ sudo python3 setup.py install

?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846889965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZAFUMXJJQ6E7DZUMH3TPIHO5ANCNFSM45LNX2RQ .

bordeb commented 3 years ago

I have performed clean install of the stretch, full update, full install LibreAllHouse according to the guidance but it does not work. Only thing I did not perform yest is the manual copy that last time broke my installation. Please advise me not to kill this installation:

Linux rpi 4.19.66+ #1253 Thu Aug 15 11:37:30 BST 2019 armv6l

find /home/pi/bluepy -name bluepy-helper returns: **/home/pi/bluepy/build/lib/bluepy/bluepy-helper** **/home/pi/bluepy/bluepy/bluepy-helper**

find /usr/local/lib -name bluepy-helper returns: **/usr/local/lib/python3.5/dist-packages/bluepy-1.3.0-py3.5.egg/bluepy/bluepy-helper** **/usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper**

python3 --version Python 3.5.3

How to properly try to copy the files?

tzachi-dar commented 3 years ago

What are the dates of these files ? /home/pi/bluepy/build/lib/bluepy/bluepy-helper /home/pi/bluepy/bluepy/bluepy-helper

please run ls -l on each of them

On Mon, 24 May 2021 at 14:11, bordeb @.***> wrote:

I have performed clean install of the stretch, full update, full install LibreAllHouse according to the guidance but it does not work. Only thing I did not perform yest is the manual copy that last time broke my installation. Please advise me not to kill this installation:

Linux rpi 4.19.66+ #1253 Thu Aug 15 11:37:30 BST 2019 armv6l

find /home/pi/bluepy -name bluepy-helper returns: /home/pi/bluepy/build/lib/bluepy/bluepy-helper /home/pi/bluepy/bluepy/bluepy-helper

find /usr/local/lib -name bluepy-helper returns:

/usr/local/lib/python3.5/dist-packages/bluepy-1.3.0-py3.5.egg/bluepy/bluepy-helper /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper

python3 --version Python 3.5.3

How to properly try to copy the files?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846970636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZER7ARYNQ5DOYUSTSDTPIX7PANCNFSM45LNX2RQ .

bordeb commented 3 years ago

here they are: $ ls -l /home/pi/bluepy/build/lib/bluepy/bluepy-helper -rwxr-xr-x 1 root root 702776 May 24 11:37 /home/pi/bluepy/build/lib/bluepy/bluepy-helper $ ls -l /home/pi/bluepy/bluepy/bluepy-helper -rwxr-xr-x 1 root root 702776 May 24 11:37 /home/pi/bluepy/bluepy/bluepy-helper

tzachi-dar commented 3 years ago

Please copy from: /home/pi/bluepy/build/lib/bluepy/bluepy-helper

to /usr/local/lib/python3.5/dist-packages/bluepy-1.3.0-py3.5.egg/bluepy/bluepy-helper /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper

And also:

sudo cp bluepy/*.py /usr/local/lib/python3.5/dist-packages/bluepy/

Thanks

Tzachi

On Mon, 24 May 2021 at 14:27, bordeb @.***> wrote:

here they are: $ ls -l /home/pi/bluepy/build/lib/bluepy/bluepy-helper -rwxr-xr-x 1 root root 702776 May 24 11:37 /home/pi/bluepy/build/lib/bluepy/bluepy-helper $ ls -l /home/pi/bluepy/bluepy/bluepy-helper -rwxr-xr-x 1 root root 702776 May 24 11:37 /home/pi/bluepy/bluepy/bluepy-helper

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846978949, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZAQWPLC3IYQ2QLXY53TPIZZHANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Thank you very much! I did it, but unfortunately, it seams that again it broke. Here is the log: Waiting for connections INFO 2021-05-24 13:58:05,184 cought btle.BTLEException Failed to connect to peripheral d8:c1:7a:f5:a1:d0, addr type: random 2021-05-24 13:58:24.395: event wait ended, ret = False Connecting... 2021-05-24 13:59:24.405: event wait ended, ret = False Services... INFO 2021-05-24 13:59:31,647 cought btle.BTLEException Helper exited Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb6a7de10>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe

tzachi-dar commented 3 years ago

Did the copy of the python files succeed?

Please run again with: In order to get some more debug information: In the file main.py there is a line

btle.Debugging = True

please remove the # from it (remove the comment). After that it will create some more logging including when bluepy-helper was built.

And send the logs.

On Mon, 24 May 2021 at 15:01, bordeb @.***> wrote:

Thank you very much! I did it, but unfortunately, it seams that again it broke. Here is the log: Waiting for connections INFO 2021-05-24 13:58:05,184 cought btle.BTLEException Failed to connect to peripheral d8:c1:7a:f5:a1:d0, addr type: random 2021-05-24 13:58:24.395: event wait ended, ret = False Connecting... 2021-05-24 13:59:24.405: event wait ended, ret = False Services... INFO 2021-05-24 13:59:31,647 cought btle.BTLEException Helper exited Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb6a7de10>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-846995100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZCVDYVWLFP6IOB2YV3TPI5YJANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Yes, the copy was sucesfull. No errors.

After enabling Debugging the log is:

Connecting... 2021-05-24 14:06:24.469: event wait ended, ret = False INFO 2021-05-24 14:06:34,623 cought btle.BTLEException Failed to connect to peripheral d8:c1:7a:f5:a1:d0, addr type: random ['BTDevice', 'MongoData', 'TcpSockets'] /home/pi/LibreAllHouse/LibreReadings.db 2021-05-24 14:08:21.298: Mongo caught exception in first write A '/' is required between the host list and any options.InvalidURI 2021-05-24 14:08:21.336: Starting mongo thread Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Socket created

Waiting for connections Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: '' Got: '' Got: '' Got: '' INFO 2021-05-24 14:08:22,300 cought btle.BTLEException Helper exited Sent: disc

Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb5bbedb0>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe 2021-05-24 14:09:21.345: event wait ended, ret = False Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: '' Got: '' Got: '' INFO 2021-05-24 14:09:23,681 cought btle.BTLEException Helper exited Sent: disc

Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb69b0e10>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe 2021-05-24 14:10:21.356: event wait ended, ret = False Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: '' Got: '' INFO 2021-05-24 14:10:24,754 cought btle.BTLEException Helper exited Sent: disc

Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb691ce10>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe 2021-05-24 14:12:21.375: event wait ended, ret = False Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$disc\x1emtu=h0\x1esec='low\n" Stopping /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper INFO 2021-05-24 14:13:06,002 cought btle.BTLEException Failed to connect to peripheral d8:c1:7a:f5:a1:d0, addr type: random 2021-05-24 14:13:21.384: event wait ended, ret = False Connecting...

tzachi-dar commented 3 years ago

I'm not sure what else can be done from remote here. You can try to upgrade your python to something newer.

I'll try to install a rpi zero, and see if it works, but this will probably take a week or two.

Thanks Tzachi

On Mon, 24 May 2021 at 15:12, bordeb @.***> wrote:

Yes, the copy was sucesfull. No errors.

After enabling Debugging the log is:

Connecting... 2021-05-24 14:06:24.469: event wait ended, ret = False INFO 2021-05-24 14:06:34,623 cought btle.BTLEException Failed to connect to peripheral d8:c1:7a:f5:a1:d0, addr type: random ['BTDevice', 'MongoData', 'TcpSockets'] /home/pi/LibreAllHouse/LibreReadings.db 2021-05-24 14:08:21.298: Mongo caught exception in first write A '/' is required between the host list and any options.InvalidURI 2021-05-24 14:08:21.336: Starting mongo thread Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Socket created

Waiting for connections Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: '' Got: '' Got: '' Got: '' INFO 2021-05-24 14:08:22,300 cought btle.BTLEException Helper exited Sent: disc

Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb5bbedb0>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe 2021-05-24 14:09:21.345: event wait ended, ret = False Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: '' Got: '' Got: '' INFO 2021-05-24 14:09:23,681 cought btle.BTLEException Helper exited Sent: disc

Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb69b0e10>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe 2021-05-24 14:10:21.356: event wait ended, ret = False Connecting... Running /usr/local/lib/python3.5/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 11:35:31 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: '' Got: '' INFO 2021-05-24 14:10:24,754 cought btle.BTLEException Helper exited Sent: disc

Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0xb691ce10>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in del self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-847001140, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZC2FQIE7QMKSPHKCETTPI7DXANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Thank you very very much! Your expertise will be so valuable to evaluate rpi zero w. Please let me know if I can buy a test RPI zero W for you or any other contribution!

Just to provide additional info: I tried with clean install of the buster instead of scratch but with no sucess at the end. Only thing that is better is that the copy/paste thing did not broke the installation.

The debug logfile now says: bad start byte 201 bad end byte 0 bad length of buffer 968 2021-05-24 19:05:29.169: event wait ended, ret = True INFO 2021-05-24 19:05:29,168 tryAgainAlowed numberOfCrcErrors = 1 NumberOfDiscnections = 0 INFO 2021-05-24 19:05:29,179 We are still allowed to retry INFO 2021-05-24 19:05:34,186 Sending a request for more data after send failure INFO 2021-05-24 19:05:34,190 restarting since time from last packet is 5 already acumulated 363 INFO 2021-05-24 19:05:34,706 cought btle.BTLEException Device disconnected ['BTDevice', 'MongoData', 'TcpSockets'] /home/pi/LibreAllHouse/LibreReadings.db 2021-05-24 19:06:48.462: Mongo caught exception in first write A '/' is required between the host list and any options.InvalidURI 2021-05-24 19:06:48.499: Starting mongo thread Socket created

Waiting for connections Connecting... Running /usr/local/lib/python3.7/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 18:29:15 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: "rsp=$find\x1ehstart=h1\x1ehend=h9\x1euuid='00001800-0000-1000-8000-00805f9b34fb\x1ehstart=hA\x1ehend=hD\x1euuid='00001801-0000-1000-8000-00805f9b34fb\x1ehstart=hE\x1ehend=h13\x1euuid='6e400001-b5a3-f393-e0a9-e50e24dcca9e\x1ehstart=h14\x1ehend=hFFFF\x1euuid='8ec9fe59-f315-4f60-9fb8-838830daea50\n" Service Service Service Service charterstics... Sent: char E 13

Got: "rsp=$find\x1ehnd=hF\x1eprops=hC\x1evhnd=h10\x1euuid='6e400002-b5a3-f393-e0a9-e50e24dcca9e\x1ehnd=h11\x1eprops=h10\x1evhnd=h12\x1euuid='6e400003-b5a3-f393-e0a9-e50e24dcca9e\n" Characteristic <6e400002-b5a3-f393-e0a9-e50e24dcca9e> Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> nrfGattCharacteristic = [<bluepy.btle.Characteristic object at 0xb4d87230>] NOTIFY Sent: desc 13 FFFF

Got: "rsp=$desc\x1ehnd=h13\x1euuid='00002902-0000-1000-8000-00805f9b34fb\x1ehnd=h14\x1euuid='00002800-0000-1000-8000-00805f9b34fb\x1ehnd=h15\x1euuid='00002803-0000-1000-8000-00805f9b34fb\x1ehnd=h16\x1euuid='8ec90003-f315-4f60-9fb8-838830daea50\x1ehnd=h17\x1euuid='00002902-0000-1000-8000-00805f9b34fb\n" Sent: wr 13 0100

Got: 'rsp=$wr\n' Init called. b'\xf0' Sent: wr 10 f0

Got: 'rsp=$wr\n' Got: 'rsp=$ntfy\x1ehnd=h12\x1ed=b28016B0ECE98FE980700A007E0530004100152E1D01803000000000000000000000000000000000000003BD50E1CBC03C8D8D700B203C8D09700AB03C8B09700A803C8A8D7009F03C8A817809603C8B017808D03C8B417808D03C8AC17808D03C89C57808503C8A057008303C8A057007F03C88817808003887217807B03C8641780\n' INFO 2021-05-24 19:06:51,902 restarting since time from last packet is 3 already acumulated 0 Select timeout Select timeout Select timeout Select timeout

Select timeout Select timeout ...... Select timeout Select timeout Select timeout Got: 'rsp=$ntfy\x1ehnd=h12\x1ed=bC903C8DC9700BF03C8D89700A302C8545A808602C88419804D02C84019805A02C82819802A03C8C0D8005103C8FC5800F902C84419806702C85059004F02C8141901D402C8505800A202C8085800A102C87018019902C85C1801AA02C8B49800E902C89817802603C88C17804103C86C58014F03C8A018016303C8B0D8009303C868\n' INFO 2021-05-24 19:11:51,270 restarting since time from last packet is 299 already acumulated 130 Got: 'rsp=$ntfy\x1ehnd=h12\x1ed=b1801D903C8EC57002C04C89018017504C83098007A04C88818013B04C87818011504C83CD800E703C8581801A503C8A8D7007803C8641A802503C8885A80DA02C8A01A80A902C8B85A80CE0E000048090001C40AB051140796805A00EDA6107B1AC804BD286A29\n' Got: 'rsp=$ntfy\x1ehnd=h12\x1ed=b28016B0ED398FE980700A007E0530004100152E1D018030000000000000000000000000000000000000007AB031C6B03C86857806103C87057805403C8781780A803C8A8D7009F03C8A817809603C8B017808D03C8B417808D03C8AC17808D03C89C57808503C8A057008303C8A057007F03C88817808003887217807B03C8641780\n' we have enough data len = 363 checksum_ok1 = False checksum_ok2 = False checksum_ok3 = False INFO 2021-05-24 19:11:51,286 checksum_ok = False start byte = 201 end byte = 128 len = 968 battery = 2 <class 'str'> fw version = c854 hw version = 5a80 sensor serial number 0KZDDH0XZ00 bad start byte 201 bad end byte 128 bad length of buffer 968

tzachi-dar commented 3 years ago

I must say that it seems to me that this one is working (at least the ble part). See the message: INFO 2021-05-24 19:05:34,190 restarting since time from last packet is 5 already accumulated 363

363 bytes is what we should get.

Please keep running and see if it keeps getting 363 bytes.

Thanks Tzachi

On Mon, 24 May 2021 at 20:12, bordeb @.***> wrote:

Thank you very very much! Your expertise will be so valuable to evaluate rpi zero w. Please let me know if I can buy a test RPI zero W for you or any other contribution! Just to provide additional info: I tried with clean install of the buster instead of scratch but with no sucess at the end. Only thing that is better is that the copy/paste thing did not broke the installation. The debug logfile now says: bad start byte 201 bad end byte 0 bad length of buffer 968 2021-05-24 19:05:29.169: event wait ended, ret = True INFO 2021-05-24 19:05:29,168 tryAgainAlowed numberOfCrcErrors = 1 NumberOfDiscnections = 0 INFO 2021-05-24 19:05:29,179 We are still allowed to retry INFO 2021-05-24 19:05:34,186 Sending a request for more data after send failure INFO 2021-05-24 19:05:34,190 restarting since time from last packet is 5 already acumulated 363 INFO 2021-05-24 19:05:34,706 cought btle.BTLEException Device disconnected ['BTDevice', 'MongoData', 'TcpSockets'] /home/pi/LibreAllHouse/LibreReadings.db 2021-05-24 19:06:48.462: Mongo caught exception in first write A '/' is required between the host list and any options.InvalidURI 2021-05-24 19:06:48.499: Starting mongo thread Socket created

Waiting for connections Connecting... Running /usr/local/lib/python3.7/dist-packages/bluepy/bluepy-helper Sent: conn d8:c1:7a:f5:a1:d0 random

Got: '# bluepy-helper.c version 1.3.0 built at 18:29:15 on May 24 2021\n' Got: "rsp=$stat\x1estate=$tryconn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=h0\x1esec='low\n" Services... Sent: svcs

Got: "rsp=$stat\x1estate=$conn\x1edst='d8:c1:7a:f5:a1:d0\x1emtu=hF7\x1esec='low\n" Got: "rsp=$find\x1ehstart=h1\x1ehend=h9\x1euuid='00001800-0000-1000-8000-00805f9b34fb\x1ehstart=hA\x1ehend=hD\x1euuid='00001801-0000-1000-8000-00805f9b34fb\x1ehstart=hE\x1ehend=h13\x1euuid='6e400001-b5a3-f393-e0a9-e50e24dcca9e\x1ehstart=h14\x1ehend=hFFFF\x1euuid='8ec9fe59-f315-4f60-9fb8-838830daea50\n" Service Service Service <uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e handleStart=14 handleEnd=19> Service <uuid=8ec9fe59-f315-4f60-9fb8-838830daea50 handleStart=20 handleEnd=65535> charterstics... Sent: char E 13

Got: "rsp=$find\x1ehnd=hF\x1eprops=hC\x1evhnd=h10\x1euuid='6e400002-b5a3-f393-e0a9-e50e24dcca9e\x1ehnd=h11\x1eprops=h10\x1evhnd=h12\x1euuid='6e400003-b5a3-f393-e0a9-e50e24dcca9e\n" Characteristic <6e400002-b5a3-f393-e0a9-e50e24dcca9e> Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> nrfGattCharacteristic = [<bluepy.btle.Characteristic object at 0xb4d87230>] NOTIFY Sent: desc 13 FFFF

Got: "rsp=$desc\x1ehnd=h13\x1euuid='00002902-0000-1000-8000-00805f9b34fb\x1ehnd=h14\x1euuid='00002800-0000-1000-8000-00805f9b34fb\x1ehnd=h15\x1euuid='00002803-0000-1000-8000-00805f9b34fb\x1ehnd=h16\x1euuid='8ec90003-f315-4f60-9fb8-838830daea50\x1ehnd=h17\x1euuid='00002902-0000-1000-8000-00805f9b34fb\n" Sent: wr 13 0100

Got: 'rsp=$wr\n' Init called. b'\xf0' Sent: wr 10 f0

Got: 'rsp=$wr\n' Got: 'rsp=$ntfy\x1ehnd=h12\x1ed=b28016B0ECE98FE980700A007E0530004100152E1D01803000000000000000000000000000000000000003BD50E1CBC03C8D8D700B203C8D09700AB03C8B09700A803C8A8D7009F03C8A817809603C8B017808D03C8B417808D03C8AC17808D03C89C57808503C8A057008303C8A057007F03C88817808003887217807B03C8641780\n' INFO 2021-05-24 19:06:51,902 restarting since time from last packet is 3 already acumulated 0 Select timeout Select timeout Select timeout Select timeout Select timeout Select timeout Select timeout Select timeout ... ... ... etc.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-847201992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZDT7FXK5UXXKCCHHXTTPKCHJANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Ok, tnx, I will keep it running and report. I am suspicious about result as it was collecting for half an hour (master phone was away) and nothing collected... But we will see.. tnx!!

bordeb commented 3 years ago

For now it still works and keeps getting 363 but it seams that it does not understand data properly. The serial number of the sensor is showing wrong. There are also multiple checksum_ok1 = False, checksum_ok2 = False, checksum_ok3 = False. I will report in addition:

EDIT: I can also see in the log file that the master xDrip+ phone is connecting to rpi, but xDrip+ obviously does not receive usable glucose data. Something does not work

tzachi-dar commented 3 years ago

Are you running with libre1? What is the version of the fw of the miaomiao 2? (you can see this in xDrip in system status->bt status).

On Mon, 24 May 2021 at 20:41, bordeb @.***> wrote:

For now it still works and keeps getting 363 but it seams that it does not understand data properly. The serial number of the sensor is showing wrong. There are also multiple checksum_ok1 = False, checksum_ok2 = False, checksum_ok3 = False. I will report in addition

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-847218116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZBN534T7MOWWINBX6TTPKFS5ANCNFSM45LNX2RQ .

bordeb commented 3 years ago

This is for my little doughter. For last couple of days we are running for her with new MM2 and the firmware is 0004 (tomato firmware as xdrip displays). We have two additional MM1s. I am using one , and one is spare one... If you need to test something please say. I would not be so happy if I need to swap MM2 as it is sticked with tegaderm - we do not use those elastic straps. But I can experiment on me whatever you want :-)

bordeb commented 3 years ago

Sorry, I now seen what actually you were asking? Apologies! Yes, we are using Libre1 sensors! 100%

tzachi-dar commented 3 years ago

So, next step. Let's comment again the line

btle.Debugging = True

On line 498, you have

#print('total = ' ,binascii.b2ahex(self.data))

please enable it and run again (send me the logs after).

Thanks

Tzachi

On Mon, 24 May 2021 at 21:12, bordeb @.***> wrote:

Sorry, I now seen what actually you were asking? Apologies! Yes, we are using Libre1 sensors! 100%

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-847235515, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZGE5J5HWHBPKU7TZ3DTPKJH3ANCNFSM45LNX2RQ .

bordeb commented 3 years ago

In the meanwhile I performed clean install and setup on another RPI Zero W using buster raspbian and after copying the relevant files at first rpi successfully collected some data from MM2 and than xdrip successfully collected that data (I was so happyat at the moment thinking that it is resolved, but...), but after that no additional data from MM2 was collected. In the log file I can not see anything special. That old glucose data collected at first from MM2 is visible but no newer glucose data is collected. The log constantly says that connection to MM2 is not successfull (btle.BTLEException Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: random) but I am sure that it is somehow "partially" connected because the MM2 is not visible to other devices (phones scanning within xdrip app) untill the RPI is shutdown. I am 100% sure that phone can not be blamed for "stealing" the connection with MM2, so this can not be the reason that RPI can not connect to MM2. In contrary, it seams that there is some connection between rpi and MM2, but it fails to collect data from MM2, but again in some rare ocasions (I don't know why and when) it succeed. I am very confused.

tzachi-dar commented 3 years ago

You can try and reboot the pi to see if this is the one that is holding the miaimiao.

Thanks Tzachi

On Tue, 25 May 2021 at 00:37, bordeb @.***> wrote:

In the meanwhile I performed clean install and setup on another RPI Zero W using buster raspbian and after copying the relevant files at firts the rpi successfully collected some data from MM2 and than xdrip successfully collected that data but after that no additional data from MM2 was collected. In the log file I can not see anything special. That old data collected at first from MM2 is visible but no newer glucose data is collected. The log constantly says that connection to MM2 is not successfull (btle.BTLEException Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: random) but I am sure that it is somehow "partially" connected because the MM2 is not visible to other devices (phones scanning within xdrip app) untill the RPI is shutdown. I am 100% sure that phone can not be blamed for "stealing" the connection with MM2, so this can not be the reason that RPI can not connect to MM2. In contrary, it seams that there is some connection between rpi and MM2, but it fails to collect data from MM2, but again in some rare ocasions (I don't know why and when) it succeed. I am very confused.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-847352725, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZELDRJG6KBHEIACU6DTPLBJ7ANCNFSM45LNX2RQ .

tzachi-dar commented 3 years ago

Any progress on this?

Thanks Tzachi

bordeb commented 3 years ago

Hi @tzachi-dar , tnx very very much for asking! I still have no consistent conclusions to report. After experiencing the above mentioned situation with the 2nd RPI zero W, I have started a clean install from scratch on the 1st RPI again, but then stuck with errors while python3 setup.py build so I started again clean install from scractch... In the meanwhile on the 2nd RPI zero there is no changes = after some initial good readings from MM2 the rpi fails to successfully recive additional new data and in the log there are connection errors (btle.BTLEException Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: random) although it is obviously somehow connected with MM2 because during that time MM2 is not visible for phones. I will report additional info as soon as new clean install on the 1st RPi is successfully finished

bordeb commented 3 years ago

So, next step. Let's comment again the line #btle.Debugging = True On line 498, you have #print('total = ' ,binascii.b2ahex(self.data)) please enable it and run again (send me the logs after). Thanks Tzachi On Mon, 24 May 2021 at 21:12, bordeb @.***> wrote: Sorry, I now seen what actually you were asking? Apologies! Yes, we are using Libre1 sensors! 100% — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#11 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZGE5J5HWHBPKU7TZ3DTPKJH3ANCNFSM45LNX2RQ .

After several clean installs and setups, the only thing consistent is that there is some connection between RPI Zero W and MM2 but the data received is not good. I have enabled print('total = ' ,binascii.b2ahex(self.data)) I am really not an expert but from the log it is obvious that something is happening but with plenty of errors. How could I send you the log file? Thank you in advance!!

tzachi-dar commented 3 years ago

I have just installed the system on the latest version of pi zero. So far, after about one hour all is working well. I'll let it run for a few more days, and let's see how things will work.

Thanks Tzachi

bordeb commented 3 years ago

Thank you for the info!! Would you be so kind and let me know what firmware version is MM2 that you are testing with? In addition, please let know what specific version of raspbian have you used, did you perform full apt/ apt-get upgrade or not after install (I am asking because I have also noticed some error during upgrade, decribed here also https://github.com/RPi-Distro/pi-bluetooth/issues/25) , and finally what exact commands did you perform to install everything required - if you can maybe export history of your commands so I can try to exactly reproduce all here at my place.

tzachi-dar commented 3 years ago

mm2 firmware is 4.0 The rpi image that I have installed is: 2021-03-04-raspios-buster-armhf-full After the install, I let it install all necessary updates.

On the install I have run the commands as written in the instructions and also did: sudo cp ./bluepy/bluepy-helper /usr/local/lib/python3.7/dist-packages/bluepy/bluepy-helper

By the way, the python version that I have there is 3.7.3

If it will continue to work for a few more days without a problem, I'll create an image of the pi and upload it.

bordeb commented 3 years ago

Tnx so much!

So, you did NOT need to perform: sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/ ??

Yes, on buster the python is 3.7 while on stretch it is 3.5.

In the meanwhile, do you maybe want me to send you the log file after I enabled print('total = ' ,binascii.b2ahex(self.data)) ?

tzachi-dar commented 3 years ago

No, you should be running with the copy line above. Can you try running this on the buster version (after applying all changes)?

So, far all is working for 24 hours on a test system. If things will continue to be well, I'll switch tomorrow to a real system.

If you have logs from such a buster system, please mail them to tzachi.dar@gmail.com

bordeb commented 3 years ago

Thank you! After several initial trials on stretch, I have than switched to buster but again without success. I have just sent you the log from the buster system on rpi zero w.

tzachi-dar commented 3 years ago

Looking at the logs that you have sent, me it seems that data is arriving correctly, however it is ariving too slowly. Here is what you should try: On line 456 you have the line: if time.time() - self.lastReceiveTimestamp_ > 3:

Please replace it with: if time.time() - self.lastReceiveTimestamp_ > 10:

This should sovle your problem.

If this will not help, please replace the line (498): print('total = ' ,binascii.b2ahex(self.data)) with: logging.info('total = ' ,binascii.b2ahex(self.data)) run it for about 30 minutes and send me the logs.

bordeb commented 3 years ago

Thank you @tzachi-dar !! It works! After changing the number in the 456 line from 3 to 10 it started to collect good data! I am now testing and will continue to run it for a day and report if everything will be ok. Is this change posses some potential risk for consistency, security, performance..? Should I be specially cautious? I suppose not, that this is just amouint of time to let it wait. Am I right?

In addition, for me it was also enough just to do sudo cp ./bluepy/bluepy-helper /usr/local/lib/python3.7/dist-packages/bluepy/bluepy-helper I did NOT need to sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/

Also, I would suggest the revision of the tutorial regarding the distro. - at the beginning to say "buster" raspbian

tzachi-dar commented 3 years ago

I hope things are still working well. My test system is still running.

Background: mm2 sends the data in 3 packets, every 5 minutes. In a case of a failure, there are up to 4 retries. Failures are very rare, but I did see them on MM1 (once every month or so). After 4 retries, the connection disconnects (which causes a reset to mm1). Although this were very rare, without the retry and disconnection, the jobs would stack, and I had to wake up and restart them. As this retransmits are very rare, It is hard to be 100% sure that things did work for them.

The problem that I saw in your logs is that the 3 packets got mixed for some reason, that is it started with the second one, than the third, than the first one. This happened after the retransmit was done.

I thought that increasing the timeout should help things work better, but I'm not sure on it anymore. The change should be safe since checksum is verified on the data, so we will not send bad data to xDrip. If you can send me the logs again, I can try and understand what is going on there.

Thanks Tzachi

bordeb commented 3 years ago

I hope things are still working well. My test system is still running.

Dear Tzachi, thank you very much an all your support! It still works, two Rpi zeros and one Rpi 3B. It really is that this change from 3 to 10 was the solution in my case.

If you can send me the logs again, I can try and understand what is going on there.

Yes, I will gladly send you whatever you think is useful! Please let me know exactly what you want.

At the moment all rpis all clean install from scratch and then following the online tutorial. The only differences (three in total) from the tutorial is the use of "buster" insted of the older OS version, then skipping the step sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/ which was not needed in my case, and most importantly changing the value from "3" to "10" in the main.py

Do you want me to enable: print('total = ' ,binascii.b2ahex(self.data)) or replace it with logging.info('total = ' ,binascii.b2ahex(self.data)) or...?

Regards!

tzachi-dar commented 3 years ago

Please replace it with: logging.info('total = ' ,binascii.b2ahex(self.data))

On Wed, 2 Jun 2021 at 00:27, bordeb @.***> wrote:

I hope things are still working well. My test system is still running. Dear Tzachi, thank you very much an all your support! It still works, two Rpi zeros and one Rpi 3B. It really is that this change from 3 to 10 was the solution in my case.

If you can send me the logs again, I can try and understand what is going on there.

Yes, I will gladly send you whatever you think is useful! Please let me know exactly what you want.

At the moment all rpis all clean install from scratch and then following the online tutorial. The only differences (three in total) from the tutorial is the use of "buster" insted of the older OS version, then skipping the step sudo cp bluepy/*.py /usr/local/lib/python3.7/dist-packages/bluepy/ which was not needed in my case, and most importantly changing the value from "3" to "10" in the main.py

Do you want me to enable: print('total = ' ,binascii.b2ahex(self.data)) or replace it with logging.info('total = ' ,binascii.b2ahex(self.data)) or...?

Regards!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachi-dar/LibreAllHouse/issues/11#issuecomment-852456792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TBZBQE7DUEONZI4UWPYTTQVGCVANCNFSM45LNX2RQ .

bordeb commented 3 years ago

Hi! I have just shared the log file with you on gdrive. Thank you so much!

tzachi-dar commented 3 years ago

Hi, It seems that the line that I have asked you to write was wrong. Please change it to: logging.info('total = %s' ,binascii.b2ahex(self.data)) and run again.

Thanks Tzachi

bordeb commented 3 years ago

Hi! I have just shared with you the new log after running for last two hours with enabled: logging.info('total = %s' ,binascii.b2a_hex(self.data_)) Hope it will help this time. Tnx very very much! Looking forward

tzachi-dar commented 3 years ago

Well, it seems that after a new connection there is some problem that I do not understand, but it seems that after 5 minutes things start to work well again. So, if things seems to be working, I would not change anything here.