The Journey of Creating a Clean Energy Notification Bot on Telegram

An Open Access Journey to Empower Sustainable Energy Decisions

Saeed Misaghian
5 min readFeb 22, 2024

Introduction:

Hello everyone! For those unfamiliar with me, which I suspect includes the majority, I’ve completed my PhD in Electrical Engineering and have since been immersed in the fields of AI and Renewable Energies. My passion lies in devising innovative tools and products aimed at empowering individuals, organisations, and policymakers to make more informed and sustainable decisions. With climate change pressing on us and governments doing their part to slow its effects, there’s still a significant role for us to play. I’m a strong advocate for everyone, no matter how small their contribution might seem, to get involved. A straightforward way to contribute towards sustainable goals is by adjusting our energy consumption habits. For example, avoiding laundry during peak energy hours might seem trivial but is impactful. Why, you might wonder? It boils down to the basics of supply and demand in power systems. High demand during peak hours necessitates increased electricity generation, which in turn, means more fuel consumption, emissions, and ultimately, pollution.

Embracing a Greener Future: Our Journey towards Sustainable Development and Decarbonisation (Image created by DALLE)

I don’t want to bore you with too much detail, but here’s a thought: what if we developed a tool that, without any cost, sends people notifications about the CO2 levels in their country? Imagine getting a message like, “Hey Saeed, here’s today’s CO2 forecast. We recommend doing your laundry at 11 am and avoiding high-energy devices from 5 pm to 8 pm. Oh, and if you’ve got an electric vehicle, charging it after 10 pm would be great!” Interesting, right? My proposal is to create a bot — using Telegram, in fact — that sends users timely advice based on their country’s power system status. It could tell them the optimal times for laundry, when to dim the lights, the best moment to charge electric vehicles, or even tips on adjusting the AC or heating to save more energy. But the question remains: how do we bring this idea to life?

Overview of the Clean Energy Bot (Image created by the author)

Model Development:

Driven by curiosity, I embarked on a journey to create a bot that’s now operational on Telegram, initially focusing on Ireland’s power system status to offer targeted recommendations to its residents. The venture into the UK has already commenced, promising to extend these insights to a broader audience soon. But what’s the mechanism behind it? The image below shows the workflow, yet let me provide you with a more detailed explanation:

  1. Data Retrieval: The journey begins with a web scraper script I developed, designed to extract data from the EirGrid website. EirGrid plays a pivotal role in Ireland’s electricity system, making it a crucial data source for our application. This script gathers real-time power system information, ensuring our recommendations are both current and relevant.
  2. Data Analysis: Next, a data analysis engine springs into action, processing the data in two phases. Initially, it evaluates the CO2 forecasts against EU standards through a set of defined thresholds, categorising them into three distinct segments: low, medium, and high. This step ensures our recommendations align with regulatory benchmarks.
    Following this preliminary classification, the engine embarks on a more nuanced analysis. It normalises the data, setting a level playing field for comparison across various times and conditions. The data is then segmented based on quantiles, a statistical method that divides the dataset into equal parts, reflecting the underlying trends. This method facilitates a detailed examination of the data trends, enabling the engine to categorise the CO2 forecast into three distinct levels: low, medium, and high.
  3. Data Visualisation: With insights in hand, a data visualisation engine comes into play, transforming complex data sets into colour-coded, user-friendly visual cues. This visual representation allows users to easily discern periods throughout the day, categorised by energy consumption advisories, thereby facilitating more informed decisions regarding their energy use.
  4. Prompt Engineering: The fourth step introduces a prompt engineering engine, a system that synthesises insights from the data analysis phase with a structured response format. This engine leverages the capabilities of OpenAI’s API, specifically ChatGPT-3.5, to generate reports and actionable energy consumption advice. This blend of AI-driven analysis and natural language processing represents a significant advancement in how we communicate complex data insights.
  5. User Notification: Finally, armed with visually and textually synthesised information, the Telegram bot steps into action. It serves as the direct link between our system and the end-user, delivering notifications that not only inform them about the current CO2 status in their country but also offer practical advice on scheduling their electricity consumption tasks more efficiently.
Workflow of the Clean Energy Bot (Image created by the author)

Code Development and Model Deployment:

In this piece, I’ve chosen not to delve into the specifics of code development and the deployment process of the bot. However, for those keen on exploring these aspects further, I encourage you to visit the project repositories through the link provided below. The intricacies of model development, particularly its deployment leveraging Microsoft Azure, will be the focus of a separate blog post. This upcoming discussion aims to shed light on the technical journey behind bringing our tool to life.

GitHub Link: https://github.com/SaM-92/telegram-energy-api

Telegram Bot Address:

You can interact with the bot using the link provided below. However, it’s important to note that the EirGrid website, which is a crucial data source for our bot, often experiences downtime and can be somewhat unreliable. Consequently, if the bot fails to deliver the expected response, you might encounter a fallback message. Rest assured, I am actively working on integrating data from the UK, which has proven to be more stable and reliable. Your patience and understanding as we improve and expand the bot’s capabilities are greatly appreciated.

Link to the bot: https://t.me/tele_bot_clean_energy_bot

Contributions:

In the interim, I warmly invite contributions from a diverse array of professionals. If you’re an energy consultant, product manager, or owner brimming with ideas, I urge you not to hesitate in sharing your insights. Additionally, developers and data scientists with a passion for making a tangible impact are encouraged to join our cause. Whether you wish to discuss potential collaborations or prefer to directly engage with our project via a pull request on GitHub, your expertise and enthusiasm are greatly valued. Together, we can enhance our tool’s capabilities, broadening its impact and fostering a more sustainable future.

GitHub Link: https://github.com/SaM-92/telegram-energy-api

Conclusion:

This entire process underscores a commitment to leveraging advanced technology for environmental stewardship. By informing individuals about their energy consumption patterns in relation to broader power system dynamics, we’re not just providing a service; we’re fostering a community of informed citizens ready to make sustainable choices. This model, while currently focused on Ireland and soon the UK, holds the promise of scalability and adaptability to various regions, potentially transforming how we engage with our energy consumption on a global scale.

--

--

Saeed Misaghian

Sr. Product Developer in Digital Twins & AI with a PhD in EE. Microsoft Certified Data Scientist.