Project Kunigami /
OctoMeter: Empowering Smart Electricity Usage
![Codacy Grade Badge](https://github.com/camo/c965fcbdbfb28dc485d7a8576b78bf39afbe689b4e846de5e35bb31a03c4daae/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3736383631636339626138383435356439633765623161626438353662303536)
Complementary article: Releasing my First True Kotlin Multiplatform App
This is a dashboard-type app that runs on desktop (desktop-first), Android, and iOS. It implements an adaptive layout that works on mobile, tablet, and dynamic desktop window sizes. The app honours light and dark modes on all available platforms.
The main purposes of this app are:
- Compile smart meter electricity usage; estimate and project electricity usage and cost.
- Track the Agile Octopus tariff unit rates for the coming 24 hours, with countdown and automatic refresh.
- Browse available Octopus Energy tariffs.
This is a fully functional app that I developed for myself. I use it every day to monitor energy consumption and save money. For this reason, the app was intentionally built to reach production-level quality as much as possible.
- While it should technically work for some other Octopus Energy customers, I do not have enough sample data to cover all use cases.
- For non-Octopus Energy customers, or non-UK residents, the demo mode will display random meter readings and default tariff rates to illustrate the app’s functionality.
If you like this app, consider giving me a star, following me on Medium, or on LinkedIn.
- Learn more about the Agile Octopus smart tariff, or other available Octopus tariffs shown in this App.
- Switch to Octopus Energy using this link, both of us will get £50 (or £100 for business).
I use Android Studio Koala to build the Android and Deskop apps. Xcode 15.4 for iOS.
Tip
Octopus Energy/Kraken don't prefer UI-sharing. While this app is primarily designed for desktop use, it leverages CMP to provide mobile versions as well. This decision does not reflect my personal preferences; it simply reflects the budgetary constraints that prevent me from developing in SwiftUI for this project.
All downloadables are provided under the Release Section.
- MacOS Desktop App: We provide a DMG installer.
- Windows Desktop App: We provide both EXE and MSI installers.
- Android: We provide signed APK and App Bundle.
- iOS: Join as a tester at Test Flight.
- To build and run the Desktop app yourself, execute
./gradlew run
Planned enhancements are logged as issues.
Note
I am currently seeking my next Senior Android Developer role and maintaining this project at my own expense with a limited budget. Octopus Energy and Kraken HR have my CV on file. If I end up working with them, I plan to enhance this project to address a wider range of customer use cases. Otherwise, it will transition to maintenance mode once I am no longer an Octopus Energy customer.
Octopus Energy and Kraken prefer GraphQL over REST API. Accordingly, the second phase of this project has migrated several REST APIs to GraphQL. Unfortunately, not every REST API currently has an equivalent GraphQL counterpart; therefore, this app has a mixed use of both for demonstration purposes
Features | Implementation |
---|---|
Account and meters | 🕸️ GraphQL |
Products Search (by postcode) | 🕸️ GraphQL |
Tariff details | 🕸️ GraphQL |
Half-hourly tariff rates | 😴 RestAPI (Needs access to tariffs not subscribed) |
Consumptions | 😴 RestAPI (Needs server to honour query end date) |
Version 1.4.0 is the last version it contains pure Ktor-RestAPI.
This app can run under the demo mode without requiring any credentials.
To pull real smart meter data from your Octopus Energy account, you need to generate an API key for your account at https://octopus.energy/dashboard/new/accounts/personal-details/api-access. This app never asks for your Octopus customer account password, and you can always generate a new API key to invalidate the old keys.
This app stores your API key, account number, MPAN and meter serial number
using EncryptedSharedPreferences
on Android, or the Keychain on iOS. On desktop, these credentials
are currently unencrypted, but expected to do so when the library we use supports it.
-
/composeApp
is for Kotlin code shared across the Compose Multiplatform application. It contains several subfolders:commonMain
is for code that’s common for all targets.androidMain
is the traditional Android project root.desktopMain
is for the desktop (JVM) app.iosMain
is for the Kotlin code to be exposed to the iOS app.
-
/iosApp
contains the iOS application. OpenOctoMeter.xcworkspace
to build the App.
- Kermit - Apache 2.0 - A Kotlin Multiplatform logging library
- KoalaPlot - MIT - A plotting library for Kotlin Multiplatform
- AndroidX Activity Compose - Apache 2.0 - Jetpack Compose integration with Activity
- AndroidX Core Splashscreen - Apache 2.0 - Core splash screen
- AndroidX Security Crypto - Apache 2.0 - Security library for Android
- Jetpack Compose UI Tooling - Apache 2.0 - UI tooling for Jetpack Compose
- AndroidX Test Core KTX - Apache 2.0 - Core KTX library for AndroidX test
- AndroidX Room - Apache 2.0 - Room Database
- AndroidX SQLite Bundled - Apache 2.0 - Bundled SQLite for AndroidX
- Robolectric - Apache 2.0 - Unit testing framework for Android
- Ktor - Apache 2.0 - Framework for building asynchronous servers and clients in connected systems
- Kotlinx DateTime - Apache 2.0 - A multiplatform Kotlin library for working with date and time
- Kotlinx Coroutines - Apache 2.0 - Libraries for Kotlin coroutines
- Kotlinx Serialization - Apache 2.0 - Kotlin multiplatform serialization library
- Material3 Window Size Class Multiplatform - Apache 2.0 - Material Design components for Jetpack Compose
- Koin - Apache 2.0 - Dependency injection framework for Kotlin
- LeakCanary - Apache 2.0 - A memory leak detection library for Android
- Multiplatform Settings - Apache 2.0 - Multiplatform settings library for Kotlin
- Jetpack Navigation Compose - Apache 2.0 - Navigation component for Jetpack Compose
- AndroidX Lifecycle - Apache 2.0 - Lifecycles-aware components
- Theme Detector - MIT - Detect system theme (light/dark mode)
- AndroidX Test Ext JUnit - Apache 2.0 - Extensions for Android testing
- AndroidX Espresso - Apache 2.0 - UI testing framework
- AndroidX UI Automator - Apache 2.0 - UI automation testing framework
- AndroidX Benchmark - Apache 2.0 - Benchmarking library
- AndroidX Profile Installer - Apache 2.0 - Install profiles for faster startup
- SLF4J - MIT - Simple facade for logging systems
- Skiko - Apache 2.0 - Kotlin Multiplatform bindings to Skia
- Apollo GraphQL - MIT - A strongly-typed, caching GraphQL client for Android and Kotlin Multiplatform
- Android Application Plugin - Google - Plugin for building Android applications
- Android Library Plugin - Google - Plugin for building Android libraries
- KSP Plugin - Google - Kotlin Symbol Processing API
- Android Test Plugin - Google - Plugin for Android test projects
- AndroidX Room Plugin - Google - Plugin for AndroidX Room
- Jetbrains Compose Plugin - JetBrains - Plugin for Jetpack Compose
- Compose Compiler Plugin - JetBrains - Plugin for Jetpack Compose
- Kotlin Multiplatform Plugin - JetBrains - Plugin for Kotlin Multiplatform projects
- Kotlin CocoaPods Plugin - JetBrains - Plugin for integrating with CocoaPods
- Kotlin Power Assert Plugin - JetBrains - Plugin for enhanced assertions in Kotlin
- Ktlint Plugin - JLLeitschuh - Plugin for Kotlin linter
- Kover Plugin - JetBrains - Code coverage tool for Kotlin
- Serialization Plugin - JetBrains - Plugin for Kotlin serialization
- BuildConfig Plugin - gmazzo - Plugin for generating BuildConfig classes
- Baseline Profile Plugin - AndroidX - Plugin for generating baseline profiles
- Apollo GraphQL Plugin - Apollo GraphQL - Plugin for integrating Apollo GraphQL client with Android and Kotlin projects
This project is licensed under the Mozilla Public License Version 2.0 (MPL-2.0) with a non-commercial clause. See the LICENSE file for details.
Every tiny piece matters. This App contains the icons contributed by:
MIT License:
- Bootstrap Icons
- Eva Icons
- Lineicons
- Fluent UI System Icons
- Fluent UI React
- Phosphor Icons
- Tabler Icons
- akar-icons
Apache 2.0 License:
CC BY 4.0 License:
ISC License: