Battery trigger to deactivate socket

Nawepej

New member
Hey, I'd like to let my device charge overnight and I have a smart socket that can be turned on/off from smart life. I've tried deactivating it through the 'click UI action' when my battery reaches a certain percentage, but even with the 'screen on' action it cannot be done because MacroDroid can't use the UI action if the screen is locked. Anyone might know a way to achieve this?
 

dhj49er

Well-known member
Hey, I'd like to let my device charge overnight and I have a smart socket that can be turned on/off from smart life. I've tried deactivating it through the 'click UI action' when my battery reaches a certain percentage, but even with the 'screen on' action it cannot be done because MacroDroid can't use the UI action if the screen is locked. Anyone might know a way to achieve this?
What phone do you have?

The newer versions of Android stop charging at 100% and some have setting to stop at a lower preset level and some have intelligent trickle charging - all designed to help protect the battery.

The reason I mention this is it could be an alternative to using the smart plug.

However, if your phone doesn't have any of these settings or you prefer to use the smart plug, I can only offer the following, as I don't use smart devices and there may be other solutions.

To continue to use UI actions, you are correct the screen needs to be unlocked. This is possible and depend on the type of lock you are using. On my phone when fingerprint or face aren't available, swiping up allows the PIN to be input. The swipe up and PIN input can be accomplished via a macro using UI integration actions. I would recommend password protecting this macro as it contains your unlock PIN.
 

Nawepej

New member
Hey, thanks for the reply. I have a Nothing phone, and it either doesn't have that feature or I am unable to find. Of course I'd like to use an in-built feature to cut off charging, but this device does not seem to have it.
 

dhj49er

Well-known member
Hey, thanks for the reply. I have a Nothing phone, and it either doesn't have that feature or I am unable to find. Of course I'd like to use an in-built feature to cut off charging, but this device does not seem to have it.
I'm not familiar with the Nothing phone.

However, a quick Google search suggests there are battery health options, which may be similar to what I was suggesting.

Have a look in Settings>battery
 

Nawepej

New member
There is no option to cut off charging, only to 'charge steadily overnight'.
 

Attachments

  • Screenshot_20231210-145014.png
    Screenshot_20231210-145014.png
    193.3 KB · Views: 7

dhj49er

Well-known member
There is no option to cut off charging, only to 'charge steadily overnight'.
Ok

What is Adaptive battery and is it enabled?

I'm surprised you have trickle charging set if you are using a smart plug.

Off topic

I would disable sleep optimisation setting and have a macro to turn off everything late at night and another macro to turn everything back on WiFi. This will help minimise overnight battery drain.
 

MacroDroidDev

Administrator
Staff member
Does you smart charger offer any kind of interface or API. Pehaps there is an app shortcut on your device you could invoke with the Launch Shortcut action or maybe you could send an HTTP request to it to turn it off?
 

Nawepej

New member
I honestly don't know if it has an API. I don't think so, as it's controlled through the SmartLife (Tuya basically) app. I just checked the Launch Shortcut action, but the app doesn't appear there.
 

Dimlos

Well-known member
It would be difficult to find an API for this manufacturer.
Perhaps it could be operated using Google Assistant routines.
 

Nawepej

New member
This might just work. The socket is indeed linked with Google Home/Assistant, but I don't see Google Assistant as an option in the list of Macrodroid actions.
 

Nawepej

New member
Ah, I see, I was searching for it as 'assistant'. This should work, but could the action be done by 'silently' speaking the text? Otherwise it'll just wake me up if it's during sleeptime.
 

Dimlos

Well-known member
Unfortunately there does not seem to be an easy way to run it silently.
If you minimize the volume, I don't think it will disturb your sleep.
 

GiladB

Member
On Samsung devices there's a global setting that can toggle the function of battery protection which stops charging beyond 85%.
If your manufacturer added something like that, you can modify this setting without any interactions, even when screen is off.
 
Top