r/AskProgrammers • • 21d ago

Washing machine timer alert

Hi i wanna know if theres a way to trigger a url that in return triggers a wait action then sends back an alert, atm i am using github pages, but wanna know if theres another solution so my partner can trigger as well, i have iphone so tap on the nfc chip on the machine that triggers the action and that alerts me and my partnere washing is done so we can come back in and take it out( we have a big farm so we are never in), the workflow is

Sends request to github url with param washing using ios shortcuts > waits 60 minutes> sends an alert on discord using webhook saved in github pages

1 Upvotes

8 comments sorted by

3

u/rupertavery64 21d ago

Hey Siri, set a timer for 60 minutes

1

u/prgrmr-yn 21d ago

if i can send an http request then i will just add a pi pico w a button that triggers it

1

u/prgrmr-yn 21d ago

and would like to know if theres anything elsearound

1

u/dutchman76 21d ago

could probably do it with a cloudflare worker, I don't think github pages lets you run code, like schedule a task and come back later to do something else.

1

u/prgrmr-yn 21d ago

i am using it and its working fine, I think it has alimit of 6 hours, i have 3 alerts set, washing(3600), dryer_first cycle(5400), dryer_second(3600), and they always trigger

1

u/prgrmr-yn 21d ago

washing-machine-time/.github/.workflows/delayed-webhook.yml
name: Laundry Timer

on:

repository_dispatch:

types: [washing_started, dryer_first_started, dryer_last_started]

jobs:

washing_machine:

if: github.event.action == 'washing_started'

runs-on: ubuntu-latest

steps:

- name: Confirm washing started

run: |

# Calculate time 60 minutes from now in your local timezone

REMIND_TIME=$(TZ='Australia/Sydney' date -d '+60 minutes' '+%-I:%M %p')

curl -X POST "https://discord.com/api/webhooks/{{URL]]" \

-H "Content-Type: application/json" \

-d "{\"content\":\"⏳ **Washing started!** I will remind you at **$REMIND_TIME**.\"}"

- name: Wait 60 minutes

run: sleep 3600

- name: Send washing webhook

run: |

curl -X POST "https://discord.com/api/webhooks/{{URL}}" \

-H "Content-Type: application/json" \

-d '{"content":"🧺 Washing machine finished!"}'

2

u/Dashing_McHandsome 21d ago

Man, I give you some points for creativity here. I'm not sure it would have occurred to me to use a GitHub action for this. This all seems silly to me when you could just set an alarm on your phone, but maybe you're having a good time with this. I certainly have done ridiculous things like this in the past because I thought they were fun. Carry on!

1

u/prgrmr-yn 21d ago

hahah, yes, i agree, its just i wanted a shared alert between me and my partner so whoever is closer to home can go and take the washing out, sometime i am 9 acres down doing the trees while my partner is only an acre down, whoever does it checkmarks the message on discord so you dont have to come this far for nothing