Trigger switch/automation by public URL

Trigger automation/switch using a public URL
Here is the situation, I would like to share a public URL with a stranger which triggers a switchbot switch or automation.
am not sure whats the best and easiest way-- webhooks ifttt or a whats ur suggestions?

Note, also i dont want the stranger to connect to my wifi
Ideally clicming a link > automation triggered

I don’t have any solution, but I am looking right now for pretty much the same thing.
I was wondering if I can put a webhook on an NFC tag so any guest at my place can trigger some automation with their phone, without needing any special app (everyone has a browser on their phone).
But I still didn’t figure that out.

1 Like

Anybody found a solution ?

Just an update which would like to share,

I built this automation using IFTTT and webhooks to trigger switchbot .

Currently it does the job but i prefer having all through HA instead of using 3rd party platforms

You can do it, but for a rando to use it you’d need to use a remote URL which could leave your HA open for vulnerabilities. Plus if they save the URL then they can use it any time or place.

But if you trust them then it can be done with a hidden NFC tag and a webhook.
The way we do it here (LAN only) is with android phones and you’ll need the paid version of NFC Tools

Create the webhook as a trigger in your automation
example:

platform: webhook
id: garage-door-toggle
webhook_id: MyHAGarageDoorToggleFromNFC
allowed_methods:
  - POST
  - PUT
local_only: false

Set your action triggered by the triggerID
e.g.

choose:
  - conditions:
      - condition: trigger
        id:
          - garage-door-toggle
    sequence:
      - service: switch.toggle
        data: {}
        target:
          entity_id: switch.garage_door

You now need to write the URL to the NFC tag

To do that with NFC Tools Pro, do the following:
Tasks | Add a Task | Networks | HTTP Post

Once there you can enter in the Request field the webhook to pass to HomeAssistant
(Note: you don’t need :8123 when using external)
Format: [HomeAssistant] / [api/webhook] / [NameoftheWebHook]

Example external: http://RemoteURL.xyz/api/webhook/MyHAGarageDoorToggleFromNFC
Example local: http://homeassistant.local:8123/api/webhook/MyHAGarageDoorToggleFromNFC

Now when an outside android phone scans the NFC tag it’ll be prompted to install a (free) app called NFC Tasks. This will perform the POST request for that phone. It only prompts to install the app the first time and then it’s all seamless after that.

In our case we use NFC restricted to internal use. We have subtle NFC tags all over as a low-cost, 0 battery backup to Zigbee sensors and buttons and also so guests can do some actions even though they don’t have a HA login (they do need to be on our WiFi tho).

Hope that helps