You are reading a single comment by @Ganblejs and its replies. Click here to read the full conversation.
  • I'm barely scratching the surface on knowledge of this kind of stuff, but I'm thinking it'll be far more than trivial.

    I'm not familiar with Tasker, but I can look into it and see if I can't figure something out.

  • If they managed to sync alarms from google clock to wear os

    That looks like a great starting off point! I'll look into that and see what modifications I can do.

  • Okay, so this seems like it has the basic functionality I want. Utilizing tasker and taking code from the "alarm" app, I was able to get the basics of what I want.

    I wrote a task in "tasker" (which cost $3, but I was willing to make that purchase for this), which fires when the Android clock app exits. What it does is looks for the next alarm, then writes that alarm to bangle. This is sent via Android intent. Tasks are:
    Test next alarm
    Send intent

    Send intent looks like this:
    Action: com.banglejs.uart.tx
    Extra: line:var alarm = require("sched").newDefaultAlarm();var time = require("time_utils").decodeTime(alarm.t­);var date = new Date();time.h="%na_time".substring(0,2);­time.m="%na_time".substring(3);date.setD­ate(%na_day);date.setMonth(%na_month-1);­date.setFullYear(%na_year);alarm.on=true­;alarm.t = require("time_utils").encodeTime(time); alarm.last = alarm.t < require("time_utils").getCurrentTimeMill­is() ? new Date().getDate() : 0; if(date) = date.toLocalISOString().slice(0,10);var array =[]; array[0] = alarm;require("sched").setAlarms(array);­

    The extra is a mess, so here it is more pretty:

    line: var alarm = require("sched").newDefaultAlarm();
    var time = require("time_utils").decodeTime(alarm.t­);
    var date = new Date();
    time.h = "%na_time".substring(0, 2);
    time.m = "%na_time".substring(3);
    date.setDate( % na_day);
    date.setMonth( % na_month - 1);
    date.setFullYear( % na_year);
    alarm.on = true;
    alarm.t = require("time_utils").encodeTime(time);
    alarm.last = alarm.t < require("time_utils").getCurrentTimeMill­is() ? new Date().getDate() : 0;
    if (date) = date.toLocalISOString().slice(0, 10);
    var array = [];
    array[0] = alarm;

    This is in no way elegant. It works, at least, but there are some issues I'll try to work on later.

    1. This removes literally everything set for alarms, and overwrites it with only the next set alarm from Android.
    2. It does not currently set alarms for repeat.
    3. It only sets the next alarm, ignoring any alarm after that.

    1 can probably be fixed with some more effort and if/else statements to preserve current alarms, and not set if an alarm is already on at that time. I wrote all of the above code from my phone, which is a pain, so I will look into that one later. Right now, this makes setting alarms from the watch a waste of time, since they get deleted with this currently.
    2 seems to be an issue with tasker/clock app interaction. I can't figure out how to get the repeat data into tasker. There are other clock apps that reportedly work better, but I wanted to see what I can do with the current app.
    3 also seems to be a tasker/clock app thing. Can probably write something to scrape the clock app database and see what other alarms are there. Might also help with 2. Again, don't want to do this on my phone.

    I'll work on this more in the next few days, but wanted to get this written down somewhere so I can show it's possible. If you have any pointers on the code above or my thoughts on the list items, please let me know!


Avatar for Ganblejs @Ganblejs started