1 # ESP8622 Timer w/ NTP Sync and Remote Control 2 3 The idea is to have a device that turns on and off one of it's outputs at a 4 certain time of the day, and also having the possibility to override the timer 5 and toggle the output remotely 6 7 To keep the clock synchronized the device uses the Network Time Protocol (NTP) 8 9 ## Timer Defined State and User Override State 10 11 ### Base Timer Function 12 13 If the timer is set (`timer_enabled == 1`) then after a defined amount of 14 time, the current time gets compared with the timer-set values, if the current 15 time fits inside the interval defined by the timer then the output pin 16 (`MAIN_OUTPUT_PIN`) gets pulled up and keeps in that state until the current 17 time no longer belongs to the interval or if the user manually changes the 18 output state, in which case the timer deactivates 19 20 ### User Override 21 22 If the user overrides the state of the output then the timer is deactivated 23 (`timer_enabled` is set to `0`) 24 25 ## Dependencies 26 27 The project is developed using [PlatformIO 28 Core](https://docs.platformio.org/en/latest/core/index.html) which does the 29 compiling, uploading to the board and dependency management, but the same code 30 can compiled (with some light changes) using the Arduino IDE. 31 32 ## Building and Uploading to the Board 33 34 Clone the repository and navigate to the folder 35 36 ```console 37 $ git clone https://github.com/mjkloeckner/esp8266-timer.git 38 ``` 39 40 Then install the required libraries for the project 41 42 ```console 43 $ pio pkg install 44 ``` 45 46 Compile the code 47 48 ```console 49 $ pio run 50 ``` 51 52 Or even better, if you have the board connected, compile and upload at the same 53 time 54 55 ```console 56 $ pio run -t upload 57 ``` 58 59 Finally upload the files to the filesystem of the board 60 61 ```console 62 $ pio run -t uploadfs 63 ``` 64 65 ## LICENSE 66 67 [MIT](./LICENSE)
