News for hackers. Stuff that matters.
Re:Show HN: A tool to send push notifications to your phone,... by vladharbuz on Tuesday December 28, 2021 @05:54PM (#29719298)
I'm very curious if anyone knows of any software that does the opposite, i.e. running an arbitrary command on my computer when I tap a button on my phone.
Re:Show HN: A tool to send push notifications to your phone,... by binwiederhier on Tuesday December 28, 2021 @06:23PM (#29719598)
You can do this with a combination of ntfy and MacroDroid [1] or Tasker. With those apps, you can do things like "if I shake my phone, publish this message to this HTTP endpoint". And then you can subscribe to a ntfy topic via the ntfy CLI and execute a command.

Here's how you do it:

1. Install MacroDroid [1] on your phone

2. Set up an action in MacroDroid to publish a message to a ntfy topic via a HTTP GET (see [2])

3. On your computer, install the ntfy CLI and set up the ntfy-client systemd service (or use `ntfy subscribe mytopic 'echo $m'` or something similar); see instructions here: [3]

Here are some screenshots/videos of how to integrate MacroDroid and Tasker with ntfy [4]. Please note that the MacroDroid notes are a little out of date, since you can now use HTTP GET to publish messages, so you don't need to use the "Send intent" thing anymore, which means you don't need the ntfy app on your phone.

If you need more help, you can find me on Discord [4] and I'll help out.

[1] https://play.google.com/store/apps/details?id=com.arlosoft.m...

[2] https://ntfy.sh/docs/publish/#webhooks-send-via-get

[3] https://ntfy.sh/docs/subscribe/cli/#subscribe-to-multiple-to...

[4] https://ntfy.sh/docs/subscribe/phone/#integrations

[5] https://discord.gg/cT7ECsZj9w

Re:Show HN: A tool to send push notifications to your phone,... by vladharbuz on Tuesday December 28, 2021 @07:01PM (#29719875)
Thank you for the detailed suggestion! I feel like this is a good path, I'll look into it this week. :)
Re:Show HN: A tool to send push notifications to your phone,... by rwky on Tuesday December 28, 2021 @06:22PM (#29719578)
KDE Connect can do that if you happen to be using KDE as a desktop environment and an android phone

https://userbase.kde.org/KDE_Connect/Tutorials/Useful_comman...

Re:Show HN: A tool to send push notifications to your phone,... by makeworld on Tuesday December 28, 2021 @10:30PM (#29721494)
You don't need to be using KDE. Just have KDE Connect installed.
Re:Show HN: A tool to send push notifications to your phone,... by Debug_Overload on Wednesday December 29, 2021 @12:24AM (#29722188)
KDE isn't mandatory. Some distros (like ZorinOS) also have this functionality by default.
Re:Show HN: A tool to send push notifications to your phone,... by zogomoox on Tuesday December 28, 2021 @07:25PM (#29720097)
I needed something similar, a reverse 'wake-on-lan' command that shuts down or reboots systems (but could be any kind of action), so I created a telegram bot that presents the list of commands over telegram chat app. I liked that I did not have to open any ports or serve http pages, the bot is really just a script that's long polling the telegram servers via https/json.
Re:Show HN: A tool to send push notifications to your phone,... by binwiederhier on Tuesday December 28, 2021 @07:27PM (#29720119)
> long polling the telegram servers via https/json.

That's literally what the ntfy API is, too. Long polling over https, either as JSON or SSE or RAW. Dead simple: https://ntfy.sh/docs/subscribe/api/

Re:Show HN: A tool to send push notifications to your phone,... by maccard on Wednesday December 29, 2021 @06:15AM (#29723846)
It's not an out of the box solution, and only if you don't mind third party solutions, but firebase has really solid bindings on both android and in python. In less than a day I had an android app that would trigger routines via a python app listening to firebase on my workstation, and send push notifications in response when it was done.
Re:Show HN: A tool to send push notifications to your phone,... by alphabettsy on Tuesday December 28, 2021 @06:42PM (#29719724)
Not sure what your other requirements are but you could do this with a script via SSH.

Another option is to use Caddy with the Exec module with a Webhook (https://caddyserver.com/docs/modules/exec), but you’d need to use an auth plugin as well.

Re:Show HN: A tool to send push notifications to your phone,... by teeray on Tuesday December 28, 2021 @07:16PM (#29720013)
Alfred on macOS had a similar functionality at one point with Alfred Remote. I don’t know if they still do

Update: yes, still exists

Re:Show HN: A tool to send push notifications to your phone,... by yjftsjthsd-h on Wednesday December 29, 2021 @01:49AM (#29722568)
Termux with a shortcut or widget to run a script that runs SSH will do that easily if you can ssh from your phone to computer (so, same LAN or VPNed or such).