OPNsense Forum

English Forums => General Discussion => Topic started by: R0yk3 on October 15, 2022, 05:18:35 PM

Title: Presence detection but different
Post by: R0yk3 on October 15, 2022, 05:18:35 PM
Hello,
I asked the same question in Dutch so i hope this does not count as crossposting. If i get the answer in Dutch i will post it here so everybody can make use of it.

The question is can opnsense give a signal if a sudden device logs in. I want a signal when my phone or my wifes phone connects to the wifi.
the signal is preferebly a webhook
when i enter this:
http://192.168.1.5/json.htm?type=command&param=switchlight&idx=1015&switchcmd=On
And when i leave this:
http://192.168.1.5/json.htm?type=command&param=switchlight&idx=1015&switchcmd=Off

Maybe you recognize the above code it is from Domoticz and it switches a viirtual switch. All local no passwords or anything needed just curl the code.
if i type:
curl 'http://192.168.1.5/json.htm?type=command&param=switchlight&idx=1015&switchcmd=On'

it actualy works. So now the trick how can i trigger the system to do this for me?

At this moment the phones get a fixed ip, but in stead of pinging i would like it the other way around.
I'm not a programmer, i'm more like a 50 year old scriptkiddie who can copy and paste code.

Thanks in advance
Title: Re: Presence detection but different
Post by: tiermutter on October 15, 2022, 05:22:41 PM
I think monit (see plugins) can manage this, but I dont know how to achieve that... Maybe this hint helps a bit...
Title: Re: Presence detection but different
Post by: R0yk3 on October 15, 2022, 05:58:19 PM
Monit wil do it i guess, but it also relies on the ping. have not found out how it maybe digs deeper into unbound an devices. But this also i 'external'
I would like a signal form unbound itself when a specific mac signs in.