This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let widget = await createWidget(); | |
if (!config.runsInWidget) { | |
await widget.presentSmall(); | |
} | |
Script.setWidget(widget); | |
Script.complete(); | |
async function createWidget(items) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dateutil import parser, tz | |
from datetime import datetime, timezone | |
MAX_TIME_RANGE = 12 * 60 # how many minutes in the future to look at forecasts | |
BATTERY_CAPACITY = 82 # kWh - Tesla Model 3 Performance (2021) | |
CHARGE_RATE = 11 # kWh - Gen 3 Wall Connector (3 Phase 16A) | |
LOCAL_TZ = tz.gettz('Australia/Sydney') | |
def get_price_forecast(): |