gboudreau / nest-api

Unofficial Nest Learning Thermostat API
GNU Lesser General Public License v3.0
300 stars 93 forks source link

Installation and usage instructions #112

Closed DroneMang closed 4 years ago

DroneMang commented 4 years ago

Hi, I am wondering how to actually install and use this API. Would I need to run my own web server? Does this run on my computer? I see that you have a lot of instructions but perhaps there could be a paragraph added that explains these initial steps. Please pardon my noob question. Thanks!

gboudreau commented 4 years ago

This code is PHP, so you only need PHP to make it work. It can be on a web server, or any computer that has PHP installed. You can run for example the examples.php script provided from a command prompt on your computer, after you installed PHP. Ref: https://www.php.net/manual/en/install.php For example, on Windows, you could follow those instructions. The run, from a command prompt: C:\php\php.exe C:\path\to\examples.php

vjooris commented 4 years ago

Hello, This development sounds great. But I'm NOT a developper, and so I do not know how to " You can just download nest.class.php and require/include it, or use composer: require "gboudreau/nest-api": "dev-master". "

I've already a Web Server on a Synology with a php working (see this one), my contribution is Jojo)

Thank you for your help

vjooris commented 4 years ago

ok, after many trials, I found the way to let it work. This is great ! Thank you

jluc2808 commented 4 years ago

could you tell us detail on haow you solved it ?

vjooris commented 4 years ago

In fact I didn't knew how to use that class in my own php, because I do NOT want to modify it for my own usage.

So, I create a Nest folder under my web folder. There I saved the nest.class.php In my own php (called nest.php and stored in the same folder), I add at the beginning // load specific PHP class require_once('nest.class.php');

jluc2808 commented 4 years ago

sorry, but i'm a bit lost when you said : In my own php (called nest.php and stored in the same folder), I add at the beginning // load specific PHP class require_once('nest.class.php');

you edit exemple.php to add $issueToken and $Cookies, then store as nest.php ? after that how do you start the nest.php on your syno ?

vjooris commented 4 years ago

have a look here https://github.com/vjooris/Nest-connector, you will see with I did and should understand the whole process

jluc2808 commented 4 years ago

@jojo great, i have installed all the files under /volume1/web on my syno, costumize the Nest.ini with my value But i don't find how to start the Nest.php program (which should run as daemon ?)

vjooris commented 4 years ago

http:///Nest.php

jluc2808 commented 4 years ago

yes i thought this is the way , but i get a 404 Not Found , i'm sure i register Nest.php under /volume1/web

vjooris commented 4 years ago

! this is case sensitive ! It MUST work.

jluc2808 commented 4 years ago

ok i got it !!, many thanks to @vjooris jojo but for some reason i had to make several parameters : under webstation, i had to create à virtual host, with port 81 , default profil php 5.6 (defaut profile 7.3 doesn't, work error 500), if port was left to 80/443, error 404 under security / installation / advances rules , i had to set port 8081 and 81 to available for anyone and for Nest.ini i had to rebuild the cookies with a brand fresh connection to copy again the new cookie

Now i get the value.

My question is how could i stop the browser and let the php program running without an interactive session ?

vjooris commented 4 years ago

you did a too much complicated config for me. Virtual hosts , ...??? nevertheless, this is a good new it works. If you want to keep using my php (based on this API), you do not need to let it run 24/7 on a browser. Do you understand French ? If yes, I've made a tutorial how to integrate in a domestic box : http://forum-lifedomus.com/showthread.php?tid=4673

jluc2808 commented 4 years ago

@jojo of course i understand french :) , i'm connected to LD forum (@sud-domotique-expert) go to this forum for next step

just for thoose who want explanation: the default port for web is 80, if this port is already used by another service on the same machin, then you need to set an alternate port (by exemple 81), then you have to set a virtual Host which use port 81 instead of port 80 by default. on NAS synology the firewall need to get a new rules to open port 81 to anybody.

thanks a lot