cyrils / web-bt1-monitor

Web application to read Renogy RS232 compatible BT-1 bluetooth adapter using Web Bluetooth API.
GNU General Public License v3.0
10 stars 5 forks source link

Help with ESP32 Tasmota #1

Open pmknowles opened 2 years ago

pmknowles commented 2 years ago

Not really an issue just hoping you might be able to give me some insight. I's like to read my Renogy using an ESP32 running Tasmota. There's a BLEOp command with the following format BLEOp1 m:MAC s:svc I know the MAC and I presume I would write 01030100000ac431 (device - read registers - start address - number of registers - checksum). I'm not sure what to put in service, characteristic and notifychar. Do you have any pointers?

cyrils commented 2 years ago

I am not very familiar with Tasmota. But you can find the values of write/notify characteristics in https://github.com/cyrils/web-bt1-monitor/blob/main/js/BtOneApp.js

These values work only for BT-1 Bluetooth adapter. I assume in your BLEOp command, syntax is MAC, ServiceUuid, WriteCharUuid, NotifyCharUuid, HexToWrite. However in case of Renogy there are two different write and notify services, not sure how to give that in the command.

pmknowles commented 2 years ago

Thanks for responding. I used to use a Pi with node-red and RS232 (but on restarts USB ports changed (I have 2 Renogys) and it was unreliable). It just sent the command to read the registers and the Renogy replied. It's obviously different over Bluetooth. I can get Tasmota to talk to the Renogy (by using different combinations of the UUIDs). I can get a WRITEDONE and READDONE message but no data. I can also get the Pi to use your python script to get the data so I know the script and everything works. From what you say it looks like I have to send separate write and read requests (presumably one request that says I want to read these registers and another which says send me them?) but I'm not sure which one's which. Does the BT-1 read the registers when it gets 01030100000A+crc (read 10 registers from device 1) using the write service? Then I use the notify service to read the data from the BT-1? Sorry for the questions GATT is a black art to me.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Cyril Sebastian @.> Sent: Wednesday, November 2, 2022 2:48:37 AM To: cyrils/web-bt1-monitor @.> Cc: pmknowles @.>; Author @.> Subject: Re: [cyrils/web-bt1-monitor] Help with ESP32 Tasmota (Issue #1)

I am not very familiar with Tasmota. But you can find the values of write/notify characteristics in https://github.com/cyrils/web-bt1-monitor/blob/main/js/BtOneApp.jshttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcyrils%2Fweb-bt1-monitor%2Fblob%2Fmain%2Fjs%2FBtOneApp.js&data=05%7C01%7C%7Ca6a3b7b216014618dd6608dabc7cbea4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638029541213972600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ll2kZKetmsE2TylGPNTDmv%2F8rrVlcqSVr3aAQI%2Btm00%3D&reserved=0

These values work only for BT-1 Bluetooth adapter. I assume in your BLEOp command, syntax is MAC, ServiceUuid, WriteCharUuid, NotifyCharUuid, HexToWrite. However in case of Renogy write and notify chars are in two different services, not sure how to give that in the command.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcyrils%2Fweb-bt1-monitor%2Fissues%2F1%23issuecomment-1299491340&data=05%7C01%7C%7Ca6a3b7b216014618dd6608dabc7cbea4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638029541213972600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ft%2FcEKf9AwgZ8vn28fcEd1EoLp1UY3mJK4bqbTqFAIw%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAI5KPM2OOAUTELGZ5LQ5LGDWGHJALANCNFSM6AAAAAARTZ4PUI&data=05%7C01%7C%7Ca6a3b7b216014618dd6608dabc7cbea4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638029541213972600%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5cRsht1fcZubNqg8QXQu%2FZ2u3swY3e%2BXxBecZwuFCm4%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

cyrils commented 2 years ago

Again I’m not sure how BLEOp does it. In python and JavaScript I have to subscribe to the notifyChar and then send the read command to writeChar, I will get the response from notifyChar through a callback. Also I use device Id 255.