Fix HAss Sensor Software Watchdog

Fix Home Assistant Sensor Discovery Software Watchdog restart (#4831)
This commit is contained in:
Theo Arends 2019-01-08 15:25:12 +01:00
parent 9730df7adc
commit 53b8f1f877
2 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,8 @@
/* 6.4.1.8 20190107 /* 6.4.1.8 20190107
* Change sonoff_template.h layout regarding optional module flags like ADC0 * Change sonoff_template.h layout regarding optional module flags like ADC0
* Add command SetOption62 1 to force no Button/Switch pullup on dedicated modules. Currently only supported on Shelly2 (#4841) * Add command SetOption62 1 to force no Button/Switch pullup on dedicated modules. Currently only supported on Shelly2 (#4841)
* Fix Display exception 28 when JSON value is NULL received
* Fix Home Assistant Sensor Discovery Software Watchdog restart (#4831)
* *
* 6.4.1.7 20190106 * 6.4.1.7 20190106
* Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6 * Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6

View File

@ -128,7 +128,7 @@ const char HASS_DISCOVER_DEVICE_INFO[] PROGMEM =
"\"name\":\"%s\"," "\"name\":\"%s\","
"\"model\":\"%s\"," "\"model\":\"%s\","
"\"sw_version\":\"%s%s\"," "\"sw_version\":\"%s%s\","
"\"manufacturer\":\"%s\"}"; "\"manufacturer\":\"Tasmota\"}";
const char HASS_DISCOVER_TOPIC_PREFIX[] PROGMEM = const char HASS_DISCOVER_TOPIC_PREFIX[] PROGMEM =
"%s, \"~\":\"%s\""; "%s, \"~\":\"%s\"";
@ -239,7 +239,7 @@ void HAssAnnounceRelayLight(void)
} }
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data,
unique_id, ESP.getChipId(), unique_id, ESP.getChipId(),
Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image, "Tasmota"); Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image);
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
} }
@ -288,7 +288,7 @@ void HAssAnnounceButtonSwitch(byte device, char* topic, byte present, byte key,
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data,
unique_id, ESP.getChipId(), unique_id, ESP.getChipId(),
Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image, "Tasmota"); Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image);
if (strlen(prefix) > 0 ) snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); if (strlen(prefix) > 0 ) snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
} }
@ -307,7 +307,7 @@ void HAssAnnounceSwitches(void)
byte switch_present = 0; byte switch_present = 0;
byte toggle = 1; byte toggle = 1;
if ((pin[GPIO_SWT1 + switch_index] < 99) || (pin[GPIO_SWT1_NP + switch_index] < 99)) { if (pin[GPIO_SWT1 + switch_index] < 99) {
switch_present = 1; switch_present = 1;
} }
@ -339,7 +339,7 @@ void HAssAnnounceButtons(void)
if (!button_index && ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module))) { if (!button_index && ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module))) {
button_present = 1; button_present = 1;
} else { } else {
if ((pin[GPIO_KEY1 + button_index] < 99) || (pin[GPIO_KEY1_NP + button_index] < 99)) { if (pin[GPIO_KEY1 + button_index] < 99) {
button_present = 1; button_present = 1;
} }
} }
@ -413,7 +413,7 @@ void HAssAnnounceSensor(const char* sensorname, const char* subsensortype)
} }
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data,
unique_id, ESP.getChipId(), unique_id, ESP.getChipId(),
Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image, "Tasmota"); Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image);
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
} }
@ -457,6 +457,7 @@ void HAssAnnounceSensors(void)
} }
} }
} }
yield();
} while (hass_xsns_index != 0); } while (hass_xsns_index != 0);
} }