# BME 280 Usermod - Thermal Shutdown?

**URL:** <https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834>\
**Category:** Usermods\
**Created:** [September 30, 2024, 10:58pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834 "2024-09-30T22:58:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [September 30, 2024, 10:58pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/1 "2024-09-30T22:58:52Z")

</div>

Some might know that I’m building a project where I’d like to minimize the potential of being a fire hazard.

I saw the BME 280 mod, and since I have a couple laying around, I figured that I’d give modding the mod a shot. Unfortunately I need a bit of assistance…

This is what I was thinking:

1. Add a variable to enable thermal shut down.
2. Add a variable to store the shutdown temperature.
3. Use those variables for the json configuration
4. Toggle brightness from x to 0 (turn off) if the current temperature is greater than or equal to the shutdown temperature.
5. Toggle brightness from 0 to whatever x was (turn on), if the current temperature is less than the shutdown temperature.

Anyway, it sort of does what I want, but the state doesn’t remain stable. If the temperature triggers shutdown, it goes off but the state then toggles every 4 - 6 seconds.

This is what I have:

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/2/240e29922fd76685b4d8a58269e1fb763bed34da.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/b/b4a77bef76f201a67a9863cc1aab3d547b24c348.png)

![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/2/28f5db4b2587b6471b4173b5928579626f258a10.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/b/bb2a771c2f551cc68226cd2a184f6f35c36c30f7.png)

This is what the Usermods page looks like:

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/4/444a0ffe4c383e9ff75a832e8d5df3a015a0fbc4.png)

Maybe there’s a better command? I couldn’t find “On” or “Power”.

---

<div class="post-metadata">

**Author:** ![dedehai](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dedehai/32/7265_2.png) [@dedehai](https://wled.discourse.group/u/dedehai)\
**Post date:** [October 1, 2024, 5:42pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/2 "2024-10-01T17:42:03Z")

</div>

try `offMode=true` , this will do the same as pressing the power button in the UI. maybe there is a function you can call instead of just setting offMode.

---

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [October 1, 2024, 9:52pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/3 "2024-10-01T21:52:47Z")

</div>

I tried that, but it reacts the same. I see why:

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/c/c44b54bb745ccfadde24b1771b8a542390ecde73.png)  
and my inner if statements around 246 toggled it on and off as long as the temperature is above the threshold…

No problem. So I thought…  
I added a variable (ThermalShutdownTriggered) that is (should be?) true if the temperature threshold is exceeded, and false when it dips below that and (a new variable for) a hysteresis so the lights don’t flap. It seems however that ThermalShutdownTriggered is never set to true, but I cannot tell.

I tried adding some Debug statements, and looked on the serial monitor, but don’t see anything. If I were programming for my PC, I could just let the debugger run and step through my code, but I don’t see any options for that. Is there a document that explains how?

Here it is. Maybe it’s blatantly obvious to someone else. 😃

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/1/168f7dcf2e3588333734cfb41ae603e03060d48a.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/9/952f618f0842ae75569a60de848bd5752702010c.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/2/2848cab04455903dad676733a5495e48fc4bcbea.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/f/f91b98540bb2e6501b4c8ac95d7d302b3f10cfcf.png)

![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/b/b7ff67aa1f86d3788fb3f6394e31f21e1e8777cd.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/0/08243a93fe42fb2d8260fac65203e6a4f8b6ae55.png)

---

<div class="post-metadata">

**Author:** ![dedehai](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dedehai/32/7265_2.png) [@dedehai](https://wled.discourse.group/u/dedehai)\
**Post date:** [October 2, 2024, 4:02am UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/4 "2024-10-02T04:02:17Z")

</div>

what is the serial output when you enable the debug messages?

---

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [October 2, 2024, 12:48pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/5 "2024-10-02T12:48:40Z")

</div>

This is all I get:  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/a/afd4a81bb440e71ebc0bd39b27f2dc7e99107b2f.png)

In the [common] section of platformio.ini I have this set

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/e/e6616abf167a20101bf10fe13b542602cd7d364d.png)

---

<div class="post-metadata">

**Author:** ![dedehai](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dedehai/32/7265_2.png) [@dedehai](https://wled.discourse.group/u/dedehai)\
**Post date:** [October 2, 2024, 6:10pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/6 "2024-10-02T18:10:57Z")

</div>

you can use `Serial.print()` and `Serial.println()` instead, they work even without debug enabled.

---

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [October 2, 2024, 7:55pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/7 "2024-10-02T19:55:54Z")

</div>

Thank you! I should have thought of that…

I will give it a try tomorrow.

---

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [October 16, 2024, 7:29pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/8 "2024-10-16T19:29:28Z")

</div>

Well, that was ! fun…

First off, I got it working with a bunch of Serial.print\* commands. It was a logic error. Well three or four to be honest… 😉

I have insane amounts of problems with my IDE. It sometimes compiles a new binary, and sometimes doesn’t. I then have to change the target type. If that doesn’t help, I delete the file structure, replace the moded files, run NPM install, and have another go at it. If that doesn’t work, I have to delete the "%userprofile%.platformio directory as well. Are others having these issues, or is it my configuration?

Anyhow, this is what I changed (between “Daro Mod Begin” and “Daro Mod End”), should anyone else want to add this functionality.

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/5/5ed1da3a29a68bcf37e6e0854e92063468d4fdc1.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/2/2d02a3abf176c2ecd6bb1dac996c7ae11bde2a71.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/d/df9bc287e0dc800f01750de2fe627f3f14bd265d.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/a/a68cf75d34ed8bfd73e2089d66528bfc70ce9c39.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/c/ce074bb0e03e0ec8a84730edaac369784e542a01.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/c/c397e6bdf3e112323676d404478ea318f3b04e69.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/b/b20228b4090665a1ee415f9e7473d5bde1a18c78.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/b/ba99d47414e4ede0f4257704f97a6d5a100adf03.png)

---

<div class="post-metadata">

**Author:** ![dedehai](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dedehai/32/7265_2.png) [@dedehai](https://wled.discourse.group/u/dedehai)\
**Post date:** [October 21, 2024, 8:30am UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/9 "2024-10-21T08:30:56Z")

</div>

why not make it available on git so people can pull from there instead?

---

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [October 24, 2024, 5:10pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/10 "2024-10-24T17:10:47Z")

</div>

Because it’s not my user mod and I have no idea how…

---

<div class="post-metadata">

**Author:** ![dedehai](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dedehai/32/7265_2.png) [@dedehai](https://wled.discourse.group/u/dedehai)\
**Post date:** [October 24, 2024, 5:38pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/11 "2024-10-24T17:38:15Z")

</div>

fork it on github, create a new branch, make your changes, commit, share link.

---

<div class="post-metadata">

**Author:** ![Daro66](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/daro66/32/8240_2.png) [@Daro66](https://wled.discourse.group/u/Daro66)\
**Post date:** [October 30, 2024, 6:15pm UTC](https://wled.discourse.group/t/bme-280-usermod-thermal-shutdown/12834/12 "2024-10-30T18:15:01Z")

</div>

I have no clue what that means yet, but I will look into it.

Edit 1. First look: Am I seeing that correctly that forking is making a copy of the repository, and it is only possible for the entire branch(?), not for the individual mod? ACTUALLY: Should this be a different topic?

Edit 2. If I fork the whole repository, create a new branch, change the one user mod, commit it, and share it, am I responsible for keeping everything else up to date, or will everything else not moded by me come from the original?
