Skip to content

🔥New: Kotlin Multiplatform Desktop/Android/iOS Energy Tracker app

License

Notifications You must be signed in to change notification settings

ryanw-mobile/OctoMeter

Repository files navigation

Project Kunigami /
OctoMeter: Empowering Smart Electricity Usage
Gradle Build codecov

Production-grade Kotlin Multiplatform App targeting Android, iOS, Desktop


cover image


Made in the UK, For the UK.

Complementary article: Releasing my First True Kotlin Multiplatform App

This app is designed for Octopus Energy customers in the UK who have a smart meter installed. If you don’t have a smart meter, you can still try out the app. It runs in demo mode by default, showing fake user data when authentication is required.

cover image

It works for me

This is not a sample or demo app. This is a fully functional app that I developed for myself, and I use it every day to monitor energy consumption and save money. While it should technically work for other Octopus Energy customers, I can’t guarantee it will handle all scenarios such as different tariffs or multiple meter installations. These may produce data that the app cannot process.

This is a dashboard-type app that runs on desktop (desktop-first), Android, and iOS. It supports an adaptive layout that works on mobile, tablet, and dynamic desktop window sizes. The app honours light and dark modes on all supported 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.

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.

The current release meets my daily needs. However, this project will continue to be maintained and improved as a way for me to gain real-world Kotlin Multiplatform development experience. For this reason, the app was intentionally built to reach production-level quality as much as possible.

If you like this app, consider giving me a star, following me on Medium, or connecting with me on LinkedIn.

I am also looking for my next Senior Android Dev role, too.



Switch to Octopus!

  • 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).



Running the app

I use Android Studio Koala to build the Android and Deskop apps. Xcode 15.4 for iOS.

  • Android: You can download the apk from the Release Section.
  • iOS: Join as a tester at Test Flight.
  • Desktop app, to build and run, execute ./gradlew runReleaseDistrubutable or just ./gradlew run
  • To export the desktop app into MacOS distributable, execute ./gradlew packageDmg (I don't use Windows)
  • You can't export the Jar alone. To export the Jar for desktop. Jar doesn't comes with the native Skiko library so it won't run.



To-do lists

Planned enhancements are logged as issues.

Current limitations

There are the known issues to be sorted, since they are not affecting me, it will be queued to be improved later:

  • Dual-rate tariffs (day unit rate and night unit rates) are not fully-supported
  • Native iOS UI theming (reusing Android Material 3 components right now)
  • British Daylight Saving Time issues: We do not have sufficient test data yet.

Important notes regarding fixed charges, tariff rates, and cost estimation shown on the app: This app applies the current direct debit tariff to estimate past usage costs. For flexible and Agile tariffs, the current rough calculations do not produce reliable estimations. There might be multiple tariffs covering a long period as well. We need to map the consumption against the exact tariff and rates by intervals and apply the rounding rules to approximate the actual billing amount. This limitation may be addressed in 2025 when I have enough personal data for verification, but it is the limitation we have for now.



Some technical details

  • /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. Open OctoMeter.xcworkspace to build the App.

Dependencies

  • Kermit - Apache 2.0 - A Kotlin Multiplatform logging library
  • KoalaPlot - MIT - A plotting library for Kotlin Multiplatform
  • Jetpack Compose - Apache 2.0 - Modern toolkit for building native UI
  • AndroidX - Apache 2.0 - AndroidX libraries
  • Kotlinx - Apache 2.0 - Kotlin extensions and libraries
  • Ktor - Apache 2.0 - Framework for building asynchronous servers and clients in connected systems
  • Kotest - Apache 2.0 - Kotlin test framework
  • Material3 - Apache 2.0 - Material Design components
  • 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
  • Theme Detector - MIT - Detect system theme (light/dark mode)

Plugins



Data Security and Privacy

First thing first: 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.



License

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.