I have a WiFi thermostat that works fine with the request except around once a week I get this error (log file):
2017-02-07 15:02:54.7902 Error HomeAutomation.HomeGenie.Automation NetHelper Error: ConnectFailure (No route to host) Exception.StackTrace at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
The code wraps an exception check, but does not seem to work:
var ReadThermostat = new Func<dynamic>( () => {
try {
var resultJson = Net.WebService("http://"+webID+"/tstat").GetData(); // json data
return resultJson;
} catch (Exception e) {
Program.Notify("ReadThermostat:"+TTYPE+" result: ERROR", e.Message);
//Console.WriteLine(e.Message + "\n" + e.StackTrace); // test this too
return null;
}
});
Possibly the Net.WebService call does not pass back the exception?
Note: When I restart the program, everything works fine...
PS: The error in the Details section of the program is:
Runtime.Error = "CR: Cannot perform member binding on `null' value"