diff --git a/workflows/u/akiracraftwork/hourly_chime.schedule.yaml b/workflows/u/akiracraftwork/hourly_chime.schedule.yaml new file mode 100644 index 0000000..6d141ea --- /dev/null +++ b/workflows/u/akiracraftwork/hourly_chime.schedule.yaml @@ -0,0 +1,16 @@ +description: '' +args: {} +cron_version: v2 +email: akiracraftwork@gmail.com +enabled: true +is_flow: true +no_flow_overlap: false +on_failure_exact: false +on_failure_times: 1 +on_recovery_extra_args: {} +on_recovery_times: 1 +on_success_extra_args: {} +schedule: 0 0 12 * * * +script_path: u/akiracraftwork/hourly_chime +timezone: Asia/Tokyo +ws_error_handler_muted: false diff --git a/workflows/u/akiracraftwork/hourly_chime__flow/a.lock b/workflows/u/akiracraftwork/hourly_chime__flow/a.lock new file mode 100644 index 0000000..c24eb1c --- /dev/null +++ b/workflows/u/akiracraftwork/hourly_chime__flow/a.lock @@ -0,0 +1,5 @@ +{ + "dependencies": {} +} +//bun.lock + \ No newline at end of file diff --git a/workflows/u/akiracraftwork/hourly_chime__flow/a.ts b/workflows/u/akiracraftwork/hourly_chime__flow/a.ts new file mode 100644 index 0000000..67b6294 --- /dev/null +++ b/workflows/u/akiracraftwork/hourly_chime__flow/a.ts @@ -0,0 +1,29 @@ +export async function main( + device: string = "オフィスの右エコー", + prefix: string = "現在時刻は", + suffix: string = "です" +) { + const now = new Date(); + const hhmm = new Intl.DateTimeFormat("ja-JP", { + timeZone: "Asia/Tokyo", + hour: "2-digit", + minute: "2-digit", + hour12: false, + }).format(now); // 例: 09:30 + + const [h, m] = hhmm.split(":"); + const text = `${prefix}${Number(h)}時${Number(m)}分${suffix}`; + + const res = await fetch("http://alexa_api:3500/speak", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ device, text }), + }); + + if (!res.ok) { + const body = await res.text(); + throw new Error(`alexa-api error ${res.status}: ${body}`); + } + + return { ok: true, device, text }; +} diff --git a/workflows/u/akiracraftwork/hourly_chime__flow/flow.yaml b/workflows/u/akiracraftwork/hourly_chime__flow/flow.yaml new file mode 100644 index 0000000..7a58182 --- /dev/null +++ b/workflows/u/akiracraftwork/hourly_chime__flow/flow.yaml @@ -0,0 +1,25 @@ +summary: Hourly Chime +description: '' +value: + modules: + - id: a + value: + type: rawscript + content: '!inline a.ts' + input_transforms: + device: + type: static + value: オフィスの右エコー + prefix: + type: static + value: 現在時刻は + suffix: + type: static + value: です + lock: '!inline a.lock' + language: bun +schema: + $schema: 'https://json-schema.org/draft/2020-12/schema' + type: object + properties: {} + required: [] diff --git a/workflows/wmill-lock.yaml b/workflows/wmill-lock.yaml index 203624f..05d5407 100644 --- a/workflows/wmill-lock.yaml +++ b/workflows/wmill-lock.yaml @@ -21,6 +21,8 @@ locks: g/all/setup_app__app+change_account.deno.ts: 3c592cac27e9cdab0de6ae19270bcb08c7fa54355ad05253a12de2351894346b u/admin/alexa_speak: 38de2eb567f82488e6f819c82dc7d83f41d83f015fac0c944d98dcc6b33a29a1 u/admin/hub_sync: aaf9fd803fa229f3029d1bb02bbe3cc422fce680cad39c4eec8dd1da115de102 + u/akiracraftwork/hourly_chime__flow+__flow_hash: 79974bee69ff196e45a08b74e9539d8a3b50885ef0abba6907a00530809984fa + u/akiracraftwork/hourly_chime__flow+a.ts: b27320279be1d14184a210632e15d0e89d701243545d2d73cdd20e11dd413c53 u/antigravity/git_sync__flow+__flow_hash: 5a7194ef6bf1ce5529e70ae74fdb4cd05a0da662c78bfa355bb7e98698689ae6 u/antigravity/git_sync__flow+a.sh: ac7fdc83548f305fed33389129b79439e0c40077ed39a410477c77d08dca0ca9 u/antigravity/hello_world_demo__flow+__flow_hash: 0adc341960f8196454876684f85fe14ef087ba470322d2aabc99b37bf61edac9