public async Task PublishDiscoveryConfig(string zoneName, string zoneId, string manufacturer, string model, string version) { var topic = $"{_settings.MqttDiscoveryPrefix}/climate/{zoneId}/config"; var disco = new DiscoveryObject(zoneName, zoneId, _settings.MqttPrefix, manufacturer, model, version); await Publish(topic, JsonConvert.SerializeObject(disco)); }
/// <summary> ///Browses for servers a computer. /// </summary> /// <param name="shallowBrowse">if set to <c>true</c> stop browsing at this level, go to leaves otherwise.</param> protected override void BranchBrowse() { try { // find the servers. global::Opc.Server[] servers = DiscoveryObject.GetAvailableServers(this.DefaultSpecification, this.Text, this.ConnectDataObject); // add children. if (servers == null) { return; } foreach (global::Opc.Server server in servers) { new OPCBrowseServer((Server)Factory.GetServerForURL(server.Url, DefaultSpecification), this); server.Dispose(); } } catch (Exception e) { MessageBox.Show(e.Message); } }