Skip to content

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

Notifications You must be signed in to change notification settings

dannyjiustian/PLN-METER-TOKEN-STS-PREPAID-JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STS kWh Meter Simulation

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.

Inspiration and References

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.

Acknowledgements

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.

References Links

Purpose

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

Screenshots

Start Program
Screenshot when the program is first run.

image
Screenshot when the program runs to create 20 digit tokens.

Demo

demo.mp4

Usage Instructions

To get started, follow these steps:

Install Dependencies

Begin by installing the required packages. Open your terminal and run the following command:

npm install

Run the Application

After the installation is complete, you can launch the application using this command:

npm start

Alternative Options for Running the Application

1. Running a Shell Script on Linux/macOS

To execute the application on Linux or macOS using a shell script, follow these steps:

  1. Navigate to the Directory:
    • Change to the directory containing start.sh by running:
    cd v2.0/
  2. Make the Script Executable:
    • In your terminal, ensure the script is executable by running:
      chmod +x start.sh
  3. Execute the Script:
    • Finally, run the script in your terminal with:
      ./start.sh

2. Running a Batch File on Windows

To execute the application on Windows using a batch file, follow these steps:

  1. 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

Information v2.0

Usage Instructions

  1. 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.
  2. 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.
  3. 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.
  4. Help

    • Description: Provides detailed usage instructions for each menu option.
  5. About

    • Description: Displays program details and acknowledgments.
  6. Exit

    • Description: Exits the program.

Tech Stack

Language: JavaScript

Server: NodeJS

Versions

v2.0

New Features

  • 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

Note

To use this version, run npm install in the v2.0 folder.


v1.2

New Features

  • Changed the value of the token generator related to meter token decryption.

Note

Run npm install in the v1.2 folder.


v1.1

New Features

  • Optimized code by breaking down several functions.
  • Run all functions within a single file.

Note

Run npm install in the v1.1 folder.


v1.0

Initial Features

  • Porting code from Java to JavaScript.

Note

Run npm install in the v1.0 folder.


About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published