Wakatime integration

Is it already possible to connect to wakatime.com and setup a beeminder with it?

2 Likes

Not yet but this one may be coming soon! Would you like to help with it?

UPDATE: wakatime integration is now live!

1 Like

I would like to help, but I have the assumption this takes more than 5 hours with my skill level of programming… therefor I think it’s better if someone with a bit more experience fixes this… But I’m eager to see if I can understand what is needed to fix this…

1 Like

@dreev I’m also in great need for this and instead of developing and hosting my own solution, it could be beneficial to contribute to the existing one, if I could have a look at other integration code.

1 Like

That would be awesome. We aspire to get this really streamlined where you can follow the template of an existing integration and have it be super straightforward. We’re not there yet but you could help us get a little closer… First step would be to sign our CLA before looking at our other official integrations: beeminder.com/cla

All the Beemind.me and Nectar integration’s are open source:

The Nectar web and mobile apps provide a framework in which developers can easily create new integrations and add metrics to the 32 existing integration providers. There are detailed instructions here (click on the third “Developers”) if you are interested.

1 Like

I said that because I’m a pythonista and if I understand correctly Beeminder is written in Ruby. I have enough commercial experience to work with virtually any common language (did a minor PHP project, lots of JS/React on the side) but I may need to see how some of the similar integrations are written not to do anything stupid.

1 Like

I hope you are cool with me reviving this :slight_smile:

What is the current state of the Wakatime integration?

Most people that want to learn to code, want to put in a certain daily programming time every day instead of focusing on for example Github commits.
Is there any other automatic way besides Wakatime to do this?

I’m just getting into programming, but would be more than happy to commit to help to develop this integration, if I can be of any use. My normal programming happens at the moment only in Python, but I guess, that learning Ruby on Rails wouldn’t hurt :slight_smile:

Edit1: Typos
Edit2: Okay, maybe I posted a little bit too fast, sorry about that. I just discovered rescue time and it should perfectly do the job. I would like to start contributing nevertheless as soon as I am able to do so @dreev talked about a streamlined way of getting involved and following a template. Is there already a guide for developers or anything like this available?

1 Like

One way would be to use RescueTime, set up to count time in your IDE or something!

2 Likes

Thank you for your response @adamwolf !
I already have everything set up :slight_smile:

1 Like

I would also love to see a Wakatime integration. They have a nice, easy to use API.

1 Like

I was about to create a new subject asking for integrating Wakatime when I saw there was one already. I think it is much better Wakatime than rescuetime, because it makes data entry automatic ! I’m also a Pythonistas and I would have loved to help, maybe I can still try to integrate it with ruby. Any advice ?

2 Likes

@mattioo What I do is use rescuetime’s “alert” function as a trigger in IFTTT to send a datapoint to Beeminder. Alternatively, Beeminder does have automated data entry for RescueTime’s usage of certain tasks including time in a certain IDE. Would that suffice for your purposes? I haven’t used Wakatime, so I don’t know what you would be missing out on if you were to use what I’ve suggested.

1 Like

For a while I used some custom python to connect wakatime with beeminder, feel free to take whatever you like:

Wakatime wrapper:

import requests
import datetime


class WakaTime:
    _key = "[your api key here]"

    def get_projects(self):
        date_string = datetime.datetime.now().strftime("%Y-%m-%d")
        base = "https://wakatime.com/api/v1/users/current/"
        endpoint = f"{base}summaries?start={date_string}&end={date_string}&api_key={self._key}"
        response = requests.get(endpoint)

        return response.json()['data'][0]['projects']

Sync job:

from pyminder.beeminder import Beeminder

from airtimer.croniter import Croniter
from airtimer.job import Job
from airtimer.python import Python
from airtimer.wakatime import WakaTime


class Script(Job):
    # Every hour
    _schedule = '0 * * * *'

    _beeminder: Beeminder
    _wakatime: WakaTime

    def __init__(
            self,
            beeminder: Beeminder,
            croniter: Croniter,
            python: Python,
            wakatime: WakaTime
    ):
        super().__init__(croniter, python)

        self._beeminder = beeminder
        self._wakatime = wakatime

    def run(self):
        projects = self._wakatime.get_projects()
        goals = self._beeminder.get_goals()
        goal_names = [g['slug'] for g in goals]
        filtered_projects = [p for p in projects if f"waka-{p['name']}" in goal_names]

        for project in filtered_projects:
            self._beeminder.create_datapoint(
                f"waka-{project['name']}",
                project['total_seconds'] / 60 / 60,
                self._python.time_now()
            )
3 Likes