Create/set alarm via flow/HomeyScript?

Is it possible to create or change an alarm from flow using HomeyScript?
I haven’t found something in the SDK yet.

await Homey.alarms.createAlarm({
  alarm: {
    id:   'my-alarm',
    name: 'My Alarm',
    time: '12:34'
  }
})

See the Web API documentation.

2 Likes

Thanks, Robert. I only looked at teh SDK, not at WebAPI.

Isn’t there a Manager.clock to read the timezone? I only have a UTC time and need to convert to local time.
In the app I use:

            let tz  = this.homey.clock.getTimezone();
            now = new Date().toLocaleString(this.homey.i18n.getLanguage(), 
            { 
                hour12: false, 
                timeZone: tz,
                hour: "2-digit",
                minute: "2-digit",
                day: "2-digit",
                month: "2-digit",
                year: "numeric"
            });
const { timezone } = await Homey.system.getInfo();

doc

3 Likes