Skip to content

Commit

Permalink
Fix the MQTT worker to use the correct controller APIs when setting t…
Browse files Browse the repository at this point in the history
…he pilot wire derogation/setpoint mode
  • Loading branch information
kevinchalet committed Dec 10, 2024
1 parent 4f679a9 commit a3819dd
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions src/OpenNetty.Mqtt/OpenNettyMqttWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,36 +123,6 @@ await _manager.FindEndpointByNameAsync(name) is not OpenNettyEndpoint endpoint)
break;

case OpenNettyMqttAttributes.PilotWireDerogationMode when operation is OpenNettyMqttOperation.Set:
switch (message.ConvertPayloadToString()?.ToLowerInvariant())
{
case "comfort":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.Comfort);
break;

case "comfort-1":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.ComfortMinusOne);
break;

case "comfort-2":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.ComfortMinusTwo);
break;

case "eco":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.Eco);
break;

case "frost_protection":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.FrostProtection);
break;
}
break;

case OpenNettyMqttAttributes.PilotWireSetpointMode when operation is OpenNettyMqttOperation.Set:
switch (message.ConvertPayloadToString()?.ToLowerInvariant())
{
case "none":
Expand Down Expand Up @@ -251,6 +221,36 @@ await _controller.SetPilotWireDerogationModeAsync(endpoint,
}
break;

case OpenNettyMqttAttributes.PilotWireSetpointMode when operation is OpenNettyMqttOperation.Set:
switch (message.ConvertPayloadToString()?.ToLowerInvariant())
{
case "comfort":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.Comfort);
break;

case "comfort-1":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.ComfortMinusOne);
break;

case "comfort-2":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.ComfortMinusTwo);
break;

case "eco":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.Eco);
break;

case "frost_protection":
await _controller.SetPilotWireSetpointModeAsync(endpoint,
OpenNettyModels.TemperatureControl.PilotWireMode.FrostProtection);
break;
}
break;

case OpenNettyMqttAttributes.RateType or OpenNettyMqttAttributes.IsPowerCutActive
when operation is OpenNettyMqttOperation.Get:
_ = await _controller.GetSmartMeterInformationAsync(endpoint);
Expand Down

0 comments on commit a3819dd

Please sign in to comment.