public void UpdateFromSettings(AppSettings settings = null) { if (settings == null) { settings = Settings; } else { Settings = settings; } HelenApi = Factory.CreateHelenApiInterface(settings.HelenApiUrl); settings.ApiId = HelenApi.GetApiId(settings.Name, settings.ApiId); settings.BrokerUrl = HelenApi.GetBrokerUrl(settings.BrokerUrl); capabilities.Settings = settings; Messenger = Factory.CreateMessenger(settings); Probe.MeasureInterval = settings.MeasureInterval; if (Probe is Probes.LinuxTempProbe) { var lprobe = Probe as Probes.LinuxTempProbe; lprobe.OneWireDeviceName = settings.ProbeDeviceName; } ProbePublisher?.Dispose(); ProbePublisher = Messenger.GetPublisher(ProbeTopic); ConfigPublisher?.Dispose(); ConfigPublisher = Messenger.GetPublisher(ConfigTopic); ConfigPublisher.Retain = true; Messenger.ConnectionStatusChanged += (s, e) => ConfigPublisher.Publish(capabilities.Json); ConfigListener?.Dispose(); ConfigListener = Messenger.GetListener(DeviceConfigTopic); ConfigListener.MsgReceived += ConfigListener_MsgReceived; HelenApiLocationListener?.Dispose(); HelenApiLocationListener = Messenger.GetListener(HelenApi.LocationMessageTopic); HelenApiLocationListener.MsgReceived += HelenApiLocationListener_MsgReceived; ConsoleExtensions.WriteDebugLocationEnabled = settings.DebugMode; Messenger.Connect(); }