Skip to content

Commit

Permalink
Ignore potential bogus temperature readings + setpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
seime committed Feb 4, 2023
1 parent 1ec41d3 commit bdceab1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,12 @@ private void handleVerticalSwingCommand(ChannelUID channelUID, Command command,

private void handleTargetTemperatureCommand(ChannelUID channelUID, Command command, Device device) {
if (command instanceof RefreshType) {
updateState(channelUID, new QuantityType<>(device.getCurrentParameters().getTargetTemperature(),
device.getTemperatureUnit()));
if (device.getCurrentParameters().getTargetTemperature() == null) {
updateState(channelUID, UnDefType.UNDEF);
} else {
updateState(channelUID, new QuantityType<>(device.getCurrentParameters().getTargetTemperature(),
device.getTemperatureUnit()));
}
} else {
double targetTemperature = -1;
if (command instanceof QuantityType) {
Expand Down Expand Up @@ -361,7 +365,6 @@ private void handleCurrentOutdoorTemperatureCommand(ChannelUID channelUID, Comma
private void sendParameters(ChannelUID channelUID, Device device, Parameters newParameters,
State newStateIfSuccessfulUpdate) {
try {

SetDevicePropertiesResponse rsp = accountHandler.getApiBridge().sendRequest(
new SetDevicePropertiesRequest(device.getDeviceId(), newParameters.toParametersDTO(device)),
SetDevicePropertiesResponse.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
*/
package org.openhab.binding.panasoniccomfortcloud.internal.model;

import org.openhab.binding.panasoniccomfortcloud.internal.BindingConstants;
import java.util.Set;

import org.openhab.binding.panasoniccomfortcloud.internal.dto.ParametersDTO;

/**
* @author Arne Seime - Initial contribution
*/
public class Parameters {

public static final int INVALID_TEMPERATURE_READING = 126;
public static final Set<Object> INVALID_TEMPERATURE_READINGS = Set.of(126, -255);
private Parameters shadowParameters = null;
private AirSwingUpDown swingUpDown;
private AirSwingSideways airSwingSideways;
Expand Down Expand Up @@ -55,18 +56,14 @@ public Parameters(ParametersDTO dto, Device device) {
nanoeMode = NanoeMode.parseValue(dto.nanoe);
actualNanoeMode = NanoeMode.parseValue(dto.actualNanoe);
masterSwitch = dto.operate != null && dto.operate != 0;
targetTemperature = dto.temperatureSet;

if (BindingConstants.DEVICE_TYPE_WIFI_DONGLE.equals(device.getType())) {
// Bug in WiFi dongles reporting invalid temperature
if (dto.insideTemperature != INVALID_TEMPERATURE_READING) {
insideTemperature = dto.insideTemperature;
}
if (dto.outTemperature != INVALID_TEMPERATURE_READING) {
outsideTemperature = dto.outTemperature;
}
} else {

if (!INVALID_TEMPERATURE_READINGS.contains(dto.temperatureSet)) {
targetTemperature = dto.temperatureSet;
}
if (!INVALID_TEMPERATURE_READINGS.contains(dto.insideTemperature)) {
insideTemperature = dto.insideTemperature;
}
if (!INVALID_TEMPERATURE_READINGS.contains(dto.outTemperature)) {
outsideTemperature = dto.outTemperature;
}

Expand Down

This file was deleted.

0 comments on commit bdceab1

Please sign in to comment.