GithubHelp home page GithubHelp logo

espresense / espresense Goto Github PK

View Code? Open in Web Editor NEW
984.0 29.0 137.0 3.69 MB

An ESP32 based node for gathering indoor positioning and transmitting to mqtt

Home Page: https://espresense.com/

License: GNU Affero General Public License v3.0

C++ 43.11% C 46.06% Python 0.19% HTML 0.11% JavaScript 2.21% Svelte 8.28% CSS 0.04%
esp32 esp32-arduino mqtt home-assistant homeassistant home-automation iot hacktoberfest m5atom m5atom-lite

espresense's Introduction

espresense's People

Contributors

0flush0 avatar anarchking avatar chrisjohns-me avatar corgan2222 avatar creuzerm avatar demostenes avatar dependabot[bot] avatar dtterastar avatar dulfer avatar enthusiastdeveloper avatar everythingsmarthome avatar fvanegmond avatar gunnarbeutner avatar jaredhobbs avatar jlrgraham avatar jptrsn avatar kylegordon avatar lolorc avatar manfred-mp avatar mjtimmer avatar needs-coffee avatar niceboygithub avatar patatman avatar richieframe avatar samkirsch10 avatar scottt732 avatar shonp40 avatar urkidding avatar wongchristopher avatar xscorpion2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

espresense's Issues

Make changes on configuration available after initial setup

Is your feature request related to a problem? Please describe.
After the install and configure there is no way to change the configuration. If entering the ip of the device there is no web interface to change for example the distance for tracking. Do a fresh install everytime I want to adapt the distance is not user friendly.

Describe the solution you'd like
Make the web interface from initial setup available also after setup.

Clarify how to configure

Hi,

This might be silly but I just sat there a bit confused for a minute after flashing my esp32 from my browser, with no idea what the next step is.
Figured it out eventually but it might be worth mentioning on the install page that after flashing it'll create an open network with a config page.

DOC: Home Assistant Configuration

Hello,

Looking at the docs found here, it describes a few ways to see the serial logs:

...
The easiest way to find it is to connect the usb cable and monitor the serial port (115200 baud) while bringing a device close to the ESP32. To monitor the serial port you can use Ardiuno monitor function or via platform io pio run --target monitor. You should see output similar to the following:
...

I suggest adding info about the PlatformIO VScode plugin as another alternative, as it has a serial monitor as well.

auto update in web portal

