Skip to content

Commit

Permalink
Use the correct string for Fan mode in Home Assistant. (#1657)
Browse files Browse the repository at this point in the history
Home assistant needs the text for "Fan" mode to be "fan_only". i.e. the Underscore is important.
Problem was introduced in #1610
crankyoldgit authored Oct 29, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
renovate-bot Mend Renovate
1 parent eac9597 commit 49bfe4c
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/IRac.cpp
Original file line number Diff line number Diff line change
@@ -3438,7 +3438,7 @@ String IRac::opmodeToString(const stdAc::opmode_t mode, const bool ha) {
case stdAc::opmode_t::kCool: return kCoolStr;
case stdAc::opmode_t::kHeat: return kHeatStr;
case stdAc::opmode_t::kDry: return kDryStr;
case stdAc::opmode_t::kFan: return ha ? kFanOnlyStr : kFanStr;
case stdAc::opmode_t::kFan: return ha ? kFan_OnlyStr : kFanStr;
default: return kUnknownStr;
}
}
2 changes: 1 addition & 1 deletion src/IRtext.cpp
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ IRTEXT_CONST_STRING(kFanStr, D_STR_FAN); ///< "Fan"
// HomeAssistant & Google Home Climate integration. For compatibility only.
// Ref: https://www.home-assistant.io/integrations/google_assistant/#climate-operation-modes
IRTEXT_CONST_STRING(kFanOnlyStr, D_STR_FANONLY); ///< "fan-only"
IRTEXT_CONST_STRING(kFan_OnlyStr, D_STR_FAN_ONLY); ///< "fan_only" (legacy)
IRTEXT_CONST_STRING(kFan_OnlyStr, D_STR_FAN_ONLY); ///< "fan_only" (HA/legacy)
IRTEXT_CONST_STRING(kFanOnlyWithSpaceStr, D_STR_FANSPACEONLY); ///< "Fan Only"
IRTEXT_CONST_STRING(kFanOnlyNoSpaceStr, D_STR_FANONLYNOSPACE); ///< "FanOnly"

2 changes: 1 addition & 1 deletion test/IRac_test.cpp
Original file line number Diff line number Diff line change
@@ -2468,7 +2468,7 @@ TEST(TestIRac, opmodeToString) {
EXPECT_EQ("UNKNOWN", IRac::opmodeToString((stdAc::opmode_t)500));
// Home Assistant/Google Home differences.
EXPECT_EQ("Fan", IRac::opmodeToString(stdAc::opmode_t::kFan, false));
EXPECT_EQ("fan-only", IRac::opmodeToString(stdAc::opmode_t::kFan, true));
EXPECT_EQ("fan_only", IRac::opmodeToString(stdAc::opmode_t::kFan, true));
EXPECT_EQ("Fan", IRac::opmodeToString(stdAc::opmode_t::kFan)); // Default
}

0 comments on commit 49bfe4c

Please sign in to comment.