Allows my home wiz lights to be timed on and off according to a schedule.
web/web-wiz-ajax.c
- Committer:
- andrewboyson
- Date:
- 2021-05-18
- Revision:
- 5:ec0498d7d2c1
- Parent:
- 0:9af80a39adcc
File content as of revision 5:ec0498d7d2c1:
#include <stdint.h> #include <stdio.h> #include <time.h> #include "http.h" #include "wiz.h" #include "wiz-sun.h" #include "wiz-sched.h" #include "wiz-list.h" #include "clk.h" void WebWizAjax() { HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL); HttpAddNibbleAsHex(WizTrace); HttpAddChar('\n'); HttpAddChar('\f'); WizListHttp(); HttpAddChar('\f'); struct tm tmUtc; ClkNowTmUtc (&tmUtc); int minutesTodayUtc = tmUtc.tm_hour * 60 + tmUtc.tm_min; HttpAddInt32AsHex(WizSchedMinutesUtcToLocal(minutesTodayUtc)); HttpAddChar('\n'); HttpAddInt32AsHex(minutesTodayUtc); HttpAddChar('\n'); HttpAddInt32AsHex(WizSchedMinutesUtcToLocal(WizSunRiseMinutes())); HttpAddChar('\n'); HttpAddInt32AsHex(WizSchedMinutesUtcToLocal(WizSunSetMinutes())); HttpAddChar('\n'); HttpAddChar('\f'); WizSchedHttp(); }