Merge pull request #7679 from effelle/development

Update xdrv_12_home_assistant.ino
This commit is contained in:
Theo Arends 2020-02-06 14:25:31 +01:00 committed by GitHub
commit d52ed6f2bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,10 +52,15 @@ const char HASS_DISCOVER_BASE[] PROGMEM =
"\"pl_not_avail\":\"" D_OFFLINE "\""; // Offline "\"pl_not_avail\":\"" D_OFFLINE "\""; // Offline
const char HASS_DISCOVER_RELAY[] PROGMEM = const char HASS_DISCOVER_RELAY[] PROGMEM =
",\"cmd_t\":\"%s\"," // cmnd/dualr2/POWER2 "{\"name\":\"%s\"," // dualr2 1
"\"cmd_t\":\"%s\"," // cmnd/dualr2/POWER2
"\"stat_t\":\"%s\"," // stat/dualr2/RESULT
"\"val_tpl\":\"{{value_json.%s}}\"," // POWER2 "\"val_tpl\":\"{{value_json.%s}}\"," // POWER2
"\"pl_off\":\"%s\"," // OFF "\"pl_off\":\"%s\"," // OFF
"\"pl_on\":\"%s\""; // ON "\"pl_on\":\"%s\"," // ON
"\"avty_t\":\"%s\"," // tele/dualr2/LWT
"\"pl_avail\":\"" D_ONLINE "\"," // Online
"\"pl_not_avail\":\"" D_OFFLINE "\""; // Offline
const char HASS_DISCOVER_BUTTON_TOGGLE[] PROGMEM = const char HASS_DISCOVER_BUTTON_TOGGLE[] PROGMEM =
",\"value_template\":\"{{value_json.%s}}\"," // STATE ",\"value_template\":\"{{value_json.%s}}\"," // STATE
@ -579,12 +584,12 @@ void HAssDiscovery(void)
Settings.flag.mqtt_response = 0; // SetOption4 - Switch between MQTT RESULT or COMMAND - Response always as RESULT and not as uppercase command Settings.flag.mqtt_response = 0; // SetOption4 - Switch between MQTT RESULT or COMMAND - Response always as RESULT and not as uppercase command
Settings.flag.decimal_text = 1; // SetOption17 - Switch between decimal or hexadecimal output - Respond with decimal color values Settings.flag.decimal_text = 1; // SetOption17 - Switch between decimal or hexadecimal output - Respond with decimal color values
Settings.flag3.hass_tele_on_power = 1; // SetOption59 - Send tele/%topic%/STATE in addition to stat/%topic%/RESULT - send tele/STATE message as stat/RESULT Settings.flag3.hass_tele_on_power = 1; // SetOption59 - Send tele/%topic%/STATE in addition to stat/%topic%/RESULT - send tele/STATE message as stat/RESULT
// Settings.light_scheme = 0; // To just control color it needs to be Scheme 0 Settings.light_scheme = 0; // To just control color it needs to be Scheme 0
// if (strcmp_P(SettingsText(SET_MQTT_FULLTOPIC), PSTR("%topic%/%prefix%/"))) { if (strcmp_P(SettingsText(SET_MQTT_FULLTOPIC), PSTR("%topic%/%prefix%/"))) {
// SettingsUpdateText(SET_MQTT_FULLTOPIC, "%topic%/%prefix%/"); SettingsUpdateText(SET_MQTT_FULLTOPIC, "%topic%/%prefix%/");
// restart_flag = 2; restart_flag = 2;
// return; // As full topic has changed do restart first before sending discovery data return; // As full topic has changed do restart first before sending discovery data
// } }
} }
if (Settings.flag.hass_discovery || (1 == hass_mode)) if (Settings.flag.hass_discovery || (1 == hass_mode))