renyuneyun / Easer

User-defined explicit automation for Android
https://renyuneyun.github.io/Easer/
GNU General Public License v3.0
805 stars 92 forks source link

[temp solved] LineageOS 18.1 Event Wi-Fi Connection on connect not working (Update on 19.1 too). #430

Open vsatmydynipnet opened 2 years ago

vsatmydynipnet commented 2 years ago

Describe the bug I have setup an event to start openvpn and switch owntrack recording mode if leaving home WLAN. this works fine on my Samsung A5 2017 / LineageOS 18.1 (Setup was baed on this tutorial https://kmj.at/en/Easer_Smartphone_Automation_for_LineageOS_and_Android_Example_for_OpenVPN_%20SIP_Softphone_Nexttracks_Owntracks/ ).

Now I got a new Fairphone 3+ and setup things in the same way. For whatever reason, leaving the home wlan is detected as usual, but coming home WLAN connection is not detected and openvpn and owntracks continues to run.

If I click the reload button on the overview page, WLAN is detected and openvpn is stopped, owntrack mode set to manual.

So the error is that when coming home, the wlan connection, which happens and the device is successfully connect, but Easer does not see connection happens and run the actions by itself.

To Reproduce Hard to say, my Samsung does it the FP3+ does not do it

Additional context Device FP3+ OS LineageOS 18.1, no Gapps Version is 8.2.2-beta from F-Droid

Currently can leave with it, because it detects when i move out, but manual action coming home is kinda annoying, especially where some areas at home has no WLAN, so need to switch back manually, even if i do not leave the house.

Any idea is greatly appreciated.

vsatmydynipnet commented 2 years ago

I am one step ahead now:

renyuneyun commented 2 years ago

Hi. Thanks for the bug report. Could I check if you have disabled "battery optimization" for Easer in your system setting? This seems to be similar to (the comments in) #377.

vsatmydynipnet commented 2 years ago

Good afternoon, yes Battery Optimization is disabled. I think i definitely tried everything I found, also in #377. The same setup works on Samsung A5 2017 LineageOS 18.1 noGapps. I have installed all apps in the same way on the FP3+ and everything works fine, root is working too.

Only Easer must be in the foreground then all is working too. As soon as locked, or even unlocked, but not in the forground, Easer only does leaving home (Start OpenVPN, Set Owntracks to move mode.). Coming home should stop OpenVPN and switch Owntracks to Manual mode, but this does not work if not in the foreground.

renyuneyun commented 2 years ago

That is interesting to see two phones with (supposedly) the same ROM version have different behaviours. Could you first try v0.8.2.3-beta2 and see if this still exists?

If not, I have a guess related to foreground services -- not the logic, but a missing line in the AndroidManifest.xml. The next beta release should contain a fix to that, so you may have a try again and see if the issue you are facing is fixed.

vsatmydynipnet commented 2 years ago

I am already on y v0.8.2.3-beta2. Whenever you have a apk let me know, will try it on the FP3+. Thank you for your work.

renyuneyun commented 2 years ago

Thanks. I uploaded the release to https://github.com/renyuneyun/Easer/releases/tag/v0.8.3-beta? If you have time, could you have a try and report back?

vsatmydynipnet commented 2 years ago

Thank you! I already installed it and will test it later today. First difference I see is, that notifications are not more shown up under quiert. Will report back later.

vsatmydynipnet commented 2 years ago

After using it today I have to state, that the situation is the same as before. Leaving the house, starting OpenVPN + Set Owntracks to Move mode works, coming home it looks like it is ignoring the Connection to Home WiFi SID.

helge42 commented 2 years ago

Same here. Xperia XA with LineageOS 18.1 with microg.

vsatmydynipnet commented 2 years ago

This comes out as really bad bug. It happens often that, for whatever reason, the fp3+ stops wifi during the night, then easer switches owntracks to move mode and drains the battery, so that in the morning in am on 5-8%. :-( because of not switching back after wifi is active again, i can not do anything......

Hopefully there is a solution soon

vsatmydynipnet commented 2 years ago

UPDATE: I dirty flashed LOS 19.1 over my 18.1 FP3+ (No Gapps, rooted with Magisk).

The Problem still exists here. Leaving the WiFi works great, reconnecting is ignored. :-(

vsatmydynipnet commented 2 years ago

I temporary was able to solve the WiFi stuff using condition

Connected -> [X] Mobile and reverse (not connected mobile) when being home using the Wifi.

That way I am back to be able to trust phone operations. I know this works only for people like me never using public hotspots and other connection, except WiFi home and Mobile if not at home. So a WiFi fix would be great.