diff --git a/Examples/Config-Example1/Mesh-PrimaryESP32-Config-1.txt b/Examples/Config-Example1/Mesh-PrimaryESP32-Config-1.txt new file mode 100644 index 0000000..acdeb56 --- /dev/null +++ b/Examples/Config-Example1/Mesh-PrimaryESP32-Config-1.txt @@ -0,0 +1,100 @@ + +/* + * + * THIS EXAMPLE IS FOR THE PRIMARY ESP32 IN A MESH + * + * Choose a balance of settings between active scanning and passive scanning. Active scanning uses more battery of switchbot devices but it required for bot, curtain meter + * + * + * THIS IS NOT THE FULL CODE. These are the settings that apply to a mesh setup + */ + + +/* Wifi Settings */ +static const char* host = "esp32"; // Unique name for ESP32. The name detected by your router and MQTT. If you are using more then 1 ESPs to control different switchbots be sure to use unique hostnames. Host is the MQTT Client name and is used in MQTT topics + +/* Mesh Settings */ +/* Ignore if only one ESP32 is used */ +static const bool enableMesh = true; // Ignore if only one ESP32 is used. Set to false +static const char* meshHost = ""; // Ignore if only one ESP32 is used. Ignore if you don't have either meter/contact/motion. Enter the host value of the primary ESP32 if you are using multiple esp32s and you want to mesh them together for better contact/motion +static const bool meshMeters = true; // Mesh meters together if meshHost is set. The meter values will use the meshHost MQTT topics +static const bool meshContactSensors = true; // Mesh contact sensors together if meshHost is set. The contact values will use the meshHost MQTT topics. +static const bool meshMotionSensors = true; // Mesh motion sensors together if meshHost is set. The motion values will use the meshHost MQTT topics +static const bool onlyAllowRootESPToPublishContact = true; // All meshed messages for contact and motions sensors will pass through the root mesh host ESP32. Only the root host will send contact and motion messages +static const bool onlyAllowRootESPToPublishMotion = false; // All meshed messages for motion will pass through the root mesh host ESP32. Only the root host will send motion messages +static const bool onlyAllowRootESPToPublishLight = false; // All meshed messages for illuminance will pass through the root mesh host ESP32. Only the root host will send illuminance messages +static const bool countContactToAvoidDuplicates = true; // count the number of open/close/timeout over all esp32s so that none are duplicated +static const bool countMotionToAvoidDuplicates = false; // count the number of motion/no motion over all esp32s so that none are duplicated +static const bool countLightToAvoidDuplicates = false; // count the number of dark/bright over all esp32s so that none are duplicated +static const int timeToIgnoreDuplicates = 30; // if a duplicate is determined, ignore it within X seconds + + + +/* Switchbot Bot Settings */ +static std::map allBots = { + { "switchbotone", "xX:xX:xX:xX:xX:xX" }, + { "switchbottwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Curtain Settings */ +static const int curtainClosedPosition = 10; // When 2 curtains are controlled (left -> right and right -> left) it's possible one of the curtains pushes one of the switchbots more open. Change this value to set a position where a curtain is still considered closed +static std::map allCurtains = { + { "curtainone", "xX:xX:xX:xX:xX:xX" }, + { "curtaintwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Meter Settings */ +static std::map allMeters = { + { "meterone", "xX:xX:xX:xX:xX:xX" }, + { "metertwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Contact Sensor Settings */ +static std::map allContactSensors = { + { "contactone", "xX:xX:xX:xX:xX:xX" }, + { "contacttwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Motion Sensor Settings */ +static std::map allMotionSensors = { + { "motionone", "xX:xX:xX:xX:xX:xX" }, + { "motiontwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Plug Mini Settings */ +static std::map allPlugs = { + { "plugone", "xX:xX:xX:xX:xX:xX" }, + { "plugtwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Bot Passwords */ +static std::map allPasswords = { // Set all the bot passwords (setup in app first). Ignore if passwords are not used + { "switchbotone", "switchbotonePassword" }, + { "switchbottwo", "switchbottwoPassword" } +}; + + +static const int rescanTime = 10800; // Automatically perform a full active scan for device info of all devices every X seconds (default 3 hours). XXXXActiveScanSecs will also active scan on schedule + +static const int defaultBotScanAfterControlSecs = 10; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list +static const int defaultCurtainScanAfterControlSecs = 30; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list. Also used by scanWhileCurtainIsMoving +static const int defaultBotMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for bot every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultCurtainMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for curtain every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultMeterMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for meter temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultMotionMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultContactMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for contact temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultPlugMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultBotActiveScanSecs = 1800; // Default Active Scan for bot every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultCurtainActiveScanSecs = 1800; // Default Active Scan for curtain every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultMeterActiveScanSecs = 3600; // Default Active Scan for meter temp sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultMotionActiveScanSecs = 3600; // Default Active Scan for motion sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultContactActiveScanSecs = 3600; // Default Active Scan for contact temp sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultPlugActiveScanSecs = 3600; // Default Active Scan for motion sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. + +static const bool autoRescan = true; // perform automatic rescan (uses rescanTime and initialScan). +static const bool activeScanOnSchedule = true; // perform an active scan on decice types based on the scheduled seconds values for XXXXActiveScanSecs + +static const bool alwaysMQTTUpdate = false; // If the ESP32 is scanning, always publish MQTT data instead of using set times. ***Note: This creates a lot of MQTT traffic +static const bool onlyActiveScan = false; // Active scanning requires more battery from the BLE switchbot devices. If false, passive scanning is used when possible for contact/motion +static const bool onlyPassiveScan = false; // If this ESP32 is a mesh ESP32 or you only have motion/contact/meter sensors. Passive scanning uses less battery from BLE switchbot devices. Passive scanning provides less data then active scanning, but uses less battery +static const bool alwaysActiveScan = false; // No battery optimizations. If you are using the switchbot hub or app to control devices also and you want immediate state updates for bot and curtains in MQTT set to true \ No newline at end of file diff --git a/Examples/Config-Example1/Mesh-SecondaryESP32-Config-1.txt b/Examples/Config-Example1/Mesh-SecondaryESP32-Config-1.txt new file mode 100644 index 0000000..7a1350e --- /dev/null +++ b/Examples/Config-Example1/Mesh-SecondaryESP32-Config-1.txt @@ -0,0 +1,88 @@ + +/* + * + * THIS EXAMPLE IS FOR THE SECONDARY ESP32 IN A MESH + * + * Choose a balance of settings between active scanning and passive scanning. Active scanning uses more battery of switchbot devices but it required for bot, curtain meter + * + * + * THIS IS NOT THE FULL CODE. These are the settings that apply to a mesh setup + */ + + +/* Wifi Settings */ +static const char* host = "esp32mesh1"; // Unique name for ESP32. The name detected by your router and MQTT. If you are using more then 1 ESPs to control different switchbots be sure to use unique hostnames. Host is the MQTT Client name and is used in MQTT topics + +/* Mesh Settings */ +/* Ignore if only one ESP32 is used */ +static const bool enableMesh = true; // Ignore if only one ESP32 is used. Set to false +static const char* meshHost = "esp32"; // Ignore if only one ESP32 is used. Ignore if you don't have either meter/contact/motion. Enter the host value of the primary ESP32 if you are using multiple esp32s and you want to mesh them together for better contact/motion +static const bool meshMeters = true; // Mesh meters together if meshHost is set. The meter values will use the meshHost MQTT topics +static const bool meshContactSensors = true; // Mesh contact sensors together if meshHost is set. The contact values will use the meshHost MQTT topics. +static const bool meshMotionSensors = true; // Mesh motion sensors together if meshHost is set. The motion values will use the meshHost MQTT topics +static const bool onlyAllowRootESPToPublishContact = true; // All meshed messages for contact and motions sensors will pass through the root mesh host ESP32. Only the root host will send contact and motion messages +static const bool onlyAllowRootESPToPublishMotion = false; // All meshed messages for motion will pass through the root mesh host ESP32. Only the root host will send motion messages +static const bool onlyAllowRootESPToPublishLight = false; // All meshed messages for illuminance will pass through the root mesh host ESP32. Only the root host will send illuminance messages +static const bool countContactToAvoidDuplicates = true; // count the number of open/close/timeout over all esp32s so that none are duplicated +static const bool countMotionToAvoidDuplicates = false; // count the number of motion/no motion over all esp32s so that none are duplicated +static const bool countLightToAvoidDuplicates = false; // count the number of dark/bright over all esp32s so that none are duplicated +static const int timeToIgnoreDuplicates = 30; // if a duplicate is determined, ignore it within X seconds + + + +/* Switchbot Bot Settings */ +static std::map allBots = { +}; + +/* Switchbot Curtain Settings */ +static std::map allCurtains = { +}; + +/* Switchbot Meter Settings */ +static std::map allMeters = { + { "meterone", "xX:xX:xX:xX:xX:xX" }, + { "metertwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Contact Sensor Settings */ +static std::map allContactSensors = { + { "contactone", "xX:xX:xX:xX:xX:xX" }, + { "contacttwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Motion Sensor Settings */ +static std::map allMotionSensors = { + { "motionone", "xX:xX:xX:xX:xX:xX" }, + { "motiontwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Plug Mini Settings */ +static std::map allPlugs = { +}; + + + +static const int rescanTime = 21600; // Automatically perform a full active scan for device info of all devices every X seconds (default 3 hours). XXXXActiveScanSecs will also active scan on schedule + +static const int defaultBotScanAfterControlSecs = 10; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list +static const int defaultCurtainScanAfterControlSecs = 30; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list. Also used by scanWhileCurtainIsMoving +static const int defaultBotMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for bot every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultCurtainMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for curtain every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultMeterMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for meter temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultMotionMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultContactMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for contact temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultPlugMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultBotActiveScanSecs = 1800; // Default Active Scan for bot every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultCurtainActiveScanSecs = 1800; // Default Active Scan for curtain every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultMeterActiveScanSecs = 3600; // Default Active Scan for meter temp sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultMotionActiveScanSecs = 3600; // Default Active Scan for motion sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultContactActiveScanSecs = 3600; // Default Active Scan for contact temp sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultPlugActiveScanSecs = 3600; // Default Active Scan for motion sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. + +static const bool autoRescan = true; // perform automatic rescan (uses rescanTime and initialScan). +static const bool activeScanOnSchedule = false; // perform an active scan on decice types based on the scheduled seconds values for XXXXActiveScanSecs + +static const bool alwaysMQTTUpdate = false; // If the ESP32 is scanning, always publish MQTT data instead of using set times. ***Note: This creates a lot of MQTT traffic +static const bool onlyActiveScan = false; // Active scanning requires more battery from the BLE switchbot devices. If false, passive scanning is used when possible for contact/motion +static const bool onlyPassiveScan = false; // If this ESP32 is a mesh ESP32 or you only have motion/contact/meter sensors. Passive scanning uses less battery from BLE switchbot devices. Passive scanning provides less data then active scanning, but uses less battery +static const bool alwaysActiveScan = false; // No battery optimizations. If you are using the switchbot hub or app to control devices also and you want immediate state updates for bot and curtains in MQTT set to true diff --git a/Examples/Config-Example2/Mesh-PrimaryESP32-Config-2.txt b/Examples/Config-Example2/Mesh-PrimaryESP32-Config-2.txt new file mode 100644 index 0000000..fe63145 --- /dev/null +++ b/Examples/Config-Example2/Mesh-PrimaryESP32-Config-2.txt @@ -0,0 +1,100 @@ + +/* + * + * THIS EXAMPLE IS FOR THE PRIMARY ESP32 IN A MESH + * + * Choose a balance of settings between active scanning and passive scanning. Active scanning uses more battery of switchbot devices but it required for bot, curtain meter + * + * + * THIS IS NOT THE FULL CODE. These are the settings that apply to a mesh setup + */ + + +/* Wifi Settings */ +static const char* host = "esp32"; // Unique name for ESP32. The name detected by your router and MQTT. If you are using more then 1 ESPs to control different switchbots be sure to use unique hostnames. Host is the MQTT Client name and is used in MQTT topics + +/* Mesh Settings */ +/* Ignore if only one ESP32 is used */ +static const bool enableMesh = true; // Ignore if only one ESP32 is used. Set to false +static const char* meshHost = ""; // Ignore if only one ESP32 is used. Ignore if you don't have either meter/contact/motion. Enter the host value of the primary ESP32 if you are using multiple esp32s and you want to mesh them together for better contact/motion +static const bool meshMeters = true; // Mesh meters together if meshHost is set. The meter values will use the meshHost MQTT topics +static const bool meshContactSensors = true; // Mesh contact sensors together if meshHost is set. The contact values will use the meshHost MQTT topics. +static const bool meshMotionSensors = true; // Mesh motion sensors together if meshHost is set. The motion values will use the meshHost MQTT topics +static const bool onlyAllowRootESPToPublishContact = true; // All meshed messages for contact and motions sensors will pass through the root mesh host ESP32. Only the root host will send contact and motion messages +static const bool onlyAllowRootESPToPublishMotion = false; // All meshed messages for motion will pass through the root mesh host ESP32. Only the root host will send motion messages +static const bool onlyAllowRootESPToPublishLight = false; // All meshed messages for illuminance will pass through the root mesh host ESP32. Only the root host will send illuminance messages +static const bool countContactToAvoidDuplicates = true; // count the number of open/close/timeout over all esp32s so that none are duplicated +static const bool countMotionToAvoidDuplicates = false; // count the number of motion/no motion over all esp32s so that none are duplicated +static const bool countLightToAvoidDuplicates = false; // count the number of dark/bright over all esp32s so that none are duplicated +static const int timeToIgnoreDuplicates = 30; // if a duplicate is determined, ignore it within X seconds + + + +/* Switchbot Bot Settings */ +static std::map allBots = { + { "switchbotone", "xX:xX:xX:xX:xX:xX" }, + { "switchbottwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Curtain Settings */ +static const int curtainClosedPosition = 10; // When 2 curtains are controlled (left -> right and right -> left) it's possible one of the curtains pushes one of the switchbots more open. Change this value to set a position where a curtain is still considered closed +static std::map allCurtains = { + { "curtainone", "xX:xX:xX:xX:xX:xX" }, + { "curtaintwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Meter Settings */ +static std::map allMeters = { + { "meterone", "xX:xX:xX:xX:xX:xX" }, + { "metertwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Contact Sensor Settings */ +static std::map allContactSensors = { + { "contactone", "xX:xX:xX:xX:xX:xX" }, + { "contacttwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Motion Sensor Settings */ +static std::map allMotionSensors = { + { "motionone", "xX:xX:xX:xX:xX:xX" }, + { "motiontwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Plug Mini Settings */ +static std::map allPlugs = { + { "plugone", "xX:xX:xX:xX:xX:xX" }, + { "plugtwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Bot Passwords */ +static std::map allPasswords = { // Set all the bot passwords (setup in app first). Ignore if passwords are not used + { "switchbotone", "switchbotonePassword" }, + { "switchbottwo", "switchbottwoPassword" } +}; + + +static const int rescanTime = 10800; // Automatically perform a full active scan for device info of all devices every X seconds (default 3 hours). XXXXActiveScanSecs will also active scan on schedule + +static const int defaultBotScanAfterControlSecs = 10; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list +static const int defaultCurtainScanAfterControlSecs = 30; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list. Also used by scanWhileCurtainIsMoving +static const int defaultBotMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for bot every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultCurtainMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for curtain every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultMeterMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for meter temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultMotionMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultContactMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for contact temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultPlugMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultBotActiveScanSecs = 1800; // Default Active Scan for bot every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultCurtainActiveScanSecs = 1800; // Default Active Scan for curtain every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultMeterActiveScanSecs = 3600; // Default Active Scan for meter temp sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultMotionActiveScanSecs = 3600; // Default Active Scan for motion sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultContactActiveScanSecs = 3600; // Default Active Scan for contact temp sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. +static const int defaultPlugActiveScanSecs = 3600; // Default Active Scan for motion sensors every X seconds if not active scanned since X seconds. *override with botScanTime list. + +static const bool autoRescan = true; // perform automatic rescan (uses rescanTime and initialScan). +static const bool activeScanOnSchedule = true; // perform an active scan on decice types based on the scheduled seconds values for XXXXActiveScanSecs + +static const bool alwaysMQTTUpdate = false; // If the ESP32 is scanning, always publish MQTT data instead of using set times. ***Note: This creates a lot of MQTT traffic +static const bool onlyActiveScan = true; // Active scanning requires more battery from the BLE switchbot devices. If false, passive scanning is used when possible for contact/motion +static const bool onlyPassiveScan = false; // If this ESP32 is a mesh ESP32 or you only have motion/contact/meter sensors. Passive scanning uses less battery from BLE switchbot devices. Passive scanning provides less data then active scanning, but uses less battery +static const bool alwaysActiveScan = true; // No battery optimizations. If you are using the switchbot hub or app to control devices also and you want immediate state updates for bot and curtains in MQTT set to true \ No newline at end of file diff --git a/Examples/Config-Example2/Mesh-SecondaryESP32-Config-2.txt b/Examples/Config-Example2/Mesh-SecondaryESP32-Config-2.txt new file mode 100644 index 0000000..dceeb87 --- /dev/null +++ b/Examples/Config-Example2/Mesh-SecondaryESP32-Config-2.txt @@ -0,0 +1,83 @@ + +/* + * + * THIS EXAMPLE IS FOR THE SECONDARY ESP32 IN A MESH + * + * Choose a balance of settings between active scanning and passive scanning. Active scanning uses more battery of switchbot devices but it required for bot, curtain meter + * + * + * THIS IS NOT THE FULL CODE. These are the settings that apply to a mesh setup + */ + + +/* Wifi Settings */ +static const char* host = "esp32mesh1"; // Unique name for ESP32. The name detected by your router and MQTT. If you are using more then 1 ESPs to control different switchbots be sure to use unique hostnames. Host is the MQTT Client name and is used in MQTT topics + +/* Mesh Settings */ +/* Ignore if only one ESP32 is used */ +static const bool enableMesh = true; // Ignore if only one ESP32 is used. Set to false +static const char* meshHost = "esp32"; // Ignore if only one ESP32 is used. Ignore if you don't have either meter/contact/motion. Enter the host value of the primary ESP32 if you are using multiple esp32s and you want to mesh them together for better contact/motion +static const bool meshMeters = true; // Mesh meters together if meshHost is set. The meter values will use the meshHost MQTT topics +static const bool meshContactSensors = true; // Mesh contact sensors together if meshHost is set. The contact values will use the meshHost MQTT topics. +static const bool meshMotionSensors = true; // Mesh motion sensors together if meshHost is set. The motion values will use the meshHost MQTT topics +static const bool onlyAllowRootESPToPublishContact = true; // All meshed messages for contact and motions sensors will pass through the root mesh host ESP32. Only the root host will send contact and motion messages +static const bool onlyAllowRootESPToPublishMotion = false; // All meshed messages for motion will pass through the root mesh host ESP32. Only the root host will send motion messages +static const bool onlyAllowRootESPToPublishLight = false; // All meshed messages for illuminance will pass through the root mesh host ESP32. Only the root host will send illuminance messages +static const bool countContactToAvoidDuplicates = true; // count the number of open/close/timeout over all esp32s so that none are duplicated +static const bool countMotionToAvoidDuplicates = false; // count the number of motion/no motion over all esp32s so that none are duplicated +static const bool countLightToAvoidDuplicates = false; // count the number of dark/bright over all esp32s so that none are duplicated +static const int timeToIgnoreDuplicates = 30; // if a duplicate is determined, ignore it within X seconds + + + +/* Switchbot Bot Settings */ +static std::map allBots = { +}; + +/* Switchbot Curtain Settings */ +static std::map allCurtains = { +}; + +/* Switchbot Meter Settings */ +static std::map allMeters = { + { "meterone", "xX:xX:xX:xX:xX:xX" }, + { "metertwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Contact Sensor Settings */ +static std::map allContactSensors = { + { "contactone", "xX:xX:xX:xX:xX:xX" }, + { "contacttwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Motion Sensor Settings */ +static std::map allMotionSensors = { + { "motionone", "xX:xX:xX:xX:xX:xX" }, + { "motiontwo", "yY:yY:yY:yY:yY:yY" } +}; + +/* Switchbot Plug Mini Settings */ +static std::map allPlugs = { +}; + + + +static const int rescanTime = 21600; // Automatically perform a full active scan for device info of all devices every X seconds (default 3 hours). XXXXActiveScanSecs will also active scan on schedule + +static const int defaultBotScanAfterControlSecs = 10; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list +static const int defaultCurtainScanAfterControlSecs = 30; // Default How many seconds to wait for state/status update call after set/control command. *override with botScanTime list. Also used by scanWhileCurtainIsMoving +static const int defaultBotMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for bot every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultCurtainMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for curtain every X seconds. Note: a change in state will be always be published either way during active scanning +static const int defaultMeterMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for meter temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultMotionMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultContactMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for contact temp sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) +static const int defaultPlugMQTTUpdateSecs = 600; // Used only when alwaysMQTTUpdate = false. Default MQTT Update for motion sensors every X seconds. Note: a change in state will be always be published either way at all times (active or passive) + + +static const bool autoRescan = false; // perform automatic rescan (uses rescanTime and initialScan). +static const bool activeScanOnSchedule = false; // perform an active scan on decice types based on the scheduled seconds values for XXXXActiveScanSecs + +static const bool alwaysMQTTUpdate = false; // If the ESP32 is scanning, always publish MQTT data instead of using set times. ***Note: This creates a lot of MQTT traffic +static const bool onlyActiveScan = false; // Active scanning requires more battery from the BLE switchbot devices. If false, passive scanning is used when possible for contact/motion +static const bool onlyPassiveScan = true; // If this ESP32 is a mesh ESP32 or you only have motion/contact/meter sensors. Passive scanning uses less battery from BLE switchbot devices. Passive scanning provides less data then active scanning, but uses less battery +static const bool alwaysActiveScan = false; // No battery optimizations. If you are using the switchbot hub or app to control devices also and you want immediate state updates for bot and curtains in MQTT set to true diff --git a/Examples/MQTTExplorer-MeshExample.png b/Examples/MQTTExplorer-MeshExample.png new file mode 100644 index 0000000..0d45625 Binary files /dev/null and b/Examples/MQTTExplorer-MeshExample.png differ