theengs / app

Theengs mobile application to read BLE sensors and push data to an MQTT broker
https://app.theengs.io
GNU General Public License v3.0
38 stars 6 forks source link

Android app does not send data over mqtt integration #57

Closed Davasny closed 1 year ago

Davasny commented 1 year ago

Describe the bug I bought the android application to send data from my LYWSD03MMC to mqtt server but it's not happening. App has found my sensor, connected with it, connected with mqtt server and even sent data to it (home/TheengsApp/version) but it doesn't send any data from the sensor.

To Reproduce Steps to reproduce the behavior:

  1. Run app on android device
  2. Connect with LYWSD03MMC and mqtt server
  3. There is no data on mqtt server

Expected behavior Data should appear on mqtt server

Screenshots image image image image

Environment (please complete the following information):

version: 1.2
phone: Redmi Note 7, Android 10, MIUI 12.5.3
mqtt: mosquitto in docker container
mqtt client: mqtt explorer subscribed to #, $SYS/#, home/#, no authorization

Additional context Add any other context about the problem here.

1technophile commented 1 year ago

Hello,

Thanks for your support.

Did you setup the different android permission like this: https://app.theengs.io/use/use.html#android

Also, could you try with a username and password

Davasny commented 1 year ago

Yes, I did everything about permissions and batery saving.

I've also tried with setting username and password to:

But always I can see only app version in topics

Here are logs from my mosquitto container

docker logs -n 1000 mqtt | grep c5d58debb1e44d64bb25046
1670830753: New client connected from 89.70.167.125:46850 as c5d58debb1e44d64bb25046 (p2, c1, k60, u'theengs').
1670830753: Sending CONNACK to c5d58debb1e44d64bb25046 (0, 0)
1670830753: Received PUBLISH from c5d58debb1e44d64bb25046 (d0, q0, r0, m0, 'home/TheengsApp/version', ... (4 bytes))
1670830812: Received PINGREQ from c5d58debb1e44d64bb25046
1670830812: Sending PINGRESP to c5d58debb1e44d64bb25046
1670830872: Received PINGREQ from c5d58debb1e44d64bb25046
1670830872: Sending PINGRESP to c5d58debb1e44d64bb25046
1670830932: Received PINGREQ from c5d58debb1e44d64bb25046
1670830932: Sending PINGRESP to c5d58debb1e44d64bb25046
cat mosquitto.conf
listener 1883
log_type all
allow_anonymous true
password_file /mosquitto/config/password.txt
cat mosquitto_pass.conf
theengs:$7$101$Mp5ajTOLXTx3Z89n$5wAgVNTTmkdZGEJo6adLH7TZISlzabBcChRnzRVvQfhHd50FCbQzbR8BIghiTgWBZZoffhg5ZqvaH6x6KbcT+w==
Davasny commented 1 year ago

I've noticed now there could be some problem with data sync, thermometer had status "synced 35min ago" and I had to tap "update data" to get latest data but it didn't cause sending data to mqtt.

Screen is always on and phone is charging, I have enabled background updates, allowed permisions for location and set interval to 5min

emericg commented 1 year ago

Hi Davasny, The LYWSD03MMC sensor is only supported if it has a custom firmware installed. Otherwise, it's not sending updates over Bluetooth.

https://app.theengs.io/prerequisites/devices.html

Davasny commented 1 year ago

Sorry, I missed that fact :/

But if doesn't send data over BT how is it possible that application shows measurement?

emericg commented 1 year ago

The app connects to the thermometer and manually pulls data, as opposed to "simply" receiving continuously broadcasted data over BLE. At the moment, no MQTT messages are generated when connecting to a sensor.

Davasny commented 1 year ago

I see, thank you for that informations. I think information about not sending messages on manual refresh should be written somewhere in app (in mqtt integration)

Davasny commented 1 year ago

For the future: I can confirm that reflashing sensor to this FW works and I can see data on my mqtt broker

https://github.com/pvvx/ATC_MiThermometer

Thank you very much for your help @emericg and @1technophile