diff --git a/OmniLinkBridge/MQTT/Climate.cs b/OmniLinkBridge/MQTT/Climate.cs index 2efd626..eb50b21 100644 --- a/OmniLinkBridge/MQTT/Climate.cs +++ b/OmniLinkBridge/MQTT/Climate.cs @@ -4,6 +4,7 @@ namespace OmniLinkBridge.MQTT { public class Climate : Device { + public string action_topic { get; set; } public string current_temperature_topic { get; set; } public string temperature_low_state_topic { get; set; } diff --git a/OmniLinkBridge/MQTT/MappingExtensions.cs b/OmniLinkBridge/MQTT/MappingExtensions.cs index 54f0dd0..e6d499d 100644 --- a/OmniLinkBridge/MQTT/MappingExtensions.cs +++ b/OmniLinkBridge/MQTT/MappingExtensions.cs @@ -30,7 +30,7 @@ namespace OmniLinkBridge.MQTT area.AreaAlarms.IsBitSet(6)) // Duress return "triggered"; else if (area.ExitTimer > 0) - return "pending"; + return "arming"; return area.AreaMode switch { @@ -51,7 +51,7 @@ namespace OmniLinkBridge.MQTT area.AreaAlarms.IsBitSet(6)) // Duress return "triggered"; else if (area.ExitTimer > 0) - return "pending"; + return "arming"; switch (area.AreaMode) { @@ -453,6 +453,8 @@ namespace OmniLinkBridge.MQTT ret.unique_id = $"{Global.mqtt_prefix}thermostat{thermostat.Number}"; ret.name = Global.mqtt_discovery_name_prefix + thermostat.Name; + + ret.action_topic = thermostat.ToTopic(Topic.current_operation); ret.current_temperature_topic = thermostat.ToTopic(Topic.current_temperature); ret.temperature_low_state_topic = thermostat.ToTopic(Topic.temperature_heat_state); @@ -474,12 +476,10 @@ namespace OmniLinkBridge.MQTT public static string ToOperationState(this clsThermostat thermostat) { - string status = thermostat.HorC_StatusText(); - - if (status.Contains("COOLING")) - return "cool"; - else if (status.Contains("HEATING")) - return "heat"; + if (thermostat.HorC_Status.IsBitSet(0)) + return "heating"; + else if (thermostat.HorC_Status.IsBitSet(1)) + return "cooling"; else return "idle"; } diff --git a/README.md b/README.md index 0c2062d..a6f9e79 100644 --- a/README.md +++ b/README.md @@ -167,10 +167,10 @@ SUB omnilink/areaX/name string Area name SUB omnilink/areaX/state -string triggered, pending, armed_night, armed_night_delay, armed_home, armed_home_instant, armed_away, armed_vacation, disarmed +string triggered, arming, armed_night, armed_night_delay, armed_home, armed_home_instant, armed_away, armed_vacation, disarmed SUB omnilink/areaX/basic_state -string triggered, pending, armed_night, armed_home, armed_away, disarmed +string triggered, arming, armed_night, armed_home, armed_away, disarmed SUB omnilink/areaX/json_state string json @@ -227,7 +227,7 @@ SUB omnilink/thermostatX/name string Thermostat name SUB omnilink/thermostatX/current_operation -string idle, cool, heat +string idle, cooling, heating SUB omnilink/thermostatX/current_temperature int Current temperature in degrees fahrenheit