Skip to content

Commit

Permalink
- Change MQTT thermostat current status and alarm arming status
Browse files Browse the repository at this point in the history
  • Loading branch information
rwagoner committed Jul 21, 2021
1 parent 1cf77ba commit 37aed0e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions OmniLinkBridge/MQTT/Climate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
16 changes: 8 additions & 8 deletions OmniLinkBridge/MQTT/MappingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static string ToState(this clsArea area)
area.AreaAlarms.IsBitSet(6)) // Duress
return "triggered";
else if (area.ExitTimer > 0)
return "pending";
return "arming";

return area.AreaMode switch
{
Expand All @@ -51,7 +51,7 @@ public static string ToBasicState(this clsArea area)
area.AreaAlarms.IsBitSet(6)) // Duress
return "triggered";
else if (area.ExitTimer > 0)
return "pending";
return "arming";

switch (area.AreaMode)
{
Expand Down Expand Up @@ -453,6 +453,8 @@ public static Climate ToConfig(this clsThermostat thermostat, enuTempFormat form

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);
Expand All @@ -474,12 +476,10 @@ public static Climate ToConfig(this clsThermostat thermostat, enuTempFormat form

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";
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37aed0e

Please sign in to comment.