[Help] Battery Current As Trigger?

Creeper

New member
Hello,

I need help with setting up Battery Current as Trigger for a macro I'm working on. Idk if it is possible.

So my phone has a feature called "Charge Separation" which stops charging the battery, and draws power directly from the charger and I can play games 24/7 without the battery running out.

I am using the Charge Separation feature with MacroDroid to limit charging the battery to 80% using the string from the Global Table.

The problem that I am having is, the string from the Global Table can't stop the battery from charging above 80% after 7 hours even if it is still turned ON so I always wake up with 100% battery which I don't want, to increase the battery life span.

It seems that the string from Global for Charge Separation will only prevent charging for 7 hours, so I tried using a timer to turn OFF (as it stays ON) the Charge Separation and turn it back ON so I have another 7 hours and the macro repeats so I can keep the charger plugged in as long as I want, but the charging time can't be predicted accurately. Sometimes it starts charging after 7 hours 36min, sometimes 7 hours 48 min and so on, so my macro to limit battery to 80% either triggers too early or too late and it charges to 100%.

- Charging Limit triggering too early before 7 hours 36 min = still counts under that 7 hours 36 min so battery charges to 100%

- Charging Limit triggering too late = battery already charged above 80% with Charge Separation still turned ON and it just updates the value 1 to 1 so it doesn't work.

I noticed that MacroDroid can detect the Charging Current so I want to use that as a trigger as this seems to be the only way to accurately detect it. The charging current turns "0" when I turn on Charge Separation and when it starts charging I can see the charging current.

Is there any way I can use the charging current as Trigger for my macro or is there another way? I want to keep my battery at 80%. Thanks!
 

Dm114

Well-known member
Hello,

I need help with setting up Battery Current as Trigger for a macro I'm working on. Idk if it is possible.

So my phone has a feature called "Charge Separation" which stops charging the battery, and draws power directly from the charger and I can play games 24/7 without the battery running out.

I am using the Charge Separation feature with MacroDroid to limit charging the battery to 80% using the string from the Global Table.

The problem that I am having is, the string from the Global Table can't stop the battery from charging above 80% after 7 hours even if it is still turned ON so I always wake up with 100% battery which I don't want, to increase the battery life span.

It seems that the string from Global for Charge Separation will only prevent charging for 7 hours, so I tried using a timer to turn OFF (as it stays ON) the Charge Separation and turn it back ON so I have another 7 hours and the macro repeats so I can keep the charger plugged in as long as I want, but the charging time can't be predicted accurately. Sometimes it starts charging after 7 hours 36min, sometimes 7 hours 48 min and so on, so my macro to limit battery to 80% either triggers too early or too late and it charges to 100%.

- Charging Limit triggering too early before 7 hours 36 min = still counts under that 7 hours 36 min so battery charges to 100%

- Charging Limit triggering too late = battery already charged above 80% with Charge Separation still turned ON and it just updates the value 1 to 1 so it doesn't work.

I noticed that MacroDroid can detect the Charging Current so I want to use that as a trigger as this seems to be the only way to accurately detect it. The charging current turns "0" when I turn on Charge Separation and when it starts charging I can see the charging current.

Is there any way I can use the charging current as Trigger for my macro or is there another way? I want to keep my battery at 80%. Thanks!
You can't use the Magic Text {battery_current_now} as a trigger but you can periodically set a variable with this value and use MacroDroid Variable Change trigger.
 

Creeper

New member
You can't use the Magic Text {battery_current_now} as a trigger but you can periodically set a variable with this value and use MacroDroid Variable Change trigger.
I had been trying with system settings change Magic Text as Trigger and couldn't get it working. That explains why.

I made a sample macro. Would this work? Thanks!
 

Attachments

  • Screenshot_2024-03-27-20-23-05-354.jpg
    Screenshot_2024-03-27-20-23-05-354.jpg
    489.5 KB · Views: 7

Dm114

Well-known member
I had been trying with system settings change Magic Text as Trigger and couldn't get it working. That explains why.

I made a sample macro. Would this work? Thanks!
Yes, it should work nicely except:
- Constraint Battery: use >79 instead
- How do you manage the stopwatch? Are you sure it is really useful?
- MD variable change: I'd rather select "Any change" and test the value in the macro
 

Creeper

New member
Yes, it should work nicely except:
- Constraint Battery: use >79 instead
- How do you manage the stopwatch? Are you sure it is really useful?
- MD variable change: I'd rather select "Any change" and test the value in the macro

Thanks :) The stopwatch is set to "Reset and Start" everytime the Charge Separation is turned ON so it always resets back to 0 and start over again after 7 hours.

And now that you mentioned it, I think its not useful at all here. I wanted the "Regular Interval" to trigger only after 7 hours but it seems the regular interval is trigger every 5 seconds with failed constraints in the logs even when I added the constraint. And I just remembered that the phone's older firmware had issues with charge separation where if I unlock the phone it will turn off charge separation so the stopwatch constraint would prevent it from triggering so I delete it now.

Will regular interval trigger drain battery with logging failed constraints every 5 seconds? Its logging failed constraints even when I unplug the charger and the battery is below 80%. And I can't increase the trigger above 5 seconds as I am using a Fast Charger and I want to keep at 80% battery. It only takes a few seconds to charge 1%, maybe I can increase it 10 or 15 seconds max.
 

Dm114

Well-known member
Thanks :) The stopwatch is set to "Reset and Start" everytime the Charge Separation is turned ON so it always resets back to 0 and start over again after 7 hours.

And now that you mentioned it, I think its not useful at all here. I wanted the "Regular Interval" to trigger only after 7 hours but it seems the regular interval is trigger every 5 seconds with failed constraints in the logs even when I added the constraint. And I just remembered that the phone's older firmware had issues with charge separation where if I unlock the phone it will turn off charge separation so the stopwatch constraint would prevent it from triggering so I delete it now.

Will regular interval trigger drain battery with logging failed constraints every 5 seconds? Its logging failed constraints even when I unplug the charger and the battery is below 80%. And I can't increase the trigger above 5 seconds as I am using a Fast Charger and I want to keep at 80% battery. It only takes a few seconds to charge 1%, maybe I can increase it 10 or 15 seconds max.
I would begin with 15s to 30s (minimum) and see how it works
 

Creeper

New member
I would begin with 15s to 30s (minimum) and see how it works
I think 30s might work fine with my 20W charger as I previously used to calculate the average charging duration and it takes about 36 to 51s to charge 1% battery but other users might use 80W charger or higher since the device comes with 165W charger and it won't be able to detect the charging current fast enough to trigger the charging limit with long intervals. So I am kinda leaning towards shorter intervals, or maybe I will have to make a macro to calculate average charging duration and update the trigger invterval value. I'll test it for a few days and see how it goes and report back. Thank you very much for the help :)
 
Top