Smart Home - Project and DNS question as to an upgrade

Associate
Joined
3 May 2018
Posts
604
Hi,

I have just implemented a cool little feature on my smart home setup. (It's fully DIY, no branded hub and no cloud), no Google, no EvoHome, no Alexa. Not yet anyway.

Basically the problem presented itself that I have 4 corner lights in my living room, things like floor lamps and up lighters. Turning all 4 on in the evening is a pain, turning them all off again before bed is a pain.

It struck me that if they had Wifi switches, the whole group could be switched together. Then a second light bulb moment made me realise with custom firmware on the switches they, themselves could signal the others in the group. I actually implemented it differently using a central published list of demands and a light controller that turns the group of switches on or off, but that's details.

So it all works. Short press on a switch turns that switch on/off. Long press on a switch and it turns the group on/off.

However, the switches are hardcoded with static IPs, they are also hardcoded with their group name for raising the correct demand.

For some reason the two problems companded in my head and I wondered if DCHP/DNS could fix both without having to reflash the devices to change their grouping.

A switch could connect and DHCP itself an IP. The DHCP server based only on MAC address would assign it an IP and a hostname which would denote it's group. Should the lighting controller receive a demand for a switch with a given hostname (or sub domain) it would automatically send signals to all the other members of that group registered with the DNS server.

Now I know you can have multiple records for a host, so they could all be called "grouplight.mydomain.com" and a decent DNS client can receive the multiple A records, loop through them and send an HTTP request to the switches.

I'm not sure this can be done from Python and or C++ easily though. It also has issues around DHCP and host name expiry if a give switch is out of service it's record should disappear promptly.

If switches DNS entries were indexed, like grouplight-1.domain.com, then it's not that easy for a controller to work out how many members are there in the group? Does it count to grouplight-16 before giving up? That's a lot of hanging HTTP connections waiting to timeout. (EDIT: There is always UDP, much cheaper to send a few dozen UDP packets to hosts that don't exist, but these Wifi switches can be sleepy and miss UDP).

They could be named grouplight-1-4.domain.com with this being light 1 in a group of 4.

I could still just change the hostnames for those MAC addresses on the DHCP server and power cycle the switches to update the grouping.

Thoughts?
 
Back
Top Bottom