|
| 1 | +Getting started with PSWattTime |
| 2 | +=============================== |
| 3 | + |
| 4 | +Steps for using the module in PowerShell |
| 5 | +---------------------------------------- |
| 6 | + |
| 7 | +To get started with this module you will need an account on |
| 8 | +[WattTime](https://www.watttime.org/). See |
| 9 | +[the manual](https://www.watttime.org/api-documentation/#register-new-user) |
| 10 | +on registering an account. The module provides a function `New-WattTimeAccount` |
| 11 | +to create an account if you do not yet have one. |
| 12 | + |
| 13 | +You will also need the _Az.Resources_ PowerShell Module for Azure installed |
| 14 | +and connected to your Azure account. See |
| 15 | +[the installation manual](https://learn.microsoft.com/en-us/powershell/azure/install-az-ps) |
| 16 | +for the _Az_ module for instructions. |
| 17 | + |
| 18 | +To install the module from the [PowerShell Gallery](https://www.powershellgallery.com/packages/PSWattTime/). |
| 19 | + |
| 20 | +```powershell |
| 21 | +Install-Module -Name PSWattTime |
| 22 | +``` |
| 23 | + |
| 24 | +To register an account with _WattTime_: |
| 25 | + |
| 26 | +```powershell |
| 27 | +New-WattTimeAccount -Username <YOUR_USERNAME> ` |
| 28 | + -Password '<YOUR_PASSWORD>' ` |
| 29 | + -Email '<you@domain.com>' ` |
| 30 | + -Organization <YOUR_ORGANIZATION> |
| 31 | +``` |
| 32 | + |
| 33 | + |
| 34 | +Authenticate to the _WattTime_ API: |
| 35 | + |
| 36 | +```powershell |
| 37 | + $token = Get-WattTimeAuthToken -Username '<YOUR_WATTTIME_USERNAME>' ` |
| 38 | + -Password '<YOUR_WATTTIME_PASSWORD>' |
| 39 | +``` |
| 40 | + |
| 41 | +Get current percentage of energy with emissions the 'westeurope' Azure region: |
| 42 | + |
| 43 | +```powershell |
| 44 | +PS C:\> Get-WattTimeForAzureRegion -Region westeurope -AuthToken $token |
| 45 | +
|
| 46 | +ba : NL |
| 47 | +freq : 300 |
| 48 | +percent : 94 |
| 49 | +point_time : 5-3-2023 13:15:00 |
| 50 | +region : westeurope |
| 51 | +
|
| 52 | +``` |
| 53 | + |
| 54 | +Determine the lowest emissions for the list of northeurope, |
| 55 | +westeurope, francecentral and uksouth Azure regions: |
| 56 | + |
| 57 | +```powershell |
| 58 | +PS C:\> Get-AzureRegionWithLowestWattTime -Regions westeurope,uksouth,northeurope,francecentral -AuthToken $token |
| 59 | +
|
| 60 | +ba : IE |
| 61 | +freq : 300 |
| 62 | +percent : 69 |
| 63 | +point_time : 5-3-2023 14:15:00 |
| 64 | +region : northeurope |
| 65 | +
|
| 66 | +``` |
| 67 | + |
| 68 | +### Module Functions |
| 69 | + |
| 70 | +- [ConvertFrom-AzureRegion](docs/ConvertFrom-AzureRegion.md) |
| 71 | +- [Get-AzureRegionWithLowestWattTime](docs/Get-AzureRegionWithLowestWattTime.md) |
| 72 | +- [Get-WattTime](docs/Get-WattTime.md) |
| 73 | +- [Get-WattTimeAuthToken](docs/Get-WattTimeAuthToken.md) |
| 74 | +- [Get-WattTimeForAzureRegion](docs/Get-WattTimeForAzureRegion.md) |
| 75 | +- [New-WattTimeAccount](docs/New-WattTimeAccount.md) |
0 commit comments