Added Battery Notification Script#746
Conversation
| ``` | ||
| ## Run the program using command | ||
|
|
There was a problem hiding this comment.
| ``` | |
| ## Run the program using command |
Run the program using command
|
@pankaj892 the code is working fine, just a few changes in readme file |
Co-authored-by: Santushti Sharma <60578091+santushtisharma10@users.noreply.github.com>
|
@santushtisharma10 I have made the necessary changes please review them |
| @@ -93,3 +93,4 @@ | |||
| | 89\. | Voice-Assistant | Voice-Assistant Bot | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Voice-Assistant) | [Avinash .K. Rajan](https://github.com/avinashkranjan) | | |||
There was a problem hiding this comment.
remove this modification. We are looking to automate this process and therefore this updation is not needed as of now
There was a problem hiding this comment.
@kaustubhgupta as mentioned by you i have removed the modification please review and let me know if any further changes are required
| | 89\. | Voice-Assistant | Voice-Assistant Bot | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Voice-Assistant) | [Avinash .K. Rajan](https://github.com/avinashkranjan) | | ||
| | 90\. | Website-Status-Checker | This script will check the status of the web address which you will input | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Website-Status-Checker) | [Avinash .K. Rajan](https://github.com/avinashkranjan) | | ||
| | 91\. | Movie-Genre-Prediction-Chatbot | An chatbot will predict the genre of the movie based on the input text. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Movie-Genre-Prediction-Chatbot) | [Hritik Jaiswal](https://github.com/hritik5102) | | ||
| | 91\. | Movie-Genre-Prediction-Chatbot | An chatbot will predict the genre of the movie based on the input text. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Movie-Genre-Prediction-Chatbot) | [Hritik Jais |
There was a problem hiding this comment.
you have modified the file, revert all the changes in this file to normal
There was a problem hiding this comment.
@kaustubhgupta I have made the changes to the file please review
|
@pankaj892 You just added a timeout but didn't implement the logic. What you need to do is, add logic to only show notification when battery percentage changes. TO avoid the script spamming notification, add a time.sleep just before you compare the current level with the previous level. If any doubt feel free to ask |
|
@antrikshmisri I am confused as to how will i determine that there is a change in battery since when i try to measure battery after a delay i am not able to device a logic to find change.I know this doubt might seem silly.Please Help |
Let me elaborate, store the previous battery level in a variable. When the time for giving notifications comes, compare that time battery level with that variable and define a threshold for this. If the diff in battery level is less than that threshold, don't show notification else show battery status and update that variable with the current level. Dry run example: threshold = 5% time: 8:48, battery level: 45% time: 8:50, battery level: 42% time: 8:53, battery level: 39% and so on... Take the threshold value input from user before running loop |
@pankaj892 implement the algorithm as suggested by @kaustubhgupta |
|
@pankaj892 did you got my point? |
|
@kaustubhgupta I partly understood what you said. As you said I created two different variables holding current battery and battery after time.sleep but I am confused as to where should i use the while loop after comparing i should use the loop to print the battery percentage or i should start the loop before comparing itself.please help me on this? |
|
start the loop before comparing |
|
@antrikshmisri As suggested by you I have made the changes to the script please review.Also @kaustubhgupta thanks for helping |
Co-authored-by: Kaustubh Gupta <kaustubhgupta1828@gmail.com>
|
@kaustubhgupta I have made the changes as per your suggestions please review. |
Description
This script notifies the user about the battery percentage left
Fixes #727
Have you read the Contributing Guidelines on Pull Requests?
Type of change
Please delete options that are not relevant.
Checklist:
README.mdTemplate for README.md