Skip to content

Commit

Permalink
1.1.16 - Add MQTT audio support
Browse files Browse the repository at this point in the history
  • Loading branch information
rwagoner committed May 4, 2024
1 parent 800242a commit 73f504c
Show file tree
Hide file tree
Showing 31 changed files with 708 additions and 74 deletions.
3 changes: 3 additions & 0 deletions OmniLinkBridge/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public abstract class Global
public static bool verbose_unit;
public static bool verbose_message;
public static bool verbose_lock;
public static bool verbose_audio;

// mySQL Logging
public static bool mysql_logging;
Expand All @@ -59,6 +60,8 @@ public abstract class Global
public static HashSet<int> mqtt_discovery_area_code_required;
public static ConcurrentDictionary<int, MQTT.OverrideZone> mqtt_discovery_override_zone;
public static ConcurrentDictionary<int, MQTT.OverrideUnit> mqtt_discovery_override_unit;
public static Type mqtt_discovery_button_type;
public static bool mqtt_audio_local_mute;

// Notifications
public static bool notify_area;
Expand Down
6 changes: 5 additions & 1 deletion OmniLinkBridge/MQTT/HomeAssistant/Alarm.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Alarm : Device
{
public Alarm(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string command_topic { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
Expand Down
5 changes: 5 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/BinarySensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class BinarySensor : Device
{
public BinarySensor(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

[JsonConverter(typeof(StringEnumConverter))]
public enum DeviceClass
{
Expand Down
17 changes: 17 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/Button.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json;

namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Button : Device
{
public Button(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string command_topic { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string payload_press { get; set; }
}
}
5 changes: 5 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/Climate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Climate : Device
{
public Climate(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string status { get; set; }

public string action_topic { get; set; }
Expand Down
11 changes: 9 additions & 2 deletions OmniLinkBridge/MQTT/HomeAssistant/Device.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using OmniLinkBridge.Modules;
using System.Collections.Generic;

namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Device
{
public Device(DeviceRegistry deviceRegistry)
{
device = deviceRegistry;
}

[JsonConverter(typeof(StringEnumConverter))]
public enum AvailabilityMode
{
Expand All @@ -19,6 +23,9 @@ public enum AvailabilityMode

public string name { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string icon { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string state_topic { get; set; }

Expand All @@ -32,6 +39,6 @@ public enum AvailabilityMode
public AvailabilityMode? availability_mode { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DeviceRegistry device { get; set; } = MQTTModule.MqttDeviceRegistry;
public DeviceRegistry device { get; set; }
}
}
5 changes: 5 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/Light.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
public class Light : Device
{
public Light(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string command_topic { get; set; }

public string brightness_state_topic { get; set; }
Expand Down
5 changes: 5 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/Lock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Lock : Device
{
public Lock(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string command_topic { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
Expand Down
8 changes: 5 additions & 3 deletions OmniLinkBridge/MQTT/HomeAssistant/Number.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Number : Device
{
public string command_topic { get; set; }
public Number(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string icon { get; set; }
}

public string command_topic { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public int? min { get; set; }
Expand Down
16 changes: 16 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/Select.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Generic;

namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Select : Device
{
public Select(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string command_topic { get; set; }

public List<string> options { get; set; } = null;
}
}
8 changes: 5 additions & 3 deletions OmniLinkBridge/MQTT/HomeAssistant/Sensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Sensor : Device
{
public Sensor(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

[JsonConverter(typeof(StringEnumConverter))]
public enum DeviceClass
{
Expand All @@ -15,9 +20,6 @@ public enum DeviceClass
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DeviceClass? device_class { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string icon { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string unit_of_measurement { get; set; }

Expand Down
5 changes: 5 additions & 0 deletions OmniLinkBridge/MQTT/HomeAssistant/Switch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ namespace OmniLinkBridge.MQTT.HomeAssistant
{
public class Switch : Device
{
public Switch(DeviceRegistry deviceRegistry) : base(deviceRegistry)
{

}

public string command_topic { get; set; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
Expand Down
Loading

0 comments on commit 73f504c

Please sign in to comment.