I hope this the right place to ask this.

I'm currently working on the following project:

I'm creating a "digital dashboard", consisting of a tv and a Raspberry Pi 3B+. The tv just shows calendar, time, weather, etc..

In the tutorial I'm following for that, the creator uses a cron job to turn the tv on and off via CEC. However, he does this at a specific timeframe.

What I would like to achieve here, is that whenever one of two phones (or both) - the ones of my girlfriend and me - are logged into the router, the tv is on, if not, the tv is off, so whenever nobody is at home, the tv shouldn't be turned on / should be turned off. Also, at the night, lets say 11PM to 6AM, the tv shouldn't be on either, respecitvely, it should be automatically turned of at 11PM.

My router is a Fritz!Box 7520, just to mention that as well.

What do you think? Is this even makeable? Or am I gonna run in huge effort with high costs for this?

Thanks in advance!

  • 1
    please do not crosspost ... raspberrypi.stackexchange.com/questions/116006/… .... it is not an RPi question anyway – jsotola Aug 8 at 16:36
  • Why not just ping the MAC address of the phones using arping and react when they are found? – Andyroo Aug 9 at 4:20
  • @AndyrooI gave that a try, as its a pretty cool idea.. However, my android phone is not responding to icmp broadcast pings, which are sent out by arping.. Pinging it with the IP is working fine, pinging it with the MAC address not... I might think of just giving the phone a static IP though and then using the IP... – nameless Aug 9 at 6:42
  • @Andyroo yep, checked it.. giving the phnoes a static IP and pinging them seems to work, so I can write a little python script that pings both ips and depending on the result turns the tv on or off (or does nothing, because tv is on and phone is logged in) and then just run it with a cron... should be working :) – nameless Aug 9 at 7:00

I got it working!

It was pretty easy when you got the right idea.

I use the IP's of the phones. I configured them to be static in my network.

Then, I wrote a little python script that pings both IP-adresses. If one of the 2 is online, tv should be turned on. If both are offline, tv should be turned off.

Works like a charm! :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.