Announcement

Collapse
No announcement yet.

BLE - ScannerLocation - Command:Unknown

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    BLE - ScannerLocation - Command:Unknown

    I was interested in setting up BLE scanning with a spare ESP32 I had laying around.

    Walking through the setup, we are told to enter the command (or similar depending X,X):
    "ScannerLocation 1,10,20"

    This command doesn't seem to do anything:

    Code:
    20:09:30 HTP: Console
    20:09:33 CMD: ScannerLocation 1,10,20
    20:09:33 RSL: Group 0, Index 1, Command SCANNERLOCATION, Data 1,10,20
    20:09:33 MQT: BLE-Scan/1/stat/RESULT = {"Command":"Unknown"}
    Furthermore, I've got the ESP32 configured as documented (AFAIK), but I do not see anything scan related. I appear to be using the same binaries as in Figure 43 of the guide;
    Code:
    00:00:00 CFG: Loaded from flash at 0, Count 39
    00:00:00 APP: Boot Count 27
    00:00:00 APP: Set Baudrate to 115200
    00:00:00 Project sonoff esp32_BLEScan-1 (Topic BLE-Scan, Fallback BLEScan_1-ESP32, GroupTopic BLE-Scanners) Version 5.12.0c-STAGED
    00:00:00 CFG: Saved to flash at FFFFFFFF, Count 40, Bytes 1680
    00:00:00 WIF: Attempting connection...
    00:00:00 WIF: Connecting to AP1 IOTGroup in mode 11
    00:00:01 WIF: Connected
    00:00:01 DNS: Initialized
    00:00:01 HTP: Web server active on BLE-Scan-2700.local with IP address 192.168.1.81
    00:00:01 APP: (UTC) Sun Aug 9 15:17:41 2020, (DST) Sun Aug 9 15:17:41 2020, (STD) Sun Aug 9 15:17:41 2020
    20:17:43 HTP: Main Menu
    20:17:43 MQT: Attempting connection...
    20:17:43 MQT: Connected
    20:17:43 MQT: BLE-Scan/1/tele/LWT = Online (retained)
    20:17:43 MQT: BLE-Scan/1/cmnd/POWER =
    20:17:43 MQT: Subscribe to BLE-Scan/1/cmnd/#
    20:17:43 MQT: Subscribe to sonoffs/1/cmnd/#
    20:17:43 MQT: Subscribe to cmnd/BLEScan_1-ESP32/#
    20:17:43 MQT: BLE-Scan/1/tele/INFO1 = {"Module":"WEMOS","Version":"5.12.0c","FallbackTopic":"BLEScan1","GroupTopic":"BLE-Scanners"}
    20:17:43 MQT: BLE-Scan/1/tele/INFO2 = {"WebServerMode":"Admin","Hostname":"BLE-Scan-2700","IPAddress":"192.168.1.81"}
    20:17:43 MQT: BLE-Scan/1/tele/INFO3 = {"RestartReason":"12"}
    20:17:45 HTP: Console
    20:17:52 MQT: BLE-Scan/1/tele/STATE = {"Time":"2020-08-09T20:17:52","Uptime":"0T00:00:12","Wifi":{"AP":1,"SSId":"IOTGroup","RSSI":100,"APMac":"22:3C:E8:81:4C:85"}})
    By way of comparison, I am not seeing the /CONFIG echo.

    Thanks!

    #2
    It has been awhile since this project was active. Through neglect my ESP32 have found other homes, but I did reflash one. It reported on Topic BLEScan/0/xxxx.

    I used Termite terminal program and entered the command ScannerLocation 1,10,20. The ESP32 restarted and the Topic it reported is now BLEScan/1/xxxx. This means it accepted the ScannerLocation command that identified this as Scanner #1 and location of (10,20). I also saw the BLEScan/1/CONFIG topic reported as well.

    I see you have BLE-Scan/1 and you have a prefix /tele inserted. How did you change the topic from BLEScan to BLEScan? Likewise the template with %prefix also looks to be different than what I had been using.

    Comment


      #3
      Originally posted by Michael McSharry View Post
      It has been awhile since this project was active. Through neglect my ESP32 have found other homes, but I did reflash one. It reported on Topic BLEScan/0/xxxx.

      I used Termite terminal program and entered the command ScannerLocation 1,10,20. The ESP32 restarted and the Topic it reported is now BLEScan/1/xxxx. This means it accepted the ScannerLocation command that identified this as Scanner #1 and location of (10,20). I also saw the BLEScan/1/CONFIG topic reported as well.

      I see you have BLE-Scan/1 and you have a prefix /tele inserted. How did you change the topic from BLEScan to BLEScan? Likewise the template with %prefix also looks to be different than what I had been using.
      After flashing the Tasmota firmware and assigning an SSID/PW, all of those options are configurable via the web interface. I simply configured the MQTT to more fit my preferences.

      Searching the Tasmota documentation, I see nothing about a "scannerlocation" command.

      From those docs;
      Tasmota uses 3 prefixes for forming a FullTopic:
      • cmnd - prefix to issue commands; ask for status
      • stat - reports back status or configuration message
      • tele - reports telemetry info at specified intervals
      If I needed to match your configuration or use a particular image, I understand, however I'm still not seeing any scanning data from the ESP32 itself.

      Comment


        #4
        Also, real quick, when searching the only hits I see for "ScannerLocation" are the mcsMQTT Documentation.

        Comment


          #5
          Version 5 of Tasmota was the basis for the source code. I ported it to ESP32 and added the logic for the BLE application and did it in a manner that allowed similar user interaction as was provided by ESP8266 Tasmota. It is not a project that is supported by Theo. Only documentation you will find is in the mcsMQTT manual.

          While changing the topic is possible, it may have interfered with the assumptions made or introduced logic paths that had not been evaluated. I did this quite awhile ago and things fade from memory as time passes. I suggest starting again and following only the instruction in mcsMQTT manual. After desired operation has been achieved then you can try to customize and see if it breaks or not.

          Comment


            #6
            Originally posted by Michael McSharry View Post
            I ported it to ESP32 and added the logic for the BLE application and did it in a manner that allowed similar user interaction as was provided by ESP8266 Tasmota.
            Reading through the documentation, it seems like I may have flash Tasmota but not your custom firmware. However, I do not see a link to it anywhere. I checked in the latest ZIP and I found the link to 'http://mcssprinklers.com/mcsTasmota.zip' but neither seems to have BLE firmware. Can you point me towards it?

            Comment


              #7
              I thought I had it documented in the manual, but in any case I recompiled and uploaded to make certain you are using the same thing that I just evaluated. It is at http://mcsSprinklers.com/ESP32BLEScanner.zip

              Comment


                #8
                Originally posted by Michael McSharry View Post
                I thought I had it documented in the manual, but in any case I recompiled and uploaded to make certain you are using the same thing that I just evaluated. It is at http://mcsSprinklers.com/ESP32BLEScanner.zip
                Much appreciated. This should fix my issues. I searched the manual and did not see the link in the version I've got.
                Thanks!

                Comment


                  #9
                  Originally posted by Michael McSharry View Post
                  I thought I had it documented in the manual, but in any case I recompiled and uploaded to make certain you are using the same thing that I just evaluated. It is at http://mcsSprinklers.com/ESP32BLEScanner.zip
                  Do I need the partition table bin from you as well? After flashing the sonoff bootloader and partition table with your firmware I only get the following as feedback;

                  rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
                  configsip: 0, SPIWP:0xee
                  clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00, wp_drv:0x00
                  modeIO, clock div:2
                  load:0x3fff0018,len:4
                  load:0x3fff001c,len:812
                  load:0x40078000,len:0
                  load:0x40078000,len:11404
                  entry 0x40078a28
                  user code done

                  Comment


                    #10
                    You only need it if you are going to build from source. The source is available if you want it.

                    I was not aware Sonoff had a product with ESP32. I have been using ESP32/LoRa development modules, but any ESP32 with BLE should work.

                    This same project was implemented on RPi. You can mix ESP32 and RPi. The RPi actually works better because it does not need to share single antenna between BLE and WIFI

                    Comment


                      #11
                      I have both RPi's and ESP-32's available. I went with what was in the documentation.

                      Originally posted by Michael McSharry View Post
                      You only need it if you are going to build from source. The source is available if you want it.

                      I was not aware Sonoff had a product with ESP32. I have been using ESP32/LoRa development modules, but any ESP32 with BLE should work.

                      This same project was implemented on RPi. You can mix ESP32 and RPi. The RPi actually works better because it does not need to share single antenna between BLE and WIFI
                      To be clear; When I originally flashed the three files that were required under "11.2 Getting Started with BLE" the ESP32 booted and ran as expected (screenshots in my first post). However, this first flash was with the wrong firmware (out of the box Tasmota).

                      When flashing with the provided "ESP32BLEScanner.bin" the ESP32 does not boot to user code. The file ESP32BLEScanner.bin is nearly twice the size of "sonoffo.ino.bin" found here.

                      Here's my flashing configuration.
                      And here's the feedback from Termite.

                      I went and re-checked the download of "Flash Download Tools (ESP8266 & ESP32 & ESP32-S2)" there are no .bin files in that path.

                      If BLE works, as per the documentation, I'd like to make use of it. But between missing files and steps I'm having a heck of a time duplicating your work. Thanks!

                      Comment


                        #12
                        The original discussion on this topic is at https://forums.homeseer.com/forum/li...oth-low-energy. Look at post #12 in particular. It contains the link to the files including the partition table. I read the manual that you referenced and see that it is needed if you do not use Platform IO for the download. Like I wrote before, memory fades over time. I would continue to use the .bin file that I uploaded yesterday to assure you have the version that I have.

                        Comment


                          #13
                          Originally posted by Michael McSharry View Post
                          The original discussion on this topic is at https://forums.homeseer.com/forum/li...oth-low-energy. Look at post #12 in particular. It contains the link to the files including the partition table. I read the manual that you referenced and see that it is needed if you do not use Platform IO for the download. Like I wrote before, memory fades over time. I would continue to use the .bin file that I uploaded yesterday to assure you have the version that I have.
                          I'd love to say I've had success, but I have not. Even using the three files from the file "ESP32_BLE_BinaryAndLoader.zip" the ESP32 boots the bootloader and stops, claiming no user code:

                          Code:
                          rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
                          configsip: 0, SPIWP:0x00
                          clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00, wp_drv:0x00
                          mode:DIO, clock div:2
                          load:0x3ffc0000,len:0
                          load:0x3ffc0000,len:2876
                          load:0x40078000,len:4200
                          load:0x40098000,len:740
                          entry 0x4009816c
                          [1B][0;32mI (26) boot: Espressif ESP32 2nd stage bootloader v. V0.1[1B][0m
                          [1B][0;32mI (35) boot: compile time 15:00:13[1B][0m
                          D (41) boot: mmu set paddr=00000000 count=1[1B][0m
                          D (48) boot: magic e9[1B][0m
                          D (51) boot: blocks 04[1B][0m
                          D (55) boot: spi_mode 02[1B][0m
                          D (59) boot: spi_speed 00[1B][0m
                          D (63) boot: spi_size 02[1B][0m
                          [1B][0;32mI (67) boot: SPI Speed : 40MHz[1B][0m
                          [1B][0;32mI (73) boot: SPI Mode : DIO[1B][0m
                          [1B][0;32mI (79) boot: SPI Flash Size : 4MB[1B][0m
                          [1B][0;32mI (86) boot: Partition Table:[1B][0m
                          [1B][0;32mI (91) boot: ## Label Usage Type ST Offset Length[1B][0m
                          D (102) boot: load partition table entry from 4000(3f404000)[1B][0m
                          D (111) boot: type=ff subtype=ff[1B][0m
                          [1B][0;32mI (116) boot: End of partition table[1B][0m
                          [1B][0;31mE (122) boot: nothing to load[1B][0m
                          user code done
                          ets Jun 8 2016 00:22:57
                          I have used the ESP32 download tool to erase and re-flash, and I always get the same.

                          I can however, flash the base TasmotaI linked earlier, and it boots to user code:
                          Code:
                          rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
                          configsip: 0, SPIWP:0xee
                          clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00, wp_drv:0x00
                          mode:DIO, clock div:2
                          load:0x3fff0018,len:4
                          load:0x3fff001c,len:812
                          load:0x40078000,len:0
                          load:0x40078000,len:11404
                          entry 0x40078a28
                          
                          00:00:00 CFG: Use defaults
                          00:00:00 APP: Set Baudrate to 115200
                          
                          00:00:00 Project sonoff Sonoff (Topic sonoff, Fallback DVES_00000000, GroupTopic sonoffs) Version 5.12.0c-STAGED
                          00:00:00 WIF: Connecting to AP1 in mode 11
                          I am using Firmware @ 0x10000, Bootloader @ 0x1000, Partition Table @ 0x8000.

                          If you have any advice, I'd appreciate it. Thanks as always!

                          Comment


                            #14
                            I tried to repeat your experience and can confirm I was not able to load via ESP32Downloader. I need to relearn binary download. PlatformIO handles it internally based upon the ESP32_no_SPIFF.csv that is in the project source. Uploading from PlatformIO via source compile does work.

                            Comment


                              #15
                              Originally posted by Michael McSharry View Post
                              I tried to repeat your experience and can confirm I was not able to load via ESP32Downloader. I need to relearn binary download. PlatformIO handles it internally based upon the ESP32_no_SPIFF.csv that is in the project source. Uploading from PlatformIO via source compile does work.
                              I'll take a look at PlatformIO, but it's not something I'm familiar with.

                              If you narrow down a fix, I'd love to know Thanks for taking the time to test it.

                              Comment

                              Working...
                              X