mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
openthread: add a force_dataset option to ignore the one saved in non-volatile storage
This commit is contained in:
parent
e9fb2653bd
commit
76632f96c7
3 changed files with 8 additions and 1 deletions
|
@ -21,6 +21,7 @@ CONF_PANID = "panid"
|
||||||
CONF_EXTPANID = "extpanid"
|
CONF_EXTPANID = "extpanid"
|
||||||
CONF_MDNS_ID = "mdns_id"
|
CONF_MDNS_ID = "mdns_id"
|
||||||
CONF_SRP_ID = "srp_id"
|
CONF_SRP_ID = "srp_id"
|
||||||
|
CONF_FORCE_DATASET = "force_dataset"
|
||||||
|
|
||||||
|
|
||||||
def set_sdkconfig_options(config):
|
def set_sdkconfig_options(config):
|
||||||
|
@ -79,6 +80,7 @@ CONFIG_SCHEMA = cv.All(
|
||||||
cv.Optional(CONF_EXTPANID): cv.string_strict,
|
cv.Optional(CONF_EXTPANID): cv.string_strict,
|
||||||
cv.Optional(CONF_NETWORK_NAME): cv.string_strict,
|
cv.Optional(CONF_NETWORK_NAME): cv.string_strict,
|
||||||
cv.Optional(CONF_PSKC): cv.string_strict,
|
cv.Optional(CONF_PSKC): cv.string_strict,
|
||||||
|
cv.Optional(CONF_FORCE_DATASET): cv.boolean,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -114,9 +114,13 @@ void OpenThreadComponent::ot_main() {
|
||||||
#endif
|
#endif
|
||||||
ESP_LOGI(TAG, "Activating dataset...");
|
ESP_LOGI(TAG, "Activating dataset...");
|
||||||
otOperationalDatasetTlvs dataset;
|
otOperationalDatasetTlvs dataset;
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENTHREAD_FORCE_DATASET
|
||||||
|
ESP_ERROR_CHECK(esp_openthread_auto_start(NULL));
|
||||||
|
#else
|
||||||
otError error = otDatasetGetActiveTlvs(esp_openthread_get_instance(), &dataset);
|
otError error = otDatasetGetActiveTlvs(esp_openthread_get_instance(), &dataset);
|
||||||
ESP_ERROR_CHECK(esp_openthread_auto_start((error == OT_ERROR_NONE) ? &dataset : NULL));
|
ESP_ERROR_CHECK(esp_openthread_auto_start((error == OT_ERROR_NONE) ? &dataset : NULL));
|
||||||
|
#endif
|
||||||
esp_openthread_launch_mainloop();
|
esp_openthread_launch_mainloop();
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
|
|
|
@ -22,6 +22,7 @@ openthread:
|
||||||
panid: 0x8f28
|
panid: 0x8f28
|
||||||
extpanid: d63e8e3e495ebbc3
|
extpanid: d63e8e3e495ebbc3
|
||||||
pskc: c23a76e98f1a6483639b1ac1271e2e27
|
pskc: c23a76e98f1a6483639b1ac1271e2e27
|
||||||
|
force_dataset: true
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- platform: openthread_info
|
- platform: openthread_info
|
||||||
|
|
Loading…
Reference in a new issue