Add thermostat emergency heat and fix hold documentation

This commit is contained in:
Ryan Wagoner 2021-11-04 20:34:13 -04:00
parent a248bd4f30
commit a8d965eb04
8 changed files with 33 additions and 9 deletions

View file

@ -85,9 +85,9 @@ CREATE TABLE IF NOT EXISTS `log_thermostats` (
`humidity` smallint(6) NOT NULL,
`humidify` smallint(6) NOT NULL,
`dehumidify` smallint(6) NOT NULL,
`mode` varchar(5) NOT NULL,
`mode` varchar(14) NOT NULL,
`fan` varchar(5) NOT NULL,
`hold` varchar(5) NOT NULL,
`hold` varchar(8) NOT NULL,
PRIMARY KEY (`log_tstat_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

View file

@ -26,5 +26,6 @@ namespace OmniLinkBridge.MQTT
public string hold_state_topic { get; set; }
public string hold_command_topic { get; set; }
public List<string> hold_modes { get; set; } = new List<string>(new string[] { "on", "vacation" });
}
}

View file

@ -478,7 +478,7 @@ namespace OmniLinkBridge.MQTT
ret.temperature_high_state_topic = thermostat.ToTopic(Topic.temperature_cool_state);
ret.temperature_high_command_topic = thermostat.ToTopic(Topic.temperature_cool_command);
ret.mode_state_topic = thermostat.ToTopic(Topic.mode_state);
ret.mode_state_topic = thermostat.ToTopic(Topic.mode_basic_state);
ret.mode_command_topic = thermostat.ToTopic(Topic.mode_command);
ret.fan_mode_state_topic = thermostat.ToTopic(Topic.fan_mode_state);
@ -499,6 +499,22 @@ namespace OmniLinkBridge.MQTT
return "idle";
}
public static string ToModeState(this clsThermostat thermostat)
{
if (thermostat.Mode == enuThermostatMode.E_Heat)
return "e_heat";
else
return thermostat.ModeText().ToLower();
}
public static string ToModeBasicState(this clsThermostat thermostat)
{
if (thermostat.Mode == enuThermostatMode.E_Heat)
return "heat";
else
return thermostat.ModeText().ToLower();
}
public static string ToTopic(this clsButton button, Topic topic)
{
return $"{Global.mqtt_prefix}/button{button.Number}/{topic}";

View file

@ -24,6 +24,7 @@
dehumidify_state,
dehumidify_command,
mode_state,
mode_basic_state,
mode_command,
fan_mode_state,
fan_mode_command,

View file

@ -535,7 +535,8 @@ namespace OmniLinkBridge.Modules
PublishAsync(thermostat.ToTopic(Topic.temperature_cool_state), thermostat.CoolSetpointText());
PublishAsync(thermostat.ToTopic(Topic.humidify_state), thermostat.HumidifySetpointText());
PublishAsync(thermostat.ToTopic(Topic.dehumidify_state), thermostat.DehumidifySetpointText());
PublishAsync(thermostat.ToTopic(Topic.mode_state), thermostat.ModeText().ToLower());
PublishAsync(thermostat.ToTopic(Topic.mode_state), thermostat.ToModeState());
PublishAsync(thermostat.ToTopic(Topic.mode_basic_state), thermostat.ToModeBasicState());
PublishAsync(thermostat.ToTopic(Topic.fan_mode_state), thermostat.FanModeText().ToLower());
PublishAsync(thermostat.ToTopic(Topic.hold_state), thermostat.HoldStatusText().ToLower());
}

View file

@ -173,7 +173,7 @@
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="MQTTnet.Extensions.ManagedClient">
<Version>3.0.16</Version>
<Version>3.0.17</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>

View file

@ -59,10 +59,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>2.0.0</Version>
<Version>2.2.7</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>2.0.0</Version>
<Version>2.2.7</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

View file

@ -253,15 +253,20 @@ int Setpoint in relative humidity
SUB omnilink/thermostatX/mode_state
PUB omnilink/thermostatX/mode_command
string auto, off, cool, heat, e_heat
SUB omnilink/thermostatX/mode_basic_state
string auto, off, cool, heat
SUB omnilink/thermostatX/fan_mode_state
PUB omnilink/thermostatX/fan_mode_command
string auto, on, cycle
SUB omnilink/thermostatX/hold_state
SUB omnilink/thermostatX/hold_state
string off, on, vacation
PUB omnilink/thermostatX/hold_command
string off, hold
string off, on
```
### Buttons