Skip to content

Commit

Permalink
Followup: improved diagnostics in SwitchableHvacDevice (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Sep 12, 2023
1 parent f51da16 commit 196a732
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ private Flux<Signal<HvacDeviceStatus, Void>> computeNonBlocking(Flux<Signal<Hvac
.filter(Signal::isOK)

// Can't throw this as a payload like we did in a blocking version, need to complain
.doOnNext(signal -> logger.debug("compute signal={}", signal))
.doOnNext(signal -> logger.debug("{}: compute signal={}", getAddress(), signal))

.map(Signal::getValue)
.map(this::reconcile)
.filter(Predicate.not(this::isModeOnly))
.doOnNext(command -> logger.debug("compute command={}", command))
.doOnNext(command -> logger.debug("{}: compute command={}", getAddress(), command))
.flatMap(command -> {

var state = getState(command);

logger.debug("state: {}", state);
logger.debug("{}: state: {}{}", getAddress(), state != inverted, inverted ? " (inverted)" : "");

// By this time, the command has been verified to be valid
requested = command;
Expand Down Expand Up @@ -169,7 +169,7 @@ private boolean isModeOnly(HvacCommand command) {
// A valid situation for the whole system which makes no sense for this particular application

if (command.demand == null && command.fanSpeed == null) {
logger.warn("mode only command, ignored: {}", command);
logger.warn("{}: mode only command, ignored: {}", getAddress(), command);
return true;
}

Expand All @@ -193,7 +193,7 @@ private HvacCommand reconcile(HvacCommand command) {

if (mode != HvacMode.COOLING && command.fanSpeed != null && command.fanSpeed > 0) {
// FIXME: https://github.com/home-climate-control/dz/issues/222
logger.warn("fanSpeed>0 should not be issued to this device in heating mode, ignored. Kick the maintainer to fix #222 (command={})", command);
logger.warn("{}: fanSpeed>0 should not be issued to this device in heating mode, ignored. Kick the maintainer to fix #222 (command={})", getAddress(), command);
}

var result = new HvacCommand(
Expand All @@ -202,7 +202,7 @@ private HvacCommand reconcile(HvacCommand command) {
command.fanSpeed == null ? requested.fanSpeed : command.fanSpeed
);

logger.debug("Requested: {}", result);
logger.debug("{}: requested: {}", getAddress(), result);

return result;
}
Expand Down

0 comments on commit 196a732

Please sign in to comment.