I made a sensor board that has light, motion, temperature and humidity sensors and IR LEDs and put one in every room. I put Sonoffs on the lights and various other devices and wrote a small managing program to coordinate the lot, so lights turn on when you walk into a dark room and turn off if there's no motion or if you turn on another light. The IR LEDs also control the TV/AC/etc.
I've also added various other things to it like Wifi presence notification, so it sends me a notification if a guest arrives, and hooked it up to Kodi and an Amazon Echo so I can say things like "play Iron Man" and it will turn on the TV, put on the movie and turn off the lights.
I used an ESP8266 with cheapo sensors, the whole board costs like $5 or something. The software is pretty ad-hoc but is not more than 100 lines of code.
I've also added various other things to it like Wifi presence notification, so it sends me a notification if a guest arrives, and hooked it up to Kodi and an Amazon Echo so I can say things like "play Iron Man" and it will turn on the TV, put on the movie and turn off the lights.
Not super useful stuff, but it was fun.