Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: IRMQTTServer extended with new A/C common fields #1940

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions examples/IRMQTTServer/IRMQTTServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,27 @@ const uint16_t kMinUnknownSize = 2 * 10;
#define KEY_JSON "json"
#define KEY_RESEND "resend"
#define KEY_VCC "vcc"
#define KEY_COMMAND "command"
#define KEY_SENSORTEMP "sensortemp"
#define KEY_IFEEL "ifeel"

// HTML arguments we will parse for IR code information.
#define KEY_TYPE "type" // KEY_PROTOCOL is also checked too.
#define KEY_CODE "code"
#define KEY_BITS "bits"
#define KEY_REPEAT "repeats"
#define KEY_CHANNEL "channel" // Which IR TX channel to send on.
#define KEY_SENSORTEMP_DISABLED "sensortemp_disabled" // For HTML form only,
// not sent via MQTT
// nor JSON

// GPIO html/config keys
#define KEY_TX_GPIO "tx"
#define KEY_RX_GPIO "rx"

// Miscellaneous constants
#define TOGGLE_JS_FN_NAME "ToggleInputBasedOnCheckbox"

// Text for Last Will & Testament status messages.
const char* const kLwtOnline = "Online";
const char* const kLwtOffline = "Offline";
Expand All @@ -290,7 +299,7 @@ const uint16_t kJsonAcStateMaxSize = 1024; // Bytes
// ----------------- End of User Configuration Section -------------------------

// Constants
#define _MY_VERSION_ "v1.7.2"
#define _MY_VERSION_ "v1.8.0"

const uint8_t kRebootTime = 15; // Seconds
const uint8_t kQuickDisplayTime = 2; // Seconds
Expand Down Expand Up @@ -358,7 +367,8 @@ static const char kClimateTopics[] PROGMEM =
"(" KEY_PROTOCOL "|" KEY_MODEL "|" KEY_POWER "|" KEY_MODE "|" KEY_TEMP "|"
KEY_FANSPEED "|" KEY_SWINGV "|" KEY_SWINGH "|" KEY_QUIET "|"
KEY_TURBO "|" KEY_LIGHT "|" KEY_BEEP "|" KEY_ECONO "|" KEY_SLEEP "|"
KEY_FILTER "|" KEY_CLEAN "|" KEY_CELSIUS "|" KEY_RESEND
KEY_FILTER "|" KEY_CLEAN "|" KEY_CELSIUS "|" KEY_RESEND "|" KEY_COMMAND "|"
"|" KEY_SENSORTEMP "|" KEY_IFEEL
#if MQTT_CLIMATE_JSON
"|" KEY_JSON
#endif // MQTT_CLIMATE_JSON
Expand All @@ -367,6 +377,7 @@ static const char* const kMqttTopics[] = {
KEY_PROTOCOL, KEY_MODEL, KEY_POWER, KEY_MODE, KEY_TEMP, KEY_FANSPEED,
KEY_SWINGV, KEY_SWINGH, KEY_QUIET, KEY_TURBO, KEY_LIGHT, KEY_BEEP,
KEY_ECONO, KEY_SLEEP, KEY_FILTER, KEY_CLEAN, KEY_CELSIUS, KEY_RESEND,
KEY_COMMAND, KEY_SENSORTEMP, KEY_IFEEL
KEY_JSON}; // KEY_JSON needs to be the last one.


Expand Down Expand Up @@ -410,17 +421,22 @@ int8_t getDefaultTxGpio(void);
String genStatTopic(const uint16_t channel = 0);
String listOfTxGpios(void);
bool hasUnsafeHTMLChars(String input);
String htmlHeader(const String title, const String h1_text = "");
String htmlHeader(const String title, const String h1_text = "",
const String headScriptsJS = "");
String htmlEnd(void);
String htmlButton(const String url, const String button,
const String text = "");
String htmlMenu(void);
void handleRoot(void);
String addJsReloadUrl(const String url, const uint16_t timeout_s,
const bool notify);
String getJsToggleCheckbox(const String functionName = TOGGLE_JS_FN_NAME);
void handleExamples(void);
String htmlOptionItem(const String value, const String text, bool selected);
String htmlSelectBool(const String name, const bool def);
String htmlDisableCheckbox(const String name, const String targetControlId,
const bool checked,
const String toggleJsFnName = TOGGLE_JS_FN_NAME);
String htmlSelectClimateProtocol(const String name, const decode_type_t def);
String htmlSelectAcStateProtocol(const String name, const decode_type_t def,
const bool simple);
Expand Down
Loading