Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-work "Fan Only" strings & matching.
Browse files Browse the repository at this point in the history
* Improve compatiblity and human clarity.
* Add note about why it exists in the first place.

Replaces PR #1604
crankyoldgit committed Sep 21, 2021
1 parent 74f4136 commit 5e47dda
Showing 4 changed files with 33 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
@@ -3076,8 +3076,14 @@ stdAc::opmode_t IRac::strToOpmode(const char *str,
!strcasecmp(str, "DEHUMIDIFY"))
return stdAc::opmode_t::kDry;
else if (!strcasecmp(str, kFanStr) ||
!strcasecmp(str, "FANONLY") ||
!strcasecmp(str, kFanOnlyStr))
// The following Fans strings with "only" are required to help with
// HomeAssistant & Google Home Climate integration.
// For compatibility only.
// Ref: https://www.home-assistant.io/integrations/google_assistant/#climate-operation-modes
!strcasecmp(str, kFanOnlyStr) ||
!strcasecmp(str, kFan_OnlyStr) ||
!strcasecmp(str, kFanOnlyWithSpaceStr) ||
!strcasecmp(str, kFanOnlyNoSpaceStr))
return stdAc::opmode_t::kFan;
else
return def;
11 changes: 9 additions & 2 deletions src/IRtext.cpp
Original file line number Diff line number Diff line change
@@ -107,9 +107,16 @@ const PROGMEM char* kAutomaticStr = D_STR_AUTOMATIC; ///< "Automatic"
const PROGMEM char* kManualStr = D_STR_MANUAL; ///< "Manual"
const PROGMEM char* kCoolStr = D_STR_COOL; ///< "Cool"
const PROGMEM char* kHeatStr = D_STR_HEAT; ///< "Heat"
const PROGMEM char* kFanStr = D_STR_FAN; ///< "Fan"
const PROGMEM char* kDryStr = D_STR_DRY; ///< "Dry"
const PROGMEM char* kFanOnlyStr = D_STR_FANONLY; ///< "fan_only"
const PROGMEM char* kFanStr = D_STR_FAN; ///< "Fan"
// The following Fans strings with "only" are required to help with
// HomeAssistant & Google Home Climate integration. For compatibility only.
// Ref: https://www.home-assistant.io/integrations/google_assistant/#climate-operation-modes
const PROGMEM char* kFanOnlyStr = D_STR_FANONLY; ///< "fan-only"
const PROGMEM char* kFan_OnlyStr = D_STR_FAN_ONLY; ///< "fan_only" (legacy use)
const PROGMEM char* kFanOnlyWithSpaceStr = D_STR_FANSPACEONLY; ///< "Fan Only"
const PROGMEM char* kFanOnlyNoSpaceStr = D_STR_FANONLYNOSPACE; ///< "FanOnly"

const PROGMEM char* kRecycleStr = D_STR_RECYCLE; ///< "Recycle"

const PROGMEM char* kMaxStr = D_STR_MAX; ///< "Max"
3 changes: 3 additions & 0 deletions src/IRtext.h
Original file line number Diff line number Diff line change
@@ -51,7 +51,10 @@ extern const char* kEconoToggleStr;
extern const char* kEyeAutoStr;
extern const char* kEyeStr;
extern const char* kFalseStr;
extern const char* kFanOnlyNoSpaceStr;
extern const char* kFan_OnlyStr;
extern const char* kFanOnlyStr;
extern const char* kFanOnlyWithSpaceStr;
extern const char* kFanStr;
extern const char* kFastStr;
extern const char* kFilterStr;
14 changes: 13 additions & 1 deletion src/locale/defaults.h
Original file line number Diff line number Diff line change
@@ -305,8 +305,20 @@
#define D_STR_FAN "Fan"
#endif // D_STR_FAN
#ifndef D_STR_FANONLY
#define D_STR_FANONLY "fan_only"
#define D_STR_FANONLY "fan-only"
#endif // D_STR_FANONLY
#ifndef D_STR_FAN_ONLY
#define D_STR_FAN_ONLY "fan_only"
#endif // D_STR_FAN_ONLY
#ifndef D_STR_ONLY
#define D_STR_ONLY "Only"
#endif // D_STR_ONLY
#ifndef D_STR_FANSPACEONLY
#define D_STR_FANSPACEONLY D_STR_FAN " " D_STR_ONLY
#endif // D_STR_FANSPACEONLY
#ifndef D_STR_FANONLYNOSPACE
#define D_STR_FANONLYNOSPACE D_STR_FAN D_STR_ONLY
#endif // D_STR_FANONLYNOSPACE
#ifndef D_STR_DRY
#define D_STR_DRY "Dry"
#endif // D_STR_DRY

0 comments on commit 5e47dda

Please sign in to comment.