public static YConfig <FlicPluginConfig> Init(string plugindir) { var cfgFile = Path.Combine(plugindir, "conf_file.json"); var yconfig = new YConfig <FlicPluginConfig>(cfgFile); try { if (yconfig.Retrieve(PreProccessContent: cnt => cnt.Replace("$Role$", "Local"))) { DebugEx.TraceLog("Config file found: " + cfgFile); return(yconfig); } DebugEx.TraceLog("Config retrieval failed; falling back to defaults"); } catch (Exception ex) { DebugEx.TraceLog("Loading default configuration: " + ex.Message); } //create default conf FlicPluginConfig cfg = new FlicPluginConfig(); cfg.PythonServer = "http://localhost:8080/"; cfg.restrouteremoveflic = "removeflic"; //add new active conf and save to disk yconfig.AddActiveConf("Default", cfg); yconfig.Save(); return(yconfig); }
//------------------------------------------------------------------------------------------------------------------------ public static YConfig <ZwavePluginConfig> Init(string plugindir) { var cfgFile = Path.Combine(plugindir, "conf_file.json"); var yconfig = new YConfig <ZwavePluginConfig>(cfgFile); try { if (yconfig.Retrieve(PreProccessContent: cnt => cnt.Replace("$Role$", "Local"))) { DebugEx.TraceLog("Config file found: " + cfgFile); return(yconfig); } DebugEx.TraceLog("Config retrieval failed; falling back to defaults"); } catch (Exception ex) { DebugEx.TraceLog("Loading default configuration: " + ex.Message); } //create default conf ZwavePluginConfig cfg = new ZwavePluginConfig(); cfg.SerialPort = "/dev/ttyAMA0"; cfg.OpenZWaveDirectory = "/home/pi/open-zwave1/"; //add new active conf and save to disk yconfig.AddActiveConf("Default", cfg); yconfig.Save(); return(yconfig); }
public static YConfig <GrovePiNodeConfig> Init() { var cfgFile = "conf_file.json"; var yconfig = new YConfig <GrovePiNodeConfig>(cfgFile); try { if (yconfig.Retrieve()) { Console.WriteLine("Config file found: " + cfgFile); return(yconfig); } Console.WriteLine("Config retrieval failed; falling back to defaults"); } catch (Exception ex) { Console.WriteLine("Loading default configuration"); } //create default conf GrovePiNodeConfig cfg = new GrovePiNodeConfig(); cfg.FrontendServer = "https://localhost:3334"; cfg.ApiServer = "localhost"; cfg.LocalWebServer = "http://localhost:4040"; cfg.Uuid = "1337GrovePi"; cfg.MqttBrokerHostname = "localhost"; cfg.YpchannelPort = Yodiwo.API.Plegma.Constants.YPChannelPort; cfg.MqttUseSsl = false; cfg.YpchannelSecure = false; //add new active conf and save to disk yconfig.AddActiveConf("LocalGrovePi", cfg); yconfig.Save(); return(yconfig); }
public YConfig <RaspNodeConfig> InitConfig() { var absoluteCfgFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile; var yconfig = new YConfig <RaspNodeConfig>(absoluteCfgFile); try { if (yconfig.Retrieve()) { Console.WriteLine("Config file found: {0}", absoluteCfgFile); return(yconfig); } Console.WriteLine("Config retrieval failed; falling back to defaults"); } catch (Exception ex) { Console.WriteLine("Loading default configuration"); } //create default conf RaspNodeConfig cfg = new RaspNodeConfig(); cfg.FrontendServer = "https://cyan.yodiwo.com"; cfg.ApiServer = "api.yodiwo.com"; cfg.LocalWebServer = "http://localhost:3339"; cfg.Uuid = "1337Raspberry"; cfg.MqttBrokerHostname = "api.yodiwo.com"; cfg.YpchannelPort = Yodiwo.API.Plegma.Constants.YPChannelPort; cfg.MqttUseSsl = false; cfg.YpchannelSecure = false; //add new active conf and save to disk yconfig.AddActiveConf("default", cfg); yconfig.Save(); return(yconfig); }
public static YConfig<SkyWriterNodeConfig> Init() { var cfgFile = "conf_file.json"; var yconfig = new YConfig<SkyWriterNodeConfig>(cfgFile); try { if (yconfig.Retrieve()) { Console.WriteLine("Config file found: " + cfgFile); return yconfig; } Console.WriteLine("Config retrieval failed; falling back to defaults"); } catch (Exception ex) { Console.WriteLine("Loading default configuration"); } //create default conf SkyWriterNodeConfig cfg = new SkyWriterNodeConfig(); cfg.FrontendServer = "https://localhost:3334"; cfg.ApiServer = "localhost"; cfg.LocalWebServer = "http://localhost:4050"; cfg.Uuid = "1337SkyWriter"; cfg.MqttBrokerHostname = "localhost"; cfg.YpchannelPort = Yodiwo.API.Plegma.Constants.YPChannelPort; cfg.MqttUseSsl = false; cfg.YpchannelSecure = false; //add new active conf and save to disk yconfig.AddActiveConf("LocalSkyWriter", cfg); yconfig.Save(); return yconfig; }
public YConfig <RaspPiGpioNodeConfig> InitConfig() { var absoluteCfgFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile; var yconfig = new YConfig <RaspPiGpioNodeConfig>(absoluteCfgFile); try { if (yconfig.Retrieve()) { Console.WriteLine("Config file found: {0}", absoluteCfgFile); return(yconfig); } Console.WriteLine("Config retrieval failed; falling back to defaults"); } catch { Console.WriteLine("Loading default configuration"); } //create default conf RaspPiGpioNodeConfig cfg = new RaspPiGpioNodeConfig(); cfg.FrontendServer = "https://tcyan.yodiwo.com"; cfg.ApiServer = "api.yodiwo.com"; cfg.LocalWebServer = "http://localhost:3339"; cfg.Uuid = "RaspPiGpioNode"; cfg.YpchannelPort = Constants.YPChannelPort; cfg.YpchannelSecure = true; //add new active conf and save to disk yconfig.AddActiveConf("default", cfg); yconfig.Save(); return(yconfig); }
public YConfig<RaspNodeConfig> InitConfig() { var absoluteCfgFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile; var yconfig = new YConfig<RaspNodeConfig>(absoluteCfgFile); try { if (yconfig.Retrieve()) { Console.WriteLine("Config file found: {0}", absoluteCfgFile); return yconfig; } Console.WriteLine("Config retrieval failed; falling back to defaults"); } catch (Exception ex) { Console.WriteLine("Loading default configuration"); } //create default conf RaspNodeConfig cfg = new RaspNodeConfig(); cfg.FrontendServer = "https://cyan.yodiwo.com"; cfg.ApiServer = "api.yodiwo.com"; cfg.LocalWebServer = "http://localhost:3339"; cfg.Uuid = "1337Raspberry"; cfg.MqttBrokerHostname = "api.yodiwo.com"; cfg.YpchannelPort = Yodiwo.API.Plegma.Constants.YPChannelPort; cfg.MqttUseSsl = false; cfg.YpchannelSecure = false; //add new active conf and save to disk yconfig.AddActiveConf("default", cfg); yconfig.Save(); return yconfig; }
public YConfig<RaspPiGpioNodeConfig> InitConfig() { var absoluteCfgFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile; var yconfig = new YConfig<RaspPiGpioNodeConfig>(absoluteCfgFile); try { if (yconfig.Retrieve()) { Console.WriteLine("Config file found: {0}", absoluteCfgFile); return yconfig; } Console.WriteLine("Config retrieval failed; falling back to defaults"); } catch { Console.WriteLine("Loading default configuration"); } //create default conf RaspPiGpioNodeConfig cfg = new RaspPiGpioNodeConfig(); cfg.FrontendServer = "https://tcyan.yodiwo.com"; cfg.ApiServer = "api.yodiwo.com"; cfg.LocalWebServer = "http://localhost:3339"; cfg.Uuid = "RaspPiGpioNode"; cfg.YpchannelPort = Constants.YPChannelPort; cfg.YpchannelSecure = true; //add new active conf and save to disk yconfig.AddActiveConf("default", cfg); yconfig.Save(); return yconfig; }