Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion AppBroker.Zigbee2Mqtt/Zigbee2MqttDeviceBaseJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,27 @@ public JToken ConvertToBool(object v)
public class Zigbee2MqttListFeature : Zigbee2MqttGenericExposedFeature
{
[JsonProperty("item_type")]
public string ItemType { get; set; } = "number";
public ItemType ItemType { get; set; }

public Zigbee2MqttListFeature()
{
Type = Zigbee2MqttGenericFeatureType.List;
}
}

public class ItemType
{
[JsonProperty("access")]
public int Access { get; set; }
[JsonProperty("label")]
public string Label { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}


public class Zigbee2MqttNumericFeaturePreset : Zigbee2MqttDeviceBaseJson
{
[JsonProperty("name")]
Expand Down Expand Up @@ -664,6 +677,9 @@ public enum Zigbee2MqttPowerSource

[EnumMember(Value = "DC Source")]
DC,

[EnumMember(Value = "Unknown")]
Unknown,
}

public class Coordinator1 : Zigbee2MqttDeviceBaseJson
Expand Down
15 changes: 14 additions & 1 deletion AppBroker.Zigbee2Mqtt/Zigbee2MqttManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,20 @@ public async Task<IManagedMqttClient> Connect()
logger.Debug("Builded new mqtt tcp client options");

MQTTClient = managedMqttClient;
MQTTClient.ApplicationMessageReceivedAsync += Mqtt_ApplicationMessageReceivedAsync;
MQTTClient.ApplicationMessageReceivedAsync += async (e) =>
{

try
{
await Mqtt_ApplicationMessageReceivedAsync(e);
}
catch (Exception ex)
{
logger.Error(ex);
logger.Error($"{e.ApplicationMessage.Topic}{Environment.NewLine}{e.ApplicationMessage.ConvertPayloadToString()}");

}
}
logger.Debug("Subscribed the incomming mqtt messages");
await managedMqttClient.StartAsync(managedMqttClientOptions);
logger.Debug("Started the mqtt client");
Expand Down
Loading