X10 Server - IOT device to leverage a collection of old X10 devices for home automation and lighting control.

Dependencies:   IniManager mbed HTTPClient SWUpdate mbed-rtos Watchdog X10 SW_HTTPServer SW_String EthernetInterface TimeInterface SSDP

X10 Server

See the X10 Server Nodebook page

Revision:
8:a45fe77efcc5
Parent:
7:16129d213e6a
Child:
9:2c96e69b6035
--- a/main.cpp	Wed Feb 27 18:24:32 2019 +0000
+++ b/main.cpp	Sat Mar 02 23:13:58 2019 +0000
@@ -87,7 +87,8 @@
                 pc.printf("  no update available.\r\n");
                 swUpdateCheck = false;
             } else {
-                pc.printf("  update failed %04X\r\n", su);
+                pc.printf("  update failed %04X - %s\r\n", su, 
+                    SoftwareUpdateGetHTTPErrorMsg(SoftwareUpdateGetHTTPErrorCode()));
                 Thread::wait(1000);
             }
             linkdata = false;
@@ -132,6 +133,7 @@
                 ntp.set_dst(dstStart,dstStop);
             }
             ntp.set_tzo_min(tzo_min);
+            linkdata = true;
             int res = ntp.setTime(url);
             //printf("  NTP (release ethernet)\r\n");
             if (res == 0) {
@@ -141,10 +143,12 @@
                 tlast = ctTime;
                 printf("   Time set to (UTC): %s\r\n", ntp.ctime(&ctTime));
                 printf("            ntpSyncd: %s\r\n", ntp.ctime(&ntpSyncd));
+                ntpUpdateCheck = false;
             } else {
                 ntpSyncd = 0;
                 printf("Error return from setTime(%s) %d\r\n", url, res);
             }
+            linkdata = false;
         } else {
             ntpSyncd = 0;
             printf("no time server was set\r\n");
@@ -343,6 +347,7 @@
                 svr.RegisterHandler("/", RootPage);
                 svr.RegisterHandler("/info", InfoPage);
                 svr.RegisterHandler("/software", SoftwarePage);
+                svr.RegisterHandler("/reboot", RebootPage);
                 svr.RegisterHandler("/setup.xml", Setup_xml);
                 SSDP ssdp(My_Name, eth.getMACAddress(), eth.getIPAddress(), Server_Port);