Hello
Would it be possible to add in the preferences of web portal the option (similar to : ☑ Send to devices topic (default: ☑) :
☑ autoupdate (default: ☑).

thanks !

Add Lux Sensor

is it possible to add a lux sensor like you did with the Motion sensor? Then this would be the ultimate detection machine!

Integration with ESPHome

Is your feature request related to a problem? Please describe.
Is there any way to have this project play more nicely with ESPHome? I find that I want two ESP32's in each room because of features on both of these projects. There is likely interest on the other side as well.

Describe the solution you'd like
Perhaps ESPHome compatibility built into this project such that various sensors and outputs can be interacted with through the ESPHome ecosystem? Or an official plugin for ESPHome from the contributors of this project?

Describe alternatives you've considered
2 ESP32s in one room.

Additional context
None

[Enhancement] - improve config portal with device list

It would be great to have in the configuration portal a list of the seen devices as well as the ones being reported at the moment.

This would allow to not have to use mqtt to check all devices, but see it in a convenient place.

Tasmota has a similar feature:

Feedback v2.0 - Finally the Apple Watch is detected!

The latest Update kills it! Now the Apple Watch looks different as the iPhone and reports even the name correct.
Looks pretty good!

grafik

  • Are these extreme long room Assistant name intended? Is this what I have to enter the HA Config?
  • One thing I mentioned is, that the room assistant detection came really late. I would say after around 2-3 minutes.
  • At first, I had weird error/debugs messages. But they are gone now after a few minutes.

ld_pdu_get_tx_flush_nb HCI packet count mismatch (1, 2)
E NimBLEClient: "Connection failed; status=574 "
E NimBLEClient: "Connection failed; status=13 "
lld_pdu_get_tx_flush_nb HCI packet count mismatch (1, 2)
E NimBLEClient: "Connection failed; status=574 "
E NimBLERemoteService: "characteristicDiscCB() rc=7 "
E NimBLERemoteService: "Could not retrieve characteristics"
E NimBLEClient: "Disconnected, could not retrieve services -aborting"
E NimBLEClient: "Disconnected, could not retrieve services -aborting"

great Job, thanks!!

Beacons not displaying, Base stations not registering.

Describe the bug
A clear and concise description of what the bug is.
Devices not showing in Home Assistant, neither base stations nor beacons. I followed the video and added my 4 base stations to the network and can see the traffic in MQTTExplorer. I also added the MQTT_Room sensors of the 3 devices I currently want to track to my sensors.yaml file. But in Home Assistant only 2 of my base stations registered as devices and none of my beacons are showing up at all. I have several other devices using MQTT and Tasmota, so I know it's not that.

Expected behavior
A clear and concise description of what you expected to happen.
Tracked beacons and all base stations to be listed in Home Assistant

Logs
If possible, copy and paste any logs from the serial monitor from the time that you see the bug.
There a few errors in the HA logs

Error Number 1
Logger: homeassistant.components.mqtt.discovery
Source: components/mqtt/discovery.py:116
Integration: MQTT (documentation, issues)
First occurred: 3:53:07 AM (6 occurrences)
Last logged: 11:41:25 AM

Unable to parse JSON max_distance: '{"~":"espresense/rooms/Kitchen","name":"ESPresense Kitchen Max Distance","unique_id":"94:B9:7E:E6:56:80_max_distance","availability_topic":"~/status","stat_t":"~/max_distance","cmd_t":"~/max_distance/set","step":"0.01","dev":{"ids":["94:B9:7E:E6:56:80"],"cns":[ESPresense Kitchen'
Unable to parse JSON max_distance: '{"~":"espresense/rooms/Livingroom","name":"ESPresense Livingroom Max Distance","unique_id":"7C:9E:BD:61:F9:2C_max_distance","availability_topic":"~/status","stat_t":"~/max_distance","cmd_t":"~/max_distance/set","step":"0.01","dev":{"ids":["7C:9E:BD:61:F9:2C"],"cns":['
Unable to parse JSON connectivity: '{"~":"espresense/rooms/Livingroom","name":"ESPresense Livingroom","unique_id":"7C:9E:BD:61:F9:2C_connectivity","json_attr_t":"~/telemetry","stat_t":"~/status","frc_upd":true,"dev_cla":"connectivity","pl_on":"online","pl_off":"offline","dev":{"ids":["7C:9E:BD:61:F9:2C"],"cns":[ESPresense Livingroom'
Unable to parse JSON max_distance: '{"~":"espresense/rooms/Livingroom","name":"ESPresense Livingroom Max Distance","unique_id":"7C:9E:BD:61:F9:2C_max_distance","availability_topic":"~/status","stat_t":"~/max_distance","cmd_t":"~/max_distance/set","step":"0.01","dev":{"ids":["7C:9E:BD:61:F9:2C"],"cns":[ESPresense Livingroom'
Unable to parse JSON 1F28A4_RL_3: '{"name":"Plug2-3","stat_t":"tele/Plug2/STATE","avty_t":"tele/Plug2/LWT","pl_avail":"Online","pl_not_avail":"Offline","cmd_t":"cmnd/Plug2/POWER3","pl_off":"OFF1(&homeassistant/light/1F28A4_LI_6/config1)'homeassistant/switch/1F28A4_RL_6/config1(&homeassis'

Error Number 2
Logger: homeassistant.components.mqtt
Source: components/mqtt/__init__.py:895
Integration: MQTT (documentation, issues)
First occurred: 11:12:16 AM (2 occurrences)
Last logged: 11:51:14 AM

Can't decode payload b'{"id":"iBeacon:64d5478b-d3ec-436b-83c9-967ed3dd87df-100-1","rssi@1m":-59,"rssi":-70,"mac":"40d2f2139790","raw":2.06,"distance":1.4,"spee\x82*\x00\x04\x00' on espresense/devices/iBeacon:64d5478b-d3ec-436b-83c9-967ed3dd87df-100-1/Haths Bedroom with encoding utf-8 (for <Job HassJobType.Callback <function MQTTRoomSensor.async_added_to_hass.<locals>.message_received at 0x7f7241d0bb80>>)
Can't decode payload b'{"~":"espresense/rooms/Haths Bedroom ","name":"ESPresense Haths Bedroom ","unique_id":"7C:9E:BD:62:18:E0_connectivity","json_attr_t":"~/telemetry","stat_t":"~/status","frc_upd":true,"dev_cla":"connectivity","pl_on":"online","pl_off":"offline","dev":{"ids":["7C:9E:BD:62:18:E0"],"cns":[\x86\xe0\x07\xc0\xbc\xd8\xff?' on homeassistant/binary_sensor/espresense_Haths Bedroom /connectivity/config with encoding utf-8 (for <Job HassJobType.Coroutinefunction <function async_start.<locals>.async_discovery_message_received at 0x7f7241f4e790>>)

Error Number 3
Logger: homeassistant.components.mqtt.discovery
Source: components/mqtt/discovery.py:101
Integration: MQTT (documentation, issues)
First occurred: 12:07:21 AM (103 occurrences)
Last logged: 12:10:35 PM

Received message on illegal discovery topic 'homeassistant/number/espresense_Haths Bedroom /max_distance/config'
Received message on illegal discovery topic 'homeassistant/number/espresense_Kyras Bed/max_distance/config'
Received message on illegal discovery topic 'homeassistant/binary_sensor/espresense_Kyras Bedroom/connectivity/config'
Received message on illegal discovery topic 'homeassistant/number/espresense_Kyras Bedroom/max_distance/config'
Received message on illegal discovery topic 'homeassistant/binary_sensor/espresense_Haths Bedroom /connectivity/config'

Hardware Details
If the bug is related to tracking a specific piece of hardware (e.g. iBeacon, phone, etc), please enter any relevant details about the hardware (such as firmware version, MAC address, etc).
My setup for the beacons:

  • platform: mqtt_room
    device_id: "38854575b6e4"
    name: 'Esp Haths Nut'
    state_topic: 'espresense/devices/38854575b6e4'
    timeout: 6
    away_timeout: 20

  • platform: mqtt_room
    device_id: "iBeacon:64d5478b-d3ec-436b-83c9-967ed3dd87df-100-1"
    name: 'Esp Haths S21'
    state_topic: 'espresense/devices/iBeacon:64d5478b-d3ec-436b-83c9-967ed3dd87df-100-1'
    timeout: 6
    away_timeout: 20

  • platform: mqtt_room
    device_id: "iBeacon:64f8b12b-6c89-4969-a829-d4d1f9e3b716-100-1"
    name: 'Esp Kyras S21'
    state_topic: 'espresense/devices/iBeacon:64f8b12b-6c89-4969-a829-d4d1f9e3b716-100-1'
    timeout: 6
    away_timeout: 20

Screenshots
If applicable, add screenshots to help explain your problem.

Screenshot_2021-09-26_12-08-26
Screenshot_2021-09-26_12-09-57
Screenshot_2021-09-26_12-11-19
Screenshot_2021-09-26_12-11-40

Id gets generated new on every addition of esp32 devices

Describe the bug
Not sure if that is a bug or expected behaviour or if I understand it wrong but it looks like the ID for the devices are getting new generated every time I add a esp32 with ESPresesense to my network.

Expected behavior
ID should stay the same after first install. Maybe devices can share the IDs they have generated so a new added device is not generating new IDs.

Extra Info
Maybe you can add a forum Post on Home assistant forum or somewhere else for easier clarification of functionality so we can easy share knowledge. Asking things like this in a forum could make it easier to keep the bug/enhancement section clean.

Support I2C PIR sensor connected to Grove port on M5Stack devices (M5StickC, M5StickC-Plus, M5Atom-Matrix)

All of these M5Stack devices support the I2C protocol over a Grove port, and M5Stack makes a Grove PIR sensor. It would be great if ESPresence supported a PIR sensor via this interface.

Another suggestion that isn't specific to the M5Stack devices: A "silent" option in the configuration webUI to disable the screen and LED flashing. This would make using these devices on a nightstand a lot less intrusive.

Home Assistant Android App BLE beacon not showing up in MQTT messages

Describe the bug
I've enabled the BLE Beacon in the HA Android app, I see the iBeacon messages coming into the terminal, but not in MQTT Explorer. I am seeing other devices fine.

Not sure if related,. but they are also strangely backwards... In the HA Android app it says "112233445566778899AABB-100-1" however in the serial log it shows "BBAA998877665544332211-100-1" (it's actually a longer UUID string, but hopefully you get the idea, note they are reversed based in pairs every time, not in full reverse order, if a separate bug and not related, I can open one up.)

Neither of these strings are showing up in the MQTT app when watching with MQTT Explorer.

Expected behavior
The UUID for the ID should show up in MQTT and match the expected one in the app

Logs

0 New   | MAC: 7cd1b850ed1d, ID: iBeacon:REMOVED-100-1
1 Del   | MAC: 63e2f09760bc, ID: iBeacon:REMOVED-100-1

Hardware Details
Android Pixel 4XL running app version beta-731-c5e3d4a-full
ESP32 D1 Mini

Screenshots

Selective HASS MQTT Enrollment

I'm thinking of the following. Each device will have a "Join" button (just like zigbee). You press the button to allow joining and the first device brought within 0.5m of that base station will have the device added to Home Assistant via MQTT Discovery. You then name it in HASS what it really is and repeat to find all your devices.

Generated iPhone IDs not unique to each iPhone

I have 5 iPhones that I am tracking across 8 x ATOM Lite ESP32 running Espresense - all are different iPhone models and all run iOS 14.7/8:

iPhone 8 Plus, XS Max, 11 Pro Max, 12, and 12 Pro Max.

The last three of the above list work fine. However, the 8 Plus and XS Max despite having different IDs configured in Configuration.yml, their entities update with the same or slightly different status. For example, the XS Max is not physically present and cannot be seen by any ESP32 devices, however its entity location updates with the 8 Plus entity.

I've removed the 8 Plus entity (by #ing the entry in configuration.yml) and the XS Max entity then behaves correctly. Adding it back then reproduces the problem.

When both devices are in range and the 8 Plus entity is removed, both devices update the XS Max entity.

It seems there is a flaw in the ID calculation as both devices appear to be the same (even though they have unique IDs).

HA Auto Detection doesn't work with a space in room name

I have 6 devices that recently upgraded to 1.6.0 - Kitchen, Office and e0378c are all showing in HA, but 'Great Room', 'Dining Room' and 'Master Bedroom' are not. I will try today to remove the space from these other rooms to confirm this is indeed the defect.

Show actual maxDistance in Attributes under Home Assistant

Is your feature request related to a problem? Please describe.
As there is now a option to change the max distance via MQTT it would be good to see somewhere what the max distance is for now on a room

Describe the solution you'd like
Add another attribute per Room where the maxDistance is shown

CRASH: CORRUPT HEAP

0 New | MAC: xx, ID: apple:1007:11-12
1 Del | MAC: xx, ID: apple:1007:11-8
1 Close | MAC: xx, ID: apple:1007:11-12
1 Close | MAC: xx, ID: exp:20
1 Del | MAC: xx, ID: apple:0c0e:18
[E][main.cpp:168] onMqttDisconnect(): Disconnected from MQTT; reason 0

Reconnecting to MQTT...
0 New | MAC: xx, ID: xx-32421-0
1 Del | MAC: xx, ID: xx-1907-0
0 New | MAC: xx, ID: apple:0c0e:18
1 Del | MAC: xx, ID: microsoft:xx
CORRUPT HEAP: Bad head at 0x3fffe498. Expected 0xabba1234 got 0x3fffe640
abort() was called at PC 0x40086cdd on core 1

ELF file SHA256: 0000000000000000

Backtrace: 0x4008f658:0x3ffdeb00 0x4008f8d5:0x3ffdeb20 0x40086cdd:0x3ffdeb40 0x40086e09:0x3ffdeb70 0x40116a37:0x3ffdeb90 0x401104dd:0x3ffdee50 0x4011045d:0x3ffdeea0 0x400942c1:0x3ffdeed0 0x40081e6e:0x3ffdeef0 0x40086bd5:0x3ffdef10 0x4000bec7:0x3ffdef30 0x400f316b:0x3ffdef50 0x400f3179:0x3ffdef70 0x400ee8ae:0x3ffdef90 0x400d342b:0x3ffdf010 0x400d37a3:0x3ffdf4a0 0x400908e6:0x3ffdf500

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, 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:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac

Signature of iOS device changes after OS upgrade

Describe the bug
Signature changes after OS upgrade

Expected behavior
Not certain, signature remain constant.

Hardware Details
Two iPhone 12 Pro updated to 14.8

Espresense 1.4.0 - originally I said. 1.2.0, I didn't realize they were auto-updated until I looked in the web terminal/console.

Take the intelligence to the edge of the network

As the name suggests this is "Presense" detection.
Make it act like one by

  1. Allow user to weed out unnecessary for the presence detection BT devices like stationary computers, BT speakers etc.
  2. Analyze presence on board of ESP32 and produce MQTT record only when one of the tracked devices enters or leaves the zone determined by radius in the setup.

The way it is now ESPresence produces a barrage of MQTT records (most unnecessary) that some computer(s) upstream have to read and analyze. ESP32 can and must do this analysis locally not clogging the network and upstream devices with information that can be processed locally.

Home-Assistant configuration to show rooms with a list of devices

First off, let me apologize for my lack of knowledge regarding MQTT and Home-Assistant configuration in general...

So, there's example configuration to show which device is in which room (well, it provides the entity configuration for those).

Now, how would i go about listing the rooms in Home-Assistant and displaying the devices in each room?

Is that currently possible, and if so, how?

Flashing via web browser not working

The process does finish and says successful, however, it doesn't appear to be successful.

No AP is created and the ESP32, using a serial monitor, reports nothing present to load.

Same ID shown

I have 2 apartment entrance tag.
They all show the same ID and even all use the same name. mac address is different
People in the same apartment use the same type of tag.
So there are many of tags of the same kind.

Version: v1.4.4
IP address: 192.168.0.14
DNS address: 168.126.63.1
Hostname: espresense-home
Room: home
Telemetry: enabled
Rooms: enabled
Devices: enabled

{"id":"md:035d:8","name":"APT-Tag","rssi@1m":-59,"rssi":-80,"mac":"e10bb14271xx","raw":3.98,"distance":2.82:"speed":0}
{"id":"md:035d:8","name":"APT-Tag","rssi@1m":-59,"rssi":-94,"mac":"c57fc97023xx","raw":10,"distance":9.21:"speed":0}

Auto Update not working

Hi,

Auto update is not working, please see below error:
image

I believe the reason is that the assets are missing from the releases:
image

Versus latest release with update working:
image

define room

Hello
Congratulations on taking over this great project.
I have flashed the ESP32 and now I want to change the name of the room.
I can't find the following line
//Replace with the room name where the node will be placed; example: #define room "living-room"
#define room "living-room"

can i add it to change the name of my room?

Thanks again for this great project.

Allow explicit inclusion/exclusion of device ID prefixes

Thanks for the awesome work on this project. I just upgraded my deployment from a couple of random dev boards to a batch of Atom Lites.

Please consider adding the ability to specify the device ID prefixes that should not (or should) be reported to the MQTT server. This feature could be exposed to the user on the config page as an initially empty text field and radio buttons for exclude (default) and include. Prefix entries would be space- or comma-delimited.

I have two sets of Sonos speakers that are constantly spamming the MQTT stream with BLE pings that have no practical use and can't be disabled. I would love to be able to exclude "sonos" (i.e., sonos:*) devices from being reported. Others may want to allow only Apple devices, filter out Covid contact tracing pings, etc.

Web portal should load after wifi connection details established

I used the website to flash an esp32 dev board. After connecting to wifi I was hoping to change additional settings from my desktop but the captive portal doesn't seem to be available. I would love to be able to hit the board at it's IP and be able to mess with additional settings.

All Sonos devices show the same id "md:05a7:150"

Describe the bug
All Sonos devices show the same md based id, including the portable.

Logs

espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBCA933ACE9","rssi@1m":-41,"rssi":-76,"mac":"d2d26988f1e1","raw":10,"distance":11.05,"speed":-0.3}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"846B210D346030AEE9","rssi@1m":-41,"rssi":-84,"mac":"f333d57f21aa","raw":16.93,"distance":13.72,"speed":4.6}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBCA933ACE9","rssi@1m":-41,"rssi":-78,"mac":"d2d26988f1e1","raw":11.41,"distance":11.07,"speed":0.2}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBC3433ACE9","rssi@1m":-41,"rssi":-81,"mac":"d2d24cc6da8a","raw":13.89,"distance":15.76,"speed":-0.5}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"846B210D346030AEE9","rssi@1m":-41,"rssi":-82,"mac":"f333d57f21aa","raw":14.84,"distance":14.48,"speed":0.4}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBCA933ACE9","rssi@1m":-41,"rssi":-77,"mac":"d2d26988f1e1","raw":10.68,"distance":11.29,"speed":-0.2}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBC3433ACE9","rssi@1m":-41,"rssi":-80,"mac":"d2d24cc6da8a","raw":13.01,"distance":15.54,"speed":-0.3}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"846B210D346030AEE9","rssi@1m":-41,"rssi":-77,"mac":"f333d57f21aa","raw":10.68,"distance":14.07,"speed":-3.3}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBCA933ACE9","rssi@1m":-41,"rssi":-76,"mac":"d2d26988f1e1","raw":10,"distance":11.12,"speed":-0.8}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"F8B3C5DDBC3433ACE9","rssi@1m":-41,"rssi":-78,"mac":"d2d24cc6da8a","raw":11.41,"distance":14.96,"speed":-1.4}
espresense/rooms/familyroom {"id":"md:05a7:150","name":"846B210D346030AEE9","rssi@1m":-41,"rssi":-83,"mac":"f333d57f21aa","raw":15.85,"distance":14.16,"speed":0.7}

Version:

{"ip":"192.168.35.121","uptime":27042,"firm":"esp32","rssi":-55,"ver":"v1.2.0","seen":50,"reported":15,"adverts":40,"freeHeap":107160,"minFreeHeap":41856,"maxAllocHeap":38564,"resetReason":"SoftwareCpu"}

MQTT never connects if ESP32 not connected to internet

Describe the bug
I have flashed two ESP32s using the browser-based installer, and after setting Wifi/MQTT settings in the captive portal, the ESP32s connect to the WiFi network but appear to never connect to MQTT (as evidenced by serial logs, Mosquitto logs, and lack of espresence MQTT topics). This is occurring both with the default ESP32 build and the verbose logging build.

Expected behavior
ESP32 connects to WiFi, and then MQTT

Logs
Serial log:

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:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
Connecting to WiFi ([MAC redacted])...
I (65) wifi:wifi driver task: 3ffd207c, prio:23, stack:3584, core=0
I (257) wifi:wifi firmware version: dc30037
I (258) wifi:config NVS flash: enabled
I (258) wifi:config nano formating: disabled
I (258) wifi:Init data frame dynamic rx buffer num: 32
I (263) wifi:Init management frame dynamic rx buffer num: 32
I (268) wifi:Init management short buffer num: 32
I (273) wifi:Init dynamic tx buffer num: 32
I (277) wifi:Init static rx buffer size: 1600
I (281) wifi:Init static rx buffer num: 16
I (284) wifi:Init dynamic rx buffer num: 32
I (385) wifi:mode : sta (24:62:ab:ca:f9:e4)
Connecting to WiFi SSID [SSID redacted].....I (2454) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1
I (2455) wifi:state: init -> auth (b0)
I (2462) wifi:state: auth -> assoc (0)
I (2470) wifi:state: assoc -> run (10)
I (2501) wifi:connected with [SSID redacted], aid = 77, channel 11, BW20, bssid = [BSSID redacted]
I (2502) wifi:security type: 3, phy: bgn, rssi: -45
I (2512) wifi:pm start, type: 1

I (2513) wifi:AP's beacon interval = 102400 us, DTIM period = 1
10.x.x.116
Version:     v1.3.0
IP address:  10.x.x.116
DNS address: 10.x.x.1
Hostname:    espresense-test
Room:        test
Telemetry:   enabled
Rooms:       enabled
Devices:     enabled
Max Distance: 16

Mosquitto logs: No record of "New client connected from 10.x.x.116"
MQTT topics: No espresence topic exists

Hardware Details
This is occurring for me on both a Firebeetle ESP32 as well as the "standard" ESP32 devkit
MQTT is a fairly standard Mosquitto implementation, no SSL, listening on the same LAN as the ESP32 (I have other ESP32s deployed with Tasmota/Arduino around the house without issues).
Install was done using the latest version of Chrome. Also tested using Edge with identical results.

Captive Portal Settings:
image

Multiple Devices show id as exp:20

Describe the bug
Multiple Devices show ID: exp:20 as identifier. I have an iPhone 7 and 11 here. The iPhone 11 shows as apple:1007:11-7 the iPhone 7 as exp:20.

Expected behavior
iPhone 7 should also have a unique id

Logs
0 New | MAC: 558c95b262fa, ID: apple:1006:10-6
0 New | MAC: 565877bd5177, ID: apple:1006:10
0 New | MAC: 6d0d3a32b91a, ID: apple:1006:10
0 New | MAC: 6ba18edc5499, ID: apple:1007:11-7
1 Close | MAC: 6d0d3a32b91a, ID: apple:1006:10
0 New | MAC: c0288d341827, sID: 0xfe61
0 New | MAC: 6c7b4ef1fe79, ID: apple:1005:9-26
1 Close | MAC: 3eb56c68d2ce, ID: exp:20
0 New | MAC: a4c138a6748f, ID: a4c138a6748f, MD: 0188ec000101
1 Close | MAC: 6ba18edc5499, ID: apple:1007:11-7
0 New | MAC: 7b29ac2c42b3, ID: apple:1005:9-12
1 Close | MAC: 1e399b08ae07, ID: exp:20
1 Left | MAC: 6d0d3a32b91a, ID: apple:1006:10
0 New | MAC: 707c6a4d3c3b, ID: apple:1006:10-6
1 Left | MAC: 6ba18edc5499, ID: apple:1007:11-7
1 Left | MAC: 1e399b08ae07, ID: exp:20
1 Close | MAC: 1e399b08ae07, ID: exp:20
1 Close | MAC: 6ba18edc5499, ID: apple:1007:11-7
0 New | MAC: 4a7575ed2e88, ID: apple:1005:9-12
0 New | MAC: 3414a6a085ba, ID: exp:20
1 Left | MAC: 6ba18edc5499, ID: apple:1007:11-7
1 Left | MAC: 1e399b08ae07, ID: exp:20
0 New | MAC: 680ae219cf13, ID: 680ae219cf13, MD: e70601030c030102001c5c88bfe7d2094b5d881ef32f89eeb403
1 Close | MAC: 3414a6a085ba, ID: exp:20
1 Left | MAC: 3414a6a085ba, ID: exp:20
1 Close | MAC: 3414a6a085ba, ID: exp:20
1 Left | MAC: 3414a6a085ba, ID: exp:20

Flashing device a second time from web doesn't wipe settings

When flashing from the web (and possibly compiling from source, untested) the process does not reset any settings (such as wifi). I was attempting to get back to an out-of-box state so I could use the captive portal to change additional settings. But I can't seem to get to that state even when flashing.

Devices using the same ID

I have a Mi Band 5 and a Amazfit Bip S. they have the same id, they would switch when one is not in range
image

UUID beacon

Hello
with my Ebeacon in version 1.1.2 the UUID was upside down but visible.
the RSSI at 1m was correct and matched the beacon.

In V1.5.0 the UUID are no longer visible and the RSSI at 1m is blocked on -59.

https://ibb.co/jkY7b4s

but i can use the new ID instead of the UUID it doesn't change much, but could you please correct the RSSI@1m.

thanks you

Auto firmware update fails on M5StickC-Plus

Describe the bug
Auto firmware update fails on M5StickC-Plus and causes BLE scanning to stop. Telemetry data continues to be published in MQTT after the error.

Expected behavior
Auto firmware update to complete and BLE scanning enabled.

Logs
Firmware URL:
https://github.com/ESPresense/ESPresense/releases/latest/download/m5stickc-plus.bin

Serial Log:
[E][ssl_client.cpp:36] _handle_error(): [start_ssl_client():207]: (-32512) SSL - Memory allocation failed
[E][WiFiClientSecure.cpp:133] connect(): start_ssl_client: -32512
[E][HTTPUpdate.cpp:231] handleUpdate(): HTTP error: connection refused

[E][main.h:205] firmwareUpdate(): Http Update Failed (Error=-1): HTTP error: connection refused

Telemetry Data:
{
"ip": "x.x.x.x",
"uptime": 348,
"uptime": 363,
"firm": "m5stickc-plus",
"rssi": -69,
"rssi": -68,
"seen": 16,
"adverts": 6120,
"freeHeap": 63640,
"adverts": 6355,
"freeHeap": 63888,
"minFreeHeap": 44604,
"maxAllocHeap": 36056,
"resetReason": "RtcWdtRtc"
}

Hardware Details
M5StickC-Plus

OTA Update

Your last update with HA Autodiscory and distance change via MQTT works great! But some of my devices are placed in not so easy to access places.
So it would be great to have the possibility to update via OTA. Would this be possible?

WiFi pins to BSSID, not SSID, which can result in poor connectivity

Describe the bug

When configuring Wifi, ESPresence saves the MAC address of the AP rather than the SSID. This means that in a Mesh network / multi-AP house, it's very possible to pick the wrong AP, resulting in devices having super poor connectivity despite being near an AP

To Reproduce

  1. Go to an area with more than one AP with the same SSID
  2. Pick the SSID you think is correct, but oops it's not
  3. Restart the device and check the reported RSSI, see that it is very poor

Expected behavior
The device should save SSIDs not MAC Addresses, then on boot do a scan and pick the AP that has the highest signal strength

Device won't connect to wifi resets every time its rebooted.

Flashing the esp32 is successful and it loads the AP to connect to for initial setup. (wifi, MQTT) When you click save the web page reloads with the wifi password censored, but it does not connect to the network. Clicking restart device just restarts it and it loads back up as if it had just been flashed. I have tried with two different wifi networks as one is a mesh network and somethings just don't like it.

The only thing that I could see being the problem is that I am using an ESP32S CAM dev board, and I'm not sure if espresence is supported. (Waiting on different ESP32s just using CAM to test in the mean time)
I have tried two different ESP32S Cam boards.

There is one error that pops up in my serial monitor which seems to be related to the webserver so I have been assuming that it is not the cause of my problems.

ets Jun 8 2016 00:22:57

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:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
⸮Resetting back to defaults...
Connecting to WiFi (CC:50:E3:94:ED:18)...
First contact!

Starting access point for configuration portal.
SSID: 'espresense-18ed94'
192.168.4.1
[E][WebServer.cpp:633] _handleRequest(): request handler not found
[E][WebServer.cpp:633] _handleRequest(): request handler not found
6 WiFi networks found.
[E][WebServer.cpp:633] _handleRequest(): request handler not found
[E][WebServer.cpp:633] _handleRequest(): request handler not found
6 WiFi networks found.
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_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:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
Resetting back to defaults...
Connecting to WiFi (CC:50:E3:94:ED:18)...
First contact!

Starting access point for configuration portal.
SSID: 'espresense-18ed94'
192.168.4.1

[Enhancement] - turn off onboard leds

Hi,

having these around the house is awesome! Thank you.
In my case, I use wemos ESP32, and would be great if we could disable the onboard leds to make it more discreet.

Thank you for the great job!

Samsung devices use randomized MAC addresses

Describe the bug
Most newer Samsung devices (Galaxy Watch 4, >= S20) use MAC randomization. On the phone this is possible to disable but the watch it is not. Because of d1dea7d, Samsung now has a special case that explicitly uses the full MAC address, which isn't usable

Expected behavior
Falling back to the md: behavior seems to work here

Logs

This is what happens when you toggle phone Bluetooth, causing the watch to send extra BLE beacon packets for Where's My Watch - note that I only have a Samsung watch and phone, but there are many "unique" devices here

0 New   | MAC: 423f56761895, ID: samsung:423f56761895                              
0 New   | MAC: 69f5dbb6b778, ID: 69f5dbb6b778                                      
0 New   | MAC: 4dd23e16a05b, ID: samsung:4dd23e16a05b                              
0 New   | MAC: 5bafc8f35db6, ID: samsung:5bafc8f35db6                              
0 New   | MAC: 5eacd1360037, ID: 5eacd1360037                                      
0 New   | MAC: 632c7b56e42a, ID: samsung:632c7b56e42a                              
0 New   | MAC: 7ac064bc93ab, ID: samsung:7ac064bc93ab                              
0 New   | MAC: 4ded93c18123, ID: samsung:4ded93c18123                              
0 New   | MAC: 453f40f1a6ff, ID: samsung:453f40f1a6ff 

Hardware Details
Galaxy Watch 4

Manual installation docs?

I wonder, could we get manual installation instructions somewhere?

I just stumbled upon this project and would like to give it a spin, been searching for a solution like this for ages (can't dedicate multiple RasPis to the task etc.etc...)

So, my problem is that i neither run Google Chrome nor Microsoft Edge but could flash an ESP32 with esptool or similar...

Thank you for your consideration & your hard work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.