This Scriptable script creates a customizable iOS widget to display the current and next energy tariff blocks based on dynamic time-based pricing. The widget uses Apple-inspired soft color themes and provides relevant information at a glance.
- Displays the current tariff block with name, time range, and a matching color.
- Shows the next tariff block, including its start time.
- Automatically adapts to seasonal and daily variations:
- High season: November, December, January, February.
- Low season: March to October.
- Handles differences between weekdays and weekends/holidays.
- On widget tap, redirects to a specified image (e.g., tariff block overview chart).
- iOS device with Scriptable installed.
- iOS 14 or later (for widgets).
- Internet access to fetch the tariff block image (if using a URL).
- Install Scriptable from the App Store.
- Copy the script from the repository and paste it into a new Scriptable script.
- Replace the
imageUrl
variable with the URL of your desired tariff block image. - Add the script as a widget to your iOS home screen.
The script supports full customization of:
- Time blocks: Adjust the
blocks
object to match your tariff schedule. - Colors: Easily modify colors to fit your theme or preferences.
const blocks = {
highSeason: {
weekday: [
{ name: "Block 1", start: "07:00", end: "14:00", color: "#FF9500" },
{ name: "Block 1", start: "16:00", end: "20:00", color: "#FF9500" },
{ name: "Block 2", start: "06:00", end: "07:00", color: "#FFD60A" },
],
weekend: [
{ name: "Block 3", start: "00:00", end: "06:00", color: "#34C759" },
{ name: "Block 3", start: "22:00", end: "24:00", color: "#34C759" },
],
},
};
- Add the script as a medium-sized widget to your iOS home screen.
- The widget will display:
- The current block with its name and color.
- The next block and its start time.
- Tap the widget to open a URL (e.g., an overview chart or documentation).