# How can I beemind pomodoros automatically?

**URL:** <https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576>\
**Category:** Akrasia\
**Created:** [April 27, 2024, 8:40am UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576 "2024-04-27T08:40:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![johndawson](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@johndawson](https://forum.beeminder.com/u/johndawson)\
**Post date:** [April 27, 2024, 8:40am UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/1 "2024-04-27T08:40:24Z")

</div>

I beemind pomodoros. Presently I use [GNOME Pomodoro](https://gnomepomodoro.org/) to time the pomodoros and manually enter the number completed in Beeminder. I would like to automate the entry in Beeminder. Does Beeminder integrate with an application that times pomodoros, so that for each pomodoro I complete in the timing application Beeminder is automatically updated? I need an application that runs on Ubuntu (or the web), not Android or iOS.

---

<div class="post-metadata">

**Author:** ![clivemeister](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/clivemeister/32/2034_2.png) [@clivemeister](https://forum.beeminder.com/u/clivemeister)\
**Post date:** [April 28, 2024, 4:01pm UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/2 "2024-04-28T16:01:49Z")

</div>

Would Toggl Track work? There is definitely a web version, and there was once a Linux version but I think it’s deprecated (not supported) now. There is a Pomodoro mode for Toggl Track, which might work for you, depending on your exact requirements. And of course there is a Beeminder integration for Toggl, that can capture all this automatically.

---

<div class="post-metadata">

**Author:** ![johndawson](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@johndawson](https://forum.beeminder.com/u/johndawson)\
**Post date:** [May 1, 2024, 12:58pm UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/3 "2024-05-01T12:58:14Z")

</div>

Toggl Track seems a bit like overkill. Is there anything simpler?

---

<div class="post-metadata">

**Author:** ![johndawson](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@johndawson](https://forum.beeminder.com/u/johndawson)\
**Post date:** [May 1, 2024, 1:16pm UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/4 "2024-05-01T13:16:41Z")

</div>

What is the easiest way to integrate a timer (not necessarily for pomodoros) with Beeminder? I want a simple way to beemind the total number of minutes I spend on a project.

---

<div class="post-metadata">

**Author:** ![clivemeister](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/clivemeister/32/2034_2.png) [@clivemeister](https://forum.beeminder.com/u/clivemeister)\
**Post date:** [May 1, 2024, 1:25pm UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/5 "2024-05-01T13:25:57Z")

</div>

> [@johndawson](#):
>
> Toggl Track seems a bit like overkill. Is there anything simpler?

Beeminder has a straightforward API, so if you’re happy with coding you could wizz that up in a few minutes. Actually, I just asked Google’s Gemini to do it for me, and here’s what it wrote:

```auto
from datetime import timedelta
import time
from playsound import playsound # for playing sound at the end
import requests # for sending data to Beeminder

# Beeminder credentials (replace with your details)
BEEMINDER_USERNAME = "your_beeminder_username"
BEEMINDER_GOAL = "your_pomodoro_goal"
BEEMINDER_API_KEY = "your_beeminder_api_key"

# Pomodoro work and break durations (in minutes)
WORK_DURATION = 25
BREAK_DURATION = 5

def countdown(duration):
  """Counts down from the provided duration in minutes, printing to console and playing a sound at the end"""
  for remaining in range(duration, 0, -1):
    print(f"Time remaining: {remaining} minutes")
    time.sleep(60)
    # Optional: Add sleep here to slow down the counter (currently updates every 60 seconds)
  playsound("終了音.wav") # Replace with your preferred sound file

def send_to_beeminder(value):
  """Sends a datapoint to the Beeminder goal using the Beeminder API"""
  url = f"https://www.beeminder.com/api/v1/users/{BEEMINDER_USERNAME}/goals/{BEEMINDER_GOAL}/datapoints.json"
  headers = {"Authorization": f"Bearer {BEEMINDER_API_KEY}"}
  data = {"value": value}
  response = requests.post(url, headers=headers, json=data)
  if response.status_code == 200:
    print("Datapoint sent to Beeminder successfully!")
  else:
    print(f"Error sending datapoint: {response.status_code}")

while True:
  # Pomodoro work interval
  countdown(WORK_DURATION)
  print("Pomodoro complete! Take a break.")

  # Optional break timer (comment out if not desired)
  # countdown(BREAK_DURATION)

  # Send datapoint (1 for completing a pomodoro) to Beeminder
  send_to_beeminder(1)

  # Continue looping for multiple pomodoro cycles
  answer = input("Enter 'q' to quit or press any key to continue: ")
  if answer.lower() == 'q':
    break

print("Pomodoro timer stopped.")

```

It then says:

> [@](#):
>
> **Things to note:**
> 
> - Replace the placeholder values for `BEEMINDER_USERNAME`, `BEEMINDER_GOAL`, and `BEEMINDER_API_KEY` with your actual Beeminder credentials.
> - You can install the required libraries (`playsound` and `requests`) using `pip install playsound requests`.
> - The code uses a `.wav` sound file for the timer completion sound. Replace “終了音.wav” with your preferred sound file name.
> - The `countdown` function can be modified to update the timer display at a slower pace by adding a `time.sleep(1)` statement within the loop (currently updates every second).
> - The optional break timer is commented out. Uncomment the `countdown(BREAK_DURATION)` line to include a break countdown after each work interval.

So you may need to debug that, but it looks pretty straightforward.

---

<div class="post-metadata">

**Author:** ![clivemeister](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/clivemeister/32/2034_2.png) [@clivemeister](https://forum.beeminder.com/u/clivemeister)\
**Post date:** [May 1, 2024, 1:26pm UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/6 "2024-05-01T13:26:05Z")

</div>

> [@johndawson](#):
>
> What is the easiest way to integrate a timer (not necessarily for pomodoros) with Beeminder? I want a simple way to beemind the total number of minutes I spend on a project.

For that, the easiest probably _is_ Toggl Track. That’s exactly what it’s for - you click to start your work, and click to stop, and then Beeminder will pick up the total number of minutes every so often (at least once a day, and more often if you’re close to derailing).

---

<div class="post-metadata">

**Author:** ![adamwolf](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/adamwolf/32/484_2.png) [@adamwolf](https://forum.beeminder.com/u/adamwolf)\
**Post date:** [May 1, 2024, 1:36pm UTC](https://forum.beeminder.com/t/how-can-i-beemind-pomodoros-automatically/11576/7 "2024-05-01T13:36:51Z")

</div>

I know the Android Beeminder app has a built in timer!
