- Change MQTT thermostat current status and alarm arming status

This commit is contained in:
Ryan Wagoner 2021-06-26 01:21:32 -04:00
parent 1cf77ba179
commit 37aed0e891
3 changed files with 12 additions and 11 deletions

View file

@ -4,6 +4,7 @@ namespace OmniLinkBridge.MQTT
{ {
public class Climate : Device public class Climate : Device
{ {
public string action_topic { get; set; }
public string current_temperature_topic { get; set; } public string current_temperature_topic { get; set; }
public string temperature_low_state_topic { get; set; } public string temperature_low_state_topic { get; set; }

View file

@ -30,7 +30,7 @@ namespace OmniLinkBridge.MQTT
area.AreaAlarms.IsBitSet(6)) // Duress area.AreaAlarms.IsBitSet(6)) // Duress
return "triggered"; return "triggered";
else if (area.ExitTimer > 0) else if (area.ExitTimer > 0)
return "pending"; return "arming";
return area.AreaMode switch return area.AreaMode switch
{ {
@ -51,7 +51,7 @@ namespace OmniLinkBridge.MQTT
area.AreaAlarms.IsBitSet(6)) // Duress area.AreaAlarms.IsBitSet(6)) // Duress
return "triggered"; return "triggered";
else if (area.ExitTimer > 0) else if (area.ExitTimer > 0)
return "pending"; return "arming";
switch (area.AreaMode) switch (area.AreaMode)
{ {
@ -453,6 +453,8 @@ namespace OmniLinkBridge.MQTT
ret.unique_id = $"{Global.mqtt_prefix}thermostat{thermostat.Number}"; ret.unique_id = $"{Global.mqtt_prefix}thermostat{thermostat.Number}";
ret.name = Global.mqtt_discovery_name_prefix + thermostat.Name; 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.current_temperature_topic = thermostat.ToTopic(Topic.current_temperature);
ret.temperature_low_state_topic = thermostat.ToTopic(Topic.temperature_heat_state); 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) public static string ToOperationState(this clsThermostat thermostat)
{ {
string status = thermostat.HorC_StatusText(); if (thermostat.HorC_Status.IsBitSet(0))
return "heating";
if (status.Contains("COOLING")) else if (thermostat.HorC_Status.IsBitSet(1))
return "cool"; return "cooling";
else if (status.Contains("HEATING"))
return "heat";
else else
return "idle"; return "idle";
} }

View file

@ -167,10 +167,10 @@ SUB omnilink/areaX/name
string Area name string Area name
SUB omnilink/areaX/state 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 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 SUB omnilink/areaX/json_state
string json string json
@ -227,7 +227,7 @@ SUB omnilink/thermostatX/name
string Thermostat name string Thermostat name
SUB omnilink/thermostatX/current_operation SUB omnilink/thermostatX/current_operation
string idle, cool, heat string idle, cooling, heating
SUB omnilink/thermostatX/current_temperature SUB omnilink/thermostatX/current_temperature
int Current temperature in degrees fahrenheit int Current temperature in degrees fahrenheit