Jeroen Wellner

Mobile & Web Development

Nest Hack with Synology NAS

April 17, 2013

The Nest thermostat is still not fully usable in Europe because it requires a USA/Canada zipcode. After some Internet searching, I found this great blog from Mot. He explains how you can manipulate the weather info requests by routing the requests the Nest makes to your own server.

In this blog post I will explain how I got it working using my Synology NAS. It may be useful for other people living outside the USA/Canada who want to use the Nest thermostat and also happen to have a Synology NAS.

The first step is to enable your own DNS server. On my NAS I use Dnsmasq. Dnsmasq is a lightweight DNS server. I installed it using the package manager ipkg.

ipkg install dnsmasq

By default it will use your providers DSN servers in /etc/resolv.conf to forward DNS requests.

Start dnsmasq:


Now create a new website with a custom config. This can be done by placing a host config in the directory /usr/syno/etc/sites-enabled-user.

I put mine in /usr/syno/etc/sites-enabled-user/ with the following content:

LoadModule proxy_module modules/
LoadModule proxy_http_module modules/
ProxyRequests Off
ProxyPreserveHost On
DocumentRoot "/var/services/web/"
ProxyPass /auto/nestlabs/geo/current/i !
ProxyPass /sniff.php !
ProxyPass /

For the virtualhost we proxy everything to the original IP address except for /auto/nestlabs/geo/current/i and /sniff.php. After that we rewrite the url auto/nestlabs/geo/current/i to our custom script sniff.php.

Now create the website folder /var/services/web/ on your NAS (on my NAS it is linked to a share /web). In this folder we put a file sniff.php with the following content:

$param = $_GET["query"];
if ($param == "28806") {
        $jsonData = json_decode(file_get_contents(''), true);
        $data = $jsonData["Utrecht"];
        $data["location"]["city"] = "Utrecht";
        $data["location"]["state"] = "Utrecht";
        $data["location"]["zip"] = "28806";
        $data["location"]["country"] = "US";
        $data["location"]["timezone"] = "EDT";
        $data["current"]["timezone"] = "EDT";
        $jsonData = array("28806"=>$data);
} else {
        $jsonData = json_decode(file_get_contents('' . $param));
header('Content-Type: application/json');
print stripslashes(json_encode($jsonData));

Utrecht is the city where I live. This should be replaced with your own city.

Also add the file .htaccess with the following content:

RewriteEngine On
RewriteRule ^auto/nestlabs/geo/current/i$ sniff.php [QSA]

Restart apache:

/usr/syno/etc/rc.d/ restart

Now setup your local DHCP server to use your own DNS. This will be different for each person. I use a Netgear WIFI router and put a screenshot below so you get the idea.