1.0.2 • Published 4 years ago

alabama-power v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

alabama-power

GitHub npm CircleCI

Unofficial Alabama Power API client library

Installation

npm i alabama-power

Usage

import AlabamaPower from 'alabama-power'

console.log('Current Alabama Power Bill\n')

const alabamaPower = new AlabamaPower()

alabamaPower.logIn('username', 'password')
	.then(() => alabamaPower.getAccountNumbers())
	.then(accountNumbers => alabamaPower.getCurrentBill(accountNumbers[0]))
	.then(currentBill => {
		const billingPeriod = currentBill.billingPeriod
		const amount = currentBill.amount
		const totalUsage = currentBill.totalUsage
		const averageDailyCost = (amount / currentBill.numberOfDaysInBillingPeriod).toFixed(2)

		console.log(`Billing Period: ${billingPeriod}`)
		console.log(`Amount: $${amount}`)
		console.log(`Total Usage: ${totalUsage} kWh`)
		console.log(`Average Daily Cost: $${averageDailyCost}\n`)
	})
	.catch(console.error)

Contributing

You will need Node. To install dependencies, move into the project folder and run

npm i

To run tests, fill out the config.json file with your Alabama Power username and password and then run

npm test
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago