- 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 string action_topic { get; set; }
public string current_temperature_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
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";
}

View file

@ -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