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
37 stars 7 forks source link

Mqtt disconnects #80

Closed Almighty1985 closed 1 year ago

Almighty1985 commented 1 year ago

Hey everyone,

I installed the App today in a Tablet mounted in a Wall near a Bluetooth Sensor and wanted to use IT to Push the Data to my mqtt Server in Home assistant.

I followed the steps for granting all rights in Android 13 plus making Sure the optinization of accu ist turned Off for the App.

My Sensor is schön in the App and I also See the Data in my Mqtt Server. But after Like 5 minutes and when the Display goes in sleep Mode, the App loses mqtt Connection and i geht No new Updates for my Sensors.

Ist there anything i could so to prevent that from Happening?

1technophile commented 1 year ago

Hello,

Thanks for your purchase! Let me see how we can help you. Could you provide the following information:

Can you confirm that these modifications have been done?

Almighty1985 commented 1 year ago

Thanks for leaving a comment. I am currently using version 1.3.2 of the app (installed it out of Google Play today) and I think I have done everything correctly. See attached screenshots (they are german though).

PXL_20230502_121704188 PXL_20230502_121708698 PXL_20230502_121727206 PXL_20230502_121801860 PXL_20230502_121808813 PXL_20230502_121819315

1technophile commented 1 year ago

Thanks for the details, give me some time to reproduce the issue and I will get back to you

Almighty1985 commented 1 year ago

If you need further details Like logs or Android Version just ask :)

1technophile commented 1 year ago

I reproduce the issue with Android 13, let me see if we can fix it ( Android is making it difficult to run BLE scan in the background)

1technophile commented 1 year ago

Do you have this setting to OFF image

Almighty1985 commented 1 year ago

As I don't have this switch I dug deeper into the system and it seems to be that my device is only Android 10 with no possibility to upgrade to a higher Android version. That seems to be maybe the issue

1technophile commented 1 year ago

Let me try to reproduce with Android 10

1technophile commented 1 year ago

Here are the settings that I propose to try with Android 10: From the Information page of the app, tap Battery-> Battery optimization->All apps, tap Theengs and select don't optimize Screen Shot 2023-05-03 at 2 06 49 PM

From the Information page of the app, tap Mobile data and wifi, switch ON the 2 buttons Screen Shot 2023-05-03 at 2 04 51 PM

And of course Location should be enabled all the time to allow BLE scanning Screen Shot 2023-05-03 at 2 11 03 PM

Screen Shot 2023-05-03 at 2 04 11 PM

Almighty1985 commented 1 year ago

I ahve everything checked as shown in the screenshots. It is working (only two sensors at the moment) as long as the tablet display is on, as soon as the display goes to sleep, the mqtt connection is disabled in the app.

1technophile commented 1 year ago

It is working (only two sensors at the moment) as long as the tablet display is on, as soon as the display goes to sleep, the mqtt connection is disabled in the app

It should reconnect automatically every X minutes, X being defined in the configuration. You may not see it as connected when you come back to the mqtt configuration in the app. Do you have a way to check the history of values, either in HA or with an MQTT client like MQTT Explorer?

1technophile commented 1 year ago

Also could you activate your location if not done already: image

Almighty1985 commented 1 year ago

I installed MQTT Explorer and I can See the Data now. I had to manually create the Sensors But now IT seems to Work. I get new Data ever 30 minutes. Thanks you very much for your Help.

1technophile commented 1 year ago

Great to hear!

If you don't mind sharing what are the appropriate settings? (I would like to add them to the documentation)

Almighty1985 commented 1 year ago

I can. What do you need to know exactly?

1technophile commented 1 year ago

Which parameters did you finally use among the ones that we discussed