Sunday, September 6, 2020

[PROJECT] Battery Monitor v1.3

DESCRIPTION
Here you have a project to be aware of the status of the battery while charging, providing useful information in real-time and helping to protect the battery and the device itself against critical temperatures and warning you when charged at a specific level.

These are the main features:
• Real time information (notification and floating scene)
• Battery level and temperature protection (charging limits).
• Enable/disable charging in the background (charging limits). (root only)
• Solid and colored battery icon, according to the current level (%).

This is the info you will know in real time:
• Connection type (AC, USB, Wireless)
• Estimated total charging time
• Input current (mA)
• Max input from charger (mA, V, W)
• Temperature (ºC/°F)
• Voltage (V)
• Watts (W)

An 'Initial Setup' task is included, which needs to be executed on first import, regardless of whether it is imported from TaskerNet or XML.

Although the project obtains the values from the system itself, these will never reflect the accuracy of those returned by specific power meters.

Notes:
- Thanks to @AndersonMarcio, @cruzer_blaze2, @GeovanDamascenofor, @gerardo246, @MeloProfessional and @Valdorg for helping on building and testing/debugging the project.
- Here you will find the task from which the color animation feature was based on. (Credits: @MeloProfessional)
- Single click the notification to show 'Desktop View' mode.
- During the first seconds or perhaps minutes, some of the values may not appear. That's because Tasker must wait for the intent to collect all the corresponding data. If some of them remain unset for a long time, that means that your device doesn't support retrieving such information, or the project is not yet adapted for your device.
- The capacity (%) and temperature (ºC/ºF) can be used as charging limiters to protect the battery and the device itself. When a certain value (configured from 'Setup' task) is detected during charging, the device will automatically cut off the power even if the charger remains plugged in, if rooted; and, a notification (voice) will begin to warn of this situation, if not rooted.
- By default, the 'BM - Timer' profile (trigger: temperature) will check every 10 min if charging can be resumed without user interaction. Configure it according to your needs.
- The file(s) that allows cutting off the power and resuming charging in the background, if supported, must be configured for your device. Look for the actions labeled as yellow (Enable/Disable Charging) on 'BM - Collect Battery Data' task and the task linked to the 'BM - Timer' profile.
- If Tasker fails to write to the 'Enable/Disable Charging' file, try using 'chmod +rw' or a permission that works for you.
- To find the right file(s) for toggling charging in the background, if available for your device, you can try 'ACCA' app, or 'Tasker Charging Switch' project (Credits: @MeloProfessional).
- If you don't know the battery design capacity of your device you can get it using this profile.
- If you see the 'time_error' message for charging time, that means that your SDK is not the minimum required and there was an error getting mAh of your battery. So, you will need to configure the capacity from 'Setup' task, manually.
- A debug task (Debug Task) is included in case the user has problems with erroneous values or not shown. Follow the instructions inside it to know how to use it.

SCREENSHOTS


CREDITS
@SmartPhoneLover
@AndersonMarcio
@cruzer_blaze2
@GeovanDamascenofor
@gerardo246
@MeloProfessional
@Valdorg

CHANGELOG
- New: Added 'computeChargeTimeRemaining()' Java method (SDK >= 28) to calculate charge time. (if SDK < 28, auxiliary method will be used)
- New: (Desktop View), battery color animation, according to its accumulated capacity. (thanks @MeloProfessional) (configure it from 'Setup (UI)' task)
- New: Battery design capacity (mAh) is now automatically retrieved. (if it fails for whatever reason, or the value is not the right one, use the 'Setup' task to configure it manually)
- New: (Desktop View), max input from charger (mA, V, W).
- New: Added 'capacity (%)' and 'temperature (°C/°F)' as charging limits to protect battery. (configure it from 'Setup' task)
- Fix: Battery current when not in µA (default API) was displaying 1mA results. (specific devices)
- Fix: Notification not dismissed when unplugged in some cases.
- Fix: Wrong input current unit definition (mA = speed; mAh = capacity).
- Fix: Task execution collision when the 'BM - Monitor' profile was triggered many times at once (first plug in).
- Other: Re-worked 'Initial Setup' task.
- Other: (Project and Debug Task), root is not needed anymore to retrieve information from '/sys' dir.
- Other: Updated 'Debug Task' task.
- Other: Accumulated capacity (mAh) calculation is not retrieved anymore. (the values where not as accurate as decided)
- Other: Scenes adjusted to be displayed in landscape mode.
- Other: Other small changes to scenes.
- Other: Other small changes and fixes.

DOWNLOAD
Battery Monitor
Project (XML)
Project (TaskerNet)
Debug Task
Task (XML)
Task (TaskerNet)

DOWNLOAD (Ads Supported)
Battery Monitor
Project (XML)
Project (TaskerNet)

4 comments:

  1. 19.58.33/Variables doreplresult: |%BM_scene| -> |%BM_scene|
    19.58.33/Variables doreplresult: |%BM_scene| -> |%BM_scene|
    19.58.33/TD getStatic: Active load: true - ExecuteService
    19.58.33/E result: stop task (error)
    19.58.33/Variables doreplresult: |%status| -> |%status|
    19.58.33/E Error: 1
    19.58.33/MacroEdit action finished exeID 5 action no 72 code 194 status: Err next 72

    ReplyDelete
    Replies
    1. Hi, very sorry for the delay.

      Where this error comes from? Sorry, but the error output you shared above doesn't tell me anything useful.

      Delete
  2. I have BM 1.2, and installed BM 1.3. When I try to run it, it uses the tasks in BM 1.2. If I delete the whole 1.2 project, it then complains about missing tasks. Is the project file complete, or must I delete 1.2 before importing 1.3?

    ReplyDelete
    Replies
    1. Hi, sorry for the late reply.

      No, every new project version you import, you need to delete all remaining traces from previous versions, because Tasker will attempt to merge changes.

      The BM v1.3 includes all the required profiles, tasks and scenes. No need to use tasks or whatever from v1.2.

      Delete