Page 1 of 1

Chromecast IP MAC-Adresse

Posted: 13 Jun 2018 06:37
by Jennes
Hallo Martin, hallo zusammen,

jeden Tag ab 23 Uhr wird alle 20 Minuten via Bewegungssensor geprüft, ob ich das Smartphone nochmal angefasst habe. Bin ich eingepennt, geht nach x Minuten der Fernseher via Brematic und Funksteckdose aus. Manchmal mache ich aber von selbst die Kiste aus und AM hat keine Chance zu prüfen, ob die Kiste noch an ist und der Flow mangels Notwendigkeit noch laufen soll. Mein Chromecast am Fernseher wäre für eine Prüfung die einzige Möglichkeit innerhalb des Netzwerkes - allerdings bekommt der jeden Tag eine andere IP-Adresse. Daher kann AM nicht checken, ob er noch da ist.

Wie kann ich grundsätzlich außer über die IP-Adresse herausfinden, ob ein Gerät im Netzwerk existiert/erreichbar ist? Ist es denn AM überhaupt möglich (evtl. auch über ein Plugin), eine MAC-Adresse im Netzwerk zu suchen?

Herzlichen Dank für Eure Hilfe.
VG Jennes

Re: Chromecast IP MAC-Adresse

Posted: 13 Jun 2018 17:53
by Desmanto
What is your main router which give the DHCP IP? I would say the best solution is to set your router to give a reserved IP address for the chromecast. Usually most of the modern router has DHCP reservation IP address (or Mac to IP mapping) feature to make a device with certain mac always get the same IP everytime it connects to the router. This ensure your chromecast IP address never change anymore. I use the same for my printer and lightbulb (which don't have the method to set static IP address).

If your router doesn't support it or you have no access to the router login (some ISP locked down the router), then you can use a simple execute command, ping to the broadcast address and then use arp to find the mac address and IP of the chromecast. Parse the output using regex and use the IP. Or you can install non root busybox and use its binary if you don't have them at your phone. If you have root, you can use nmap to find the IP from the mac address. But I still prefer the first solution, set the DCHP reservation IP, if possible.

Re: Chromecast IP MAC-Adresse

Posted: 16 Jun 2018 11:05
by Jennes
Vielen Dank Desmanto, habe eine alte Fritzbox und ausgerechnet dem Chromecast kann ich leider keine feste IP zuweisen, das habe ich bereits nachgeshen ...

Mit regex kenne ich mich leider nicht aus, arp -a sieht am Windows-PC super aus, doch kenne ich keinen Weg das über AM zu machen und dadurch die IP der mir bekannten MAC-Adresse zuzuordnen. Eine fertige Lösung wird es wohl nicht geben, so auf die Schnelle ...

Trotzdem danke. :-)
VG Jennes

Re: Chromecast IP MAC-Adresse

Posted: 17 Jun 2018 17:47
by Desmanto
I have been trying to get the busybox working without root, but failed in Oreo 8.1.

What phone do you use? Android Version? have root? I remember busybox no root working fine in my previous LP 5.1. If you have the busybox installed already (root or no root method), you can use the usual ping command to ping the broadcast address. Then use arp -an from busybox (usually it is not included in standard android, thus need busybox). For regex, you need to show example of the output from the arp you use. If yours is the same as mine, then this should work

Code: Select all

find = findAll(stdout, '\\? \\((.*)\\) at aa:bb:cc:dd:ee:ff \\[ether\\]  on wlan0');
ip = find[0][1];
{ip} is the ip of the chromecast, replace the mac address.

You should get the arp working first, then we can figured out the output and adjust the regex to match the IP addres you need.

Re: Chromecast IP MAC-Adresse

Posted: 08 Jul 2018 15:35
by Jennes
Hallo Desmanto,

1. What phone do you use? 2. Android Version? 3. have root?

1=Galaxy S7
2= 8.0.0
3= No

busybox ist nicht installiert und soll es auch nicht (auch wenn es möglicherweise die beste Lösung darstellt). Ich werde dieses Thema vertagen und evtl. später nochmal hervorkramen ...

Trotzdem Danke ;)