Alarm <alarm> goes of in <minutes> minutes with tags

Hello, I can not get this alarm card to trigger when I am using tags. If I write 1 minute in the card it works, but if I make a tag called “Duration” with a “1” then it does not work. How come?

That’s correct, it is a limitation or known issue
But probably wil not be fixed.

You could ask Athom support for it.

Well this is a major problem! How is a small bug like this not prioritized to be fixed? Where do I report a complaint?

I have an engine block heater that needs to run for a variable amount of time based on the outside temperature. So I want to set the pick up time as an alarm and have the start time be calculated based on the temperature. How do I do that if I can not set the alarm with tags, and I can not pull the DateTime value of the alarm to use in some other logic?

Not at the community… you could try https://homey.app/support/
If that gives you a good feeling.

But I guess you better work to a flow that doesn’t need this tag in the trigger.

Workaround:
I assume you already have an algorithm that calculates the number of minutes needed to preheat your engine depending on outside temperature . Let’s say X minutes.
Set an alarm ‘ time to leave home’ for the time you want to leave home.

WHEN
Alarm ‘time to leave home’ goes off in 60 minutes.
THEN
Start timer ‘preheating engine’ with runtime {{60-X}} minutes.

WHEN
Timer ‘preheating engine’ ends
THEN
Start preheating engine

1 Like

As workaround, the Timey app can trigger flows with the time set by variables/tags:

In our country we say “Where can I send an improvement proposition” instead :wink::wink:

Okey, so here’s an update on this issue. I’ve had some time to look at this during the holiday and I’ve found a solution and I’d like to share it if anyone else finds themselves in the same situation in the future.

I tried this, but it was limited to 120 minutes. Where I live it can reach -40 Celsius, with a recommended 60 minutes per -10C I needed it to go up to 240, so I couldn’t use that solution.

I looked into Timey and found it useful if I could pull the time and days of my alarms.

I don’t know how to code, so with the help of AI I made a script that pulls the time of my alarms(arg), the calculated preheat time(arg) and whether they are active today, and outputs it into tags. Then I use those tags to set the variables which I then can trigger with Timey.

I have two alarms that can trigger the same power outlet, but I chose to run both through a single script with arguments and use tags instead of setting the variables directly.

SOLUTION:

Here’s the script:

// Fix: Access the first element of the args array
const input = args[0]; 

if (!input) {
    log("Error: No arguments provided. Use format: 'Alarm Name,Offset'");
    return false;
}

// Split the string into the alarm name and the offset
const [alarmName, offsetMinutes] = input.split(',');

const alarms = await Homey.alarms.getAlarms();
const myAlarm = Object.values(alarms).find(a => a.name === alarmName);

let startTime = "00:00"; // Initialized as a String (Text)
let isScheduledToday = false; // Initialized as a Boolean (Yes/No)

if (myAlarm) {
    // 1. ALWAYS calculate the Start Time (regardless of day)
    let [h, m] = myAlarm.time.split(':').map(Number);
    let date = new Date();
    date.setHours(h, m, 0, 0);
    date.setMinutes(date.getMinutes() - parseInt(offsetMinutes));
    
    const startTime = date.getHours().toString().padStart(2, '0') + ':' + 
                      date.getMinutes().toString().padStart(2, '0');

    // 2. Check if active for TODAY
    const todayIndex = new Date().getDay();
    const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
    const currentDay = days[todayIndex];

    // Fix: Access day via the 'repetition' object
    const isDayActive = myAlarm.repetition && myAlarm.repetition[currentDay];
    const isNoneRepetition = !myAlarm.repetition || Object.keys(myAlarm.repetition).length === 0;

    isScheduledToday = myAlarm.enabled && (isDayActive || isNoneRepetition);

    // 3. EXPORT the results as Flow Tags
    await tag('PreAlarmTime', String(startTime)); 
    await tag('IsActiveToday', Boolean(isScheduledToday));
    
    log(`Sync: Start Time is ${startTime}. Active Today: ${isScheduledToday}`);
    return true;
} else {
    log(`Alarm '${alarmName}' not found.`);
    return false;
}

And here’s the flow (partially in Norwegian and English):

The Check | Motorvarmer is a variable I flip every 1 hour or 30 minutes to update the time since there is no trigger for “Alarm changed“. The reason I flip a variable is so that I can gather all my “every ## hour“ triggers in a single flow.