This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function subscribeToStatusUpdates(topic) { | |
| MQTT.subscribe(topic , function(t, message) { | |
| if (typeof message === "undefined" || message === null) { | |
| print("Received undefined or null message - ignoring"); | |
| return; | |
| } | |
| try { | |
| let payload = JSON.parse(message); | |
| if (payload.source === "button") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let CONFIG = { | |
| // the BTHome motion and light sensors that will report to this device | |
| // add a Bluetooth MAC address for each reporting sensor | |
| sensorMACs: [ | |
| "3c:2e:f5:ba:e8:bd".toLowerCase() // Shelly BLU Motion sensor | |
| ], | |
| lightId: 0, // Channel 0 in Lights x4 mode | |
| fullBrightness: 100, // max when very bright ambient | |
| minBrightness: 5, // min when very dark (soft night light) | |
| timeoutSec: 300, // shared timeout for motion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let CONFIG = { | |
| debug: false, | |
| active: false, // passive BLE scanning is sufficient | |
| // BTHome light sensor(s) that will report to this device | |
| sensorMACs: [ | |
| "3c:2e:f5:ba:e8:bd" // Shelly BLU Motion sensor | |
| ], | |
| lightId: 0, // Channel 0 in Lights x4 mode | |
| fullBrightness: 100, // max brightness | |
| minBrightness: 5, // min brightness (avoid completely dark) |
OlderNewer