The Demo kWh Meter V2.0 program simulates a prepaid electricity system inspired by PLN (Perusahaan Listrik Negara) in Indonesia. Users can enter a 20-digit token to activate their electricity meter, while the program provides an accessible model to understand the system's workings.
This program builds on the foundational concepts from Mwangi Patrick's article, "Let's Demystify That 20-Digit Utility Token," and utilizes ES6 syntax for better readability. Work by Paadevelopments provided valuable code examples for similar utilities.
Special thanks to Mwangi Patrick and Paadevelopments for sharing their knowledge and providing code examples that greatly influenced this project. Their contributions to understanding the Standard Transfer Specification (STS) framework have been invaluable.
- Let's Demystify That 20-Digit Utility Token - Part 1
- Let's Demystify That 20-Digit Utility Token - Part 2
- Let's Demystify That 20-Digit Utility Token - Part 3
- STS Framework Reference
The code serves as a resource for understanding the Standard Transfer Specification (STS) meter system and can be expanded upon. Future enhancements may include:
- Improved token encryption
- Stability refinements
- Bug prevention measures
Screenshot when the program is first run.
Screenshot when the program runs to create 20 digit tokens.
demo.mp4
To get started, follow these steps:
Begin by installing the required packages. Open your terminal and run the following command:
npm install
After the installation is complete, you can launch the application using this command:
npm start
To execute the application on Linux or macOS using a shell script, follow these steps:
- Navigate to the Directory:
- Change to the directory containing start.sh by running:
cd v2.0/
- Make the Script Executable:
- In your terminal, ensure the script is executable by running:
chmod +x start.sh
- In your terminal, ensure the script is executable by running:
- Execute the Script:
- Finally, run the script in your terminal with:
./start.sh
- Finally, run the script in your terminal with:
To execute the application on Windows using a batch file, follow these steps:
- Run the File:
- You can either double-click
start.bat
to run it, or you can execute it from the Command Prompt by navigating to its directory and entering:start.bat
- You can either double-click
-
Generate New Token
- Description: Generate a 20-digit token to increase your meter's kWh balance.
- Instructions:
- Enter the 11-digit numeric meter serial number (only numbers).
- Choose the token purchase amount (Options: 1-6).
- Exit by choosing option 7.
- Example: Selecting option [1] Rp 20.000 (Total: Rp 22.500 kWh: 13.9).
- Outcome: A 20-digit token will be displayed in the format:
1111-2222-3333-4444-5555
.
-
Activate New Token
- Description: Apply a previously generated token to add kWh to your meter.
- Instructions:
- Enter the 11-digit meter serial number.
- Enter the 20-digit token.
- Outcomes:
- Success: Token successfully applied.
- Error: Incorrect serial number or token.
- Already Used: Token was used previously.
-
Check Remaining kWh
- Description: View the current kWh balance on your meter.
- Instructions:
- Enter the 11-digit meter serial number.
- The system will display the remaining kWh.
-
Help
- Description: Provides detailed usage instructions for each menu option.
-
About
- Description: Displays program details and acknowledgments.
-
Exit
- Description: Exits the program.
Language: JavaScript
Server: NodeJS
- Enhanced, interactive user experience
- Separated functions for token generation & activation
- Feature added to check remaining kWh
- Organized functions into dedicated folders
- Improved command line display
To use this version, run npm install
in the v2.0 folder.
- Changed the value of the token generator related to meter token decryption.
Run npm install
in the v1.2 folder.
- Optimized code by breaking down several functions.
- Run all functions within a single file.
Run npm install
in the v1.1 folder.
- Porting code from Java to JavaScript.
Run npm install
in the v1.0 folder.