probonopd / ESP8266HueEmulator

Emulate a Philips Hue bridge running on an ESP8266 using the Arduino IDE.
MIT License
411 stars 93 forks source link

Use real time and timezones #9

Closed probonopd closed 7 years ago

probonopd commented 9 years ago

The original bridge has real time clock information and knows about timezones, allowing for timed events. Maybe we could use https://github.com/JChristensen/Timezone to do the same.

probonopd commented 7 years ago

This is needed e.g., for wake up timers which can be set from the app.

ensonic commented 7 years ago

Woulnd't it be easier to use https://nodemcu.readthedocs.io/en/master/en/modules/sntp/

probonopd commented 7 years ago

Yes, if you assume there is Internet connectivity.

ensonic commented 7 years ago

Sorry for the noise, this was a js library. I'll try https://github.com/gmag11/NtpClient and send a PR.

ensonic commented 7 years ago

I have added NTP support and now send the time with the config request. I am testing with the All4Hue android app and it does not warning about this anymore. For the timezone, we need to send a block like:

"timezone": "Europe/London",

with the config. Since the time is sent as utc localtime, we could also hardcode the timezone for now.

Apps like All4Hue can set the timezone on the bridge and once we have #53 fixed, we can store it and use it to correct the localtime. Does that make sense?

probonopd commented 7 years ago

Yes, PRs highly appreciated.