I am 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 am 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 mine - are logged into the router, the TV is on, if not, the TV is off. So, to recap, 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, respectively, it should be automatically turned OFF at 11PM.

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

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

Thanks in advance!

  • before you even start thinking about your project, make sure that the RPi is able to control the TV via CEC
    – jsotola
    Aug 8 '20 at 16:15
  • @jsotola thats working fine, I tried that :) The Pi is definetely able to turn the TV on and off via command line :)
    – nameless
    Aug 8 '20 at 16:21
  • then start with the cron job ... that is separate from the cellphone detection anyway ... work your way through the project one step at a time
    – jsotola
    Aug 8 '20 at 16:26
  • the router may respond to UPnP queries for a list of connected devices ... otherwise you may have to scrape the router's setup webpage
    – jsotola
    Aug 8 '20 at 16:33
  • yeah, cron job and basic things are working and I know how to deal with it... Just don't know how to go on... Also thought about somehow connecting the raspy with my Alexa and then being able to automate it with alexa, don't know if this'd be easier...might check on the UPnP thing
    – nameless
    Aug 8 '20 at 17:05

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-addresses. If one of the two is online, TV should be turned on. If both are offline, TV should be turned off.

  • Please accept this as the answer, in order to help others who read the question in future. Oct 20 '20 at 8:35

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.