static void Main(string[] args) { System.Console.WriteLine("Bluewalk OpenThermGateway2MQTT Console"); System.Console.WriteLine(); try { var otgwmqtt = new OtgwMQTT(); System.Console.Write("Checking for updates ... "); var info = otgwmqtt.CheckForUpdates(); if (info?.UpdateAvailable == true) { System.Console.WriteLine("Update (v{0}) available", info.VersionPretty); System.Console.WriteLine("\t Check {0} for more information.", OtgwMQTT.ProductUrl); } else { System.Console.WriteLine("No updates are available!"); } System.Console.WriteLine(); System.Console.Write("Starting ... "); otgwmqtt.Start(); System.Console.WriteLine("Success!"); System.Console.WriteLine(); System.Console.WriteLine("\t- Now publishing OpenThermGateway data to topic: " + otgwmqtt.MQTTStatusTopic); System.Console.WriteLine("\t- Commands can be sent to topic: " + otgwmqtt.MQTTCommandTopic + "\r\n\t with the value as message data"); System.Console.WriteLine("\t- Serial commands are being forwarded to TCP port {0}, \r\n\t received data will be forwarded to the gateway", ConfigurationManager.AppSettings["OTGW_TCP_PORT"]); } catch (Exception e) { System.Console.WriteLine("Unable to start\r\n\t" + e.Message); } System.Console.WriteLine(); System.Console.WriteLine("Press CTRL+C to terminate"); }
protected override void OnStart(string[] args) { otgwmqtt = new OtgwMQTT(); otgwmqtt.Start(); }