moritzschaefer / dachboden

lights and stuff
5 stars 3 forks source link

DHCP in Fischnetz #3

Open moritzschaefer opened 4 years ago

moritzschaefer commented 4 years ago

Fischnetz is a great idea, so I added Manta to it. It would be nice to add a DHCP (if there is none yet) to facilitate access to the Manta's UI via a domain name instead of its IP (e.g. manta.device instead of 192.168.xxx.xxx)

knorchbold commented 4 years ago

DHCP reservations (MAC <-> IP) can be made in the wifi router's web interface. Unfortunately it has no integrated DNS server, so hostnames can not be assigned. There are multiple ways to address this: You could install OpenWRT on the router (which is then another thing that someone has to maintain, so I'm against it). You could run a DNS server on another device in the network (same concern). Or - this is what I do and what I think is best - you could just use mDNS. I already use that in my projects, as it comes automatically with Arduino's OTA Library. So "Stroboter.local" or "JellyControl1.local" are already there. I don't know how well that is supported with MicroPython, but I assume it is just a few lines of code, as it is with Arduino.

moritzschaefer commented 4 years ago

Oops. I wanted to say DNS anyways. Thanks for getting that. It seems mDNS has indeed be added to micropython a few months ago (https://github.com/micropython/micropython/commit/2ccf030fd1ee7ddf7c015217c7fbc9996c735fd1). Setting the host name appropriately should be enough. I have to test it next time I'm in Berlin.