2019-10-27 22:58:55 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2022-10-21 03:44:27 +00:00
|
|
|
|
using Newtonsoft.Json.Converters;
|
2019-11-06 03:47:24 +00:00
|
|
|
|
using OmniLinkBridge.Modules;
|
2022-10-21 03:44:27 +00:00
|
|
|
|
using System.Collections.Generic;
|
2018-10-13 21:28:47 +00:00
|
|
|
|
|
2022-11-02 22:09:33 +00:00
|
|
|
|
namespace OmniLinkBridge.MQTT.HomeAssistant
|
2018-10-13 21:28:47 +00:00
|
|
|
|
{
|
|
|
|
|
public class Device
|
|
|
|
|
{
|
2022-10-21 03:44:27 +00:00
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
|
|
|
public enum AvailabilityMode
|
|
|
|
|
{
|
|
|
|
|
all,
|
|
|
|
|
any,
|
|
|
|
|
latest
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-06 03:47:24 +00:00
|
|
|
|
public string unique_id { get; set; }
|
|
|
|
|
|
2018-10-13 21:28:47 +00:00
|
|
|
|
public string name { get; set; }
|
|
|
|
|
|
2019-10-27 22:58:55 +00:00
|
|
|
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
2018-10-13 21:28:47 +00:00
|
|
|
|
public string state_topic { get; set; }
|
|
|
|
|
|
2022-10-21 03:44:27 +00:00
|
|
|
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
2018-10-24 03:51:05 +00:00
|
|
|
|
public string availability_topic { get; set; } = $"{Global.mqtt_prefix}/status";
|
2019-11-06 03:47:24 +00:00
|
|
|
|
|
2022-10-21 03:44:27 +00:00
|
|
|
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
|
|
|
|
public List<Availability> availability { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
|
|
|
|
public AvailabilityMode? availability_mode { get; set; }
|
|
|
|
|
|
2019-11-06 03:47:24 +00:00
|
|
|
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
|
|
|
|
public DeviceRegistry device { get; set; } = MQTTModule.MqttDeviceRegistry;
|
2018-10-13 21:28:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|