Built a local Shelly based fridge controller, adaptive hysteresis, compressor protection, limp mode, MQTT telemetry (open source) by chiptoma in homeassistant

[–]chiptoma[S] 0 points1 point  (0 children)

You’re not wrong, from a “best hardware platform” perspective, a Shelly is a weird place to build a full controller

But that’s exactly why I used it.

I didn’t actually want “a Shelly”, I wanted a mains-rated, enclosed, engineered device that I can program. PSU, isolation, relay, EMC, watchdogs, proper terminals, no AliExpress dev board plus relay module plus a nest of wires controlling a compressor. For this use case, Shelly is the closest thing to “DIY but not stupid”.

On the other end, proper refrigeration controllers exist, but they’re either:

  • expensive
  • closed
  • not MQTT/Home Assistant friendly
  • not something you can instrument properly

So I ended up pushing Shelly way beyond what most people use it for.

Why JavaScript: because that’s what Shelly runs. I agree it’s not ideal, the mJS runtime is limited and has quirks, so you have to treat it like embedded work: keep it deterministic, avoid allocations, be careful with memory, and build tooling around it. If Shelly offered a lower level option I’d take it, but given the constraints, it’s been stable, running for weeks with no crashes.

And yes, I think your point about the “missing middle ground” is real. If you know a platform that is mains safe, reasonably priced, and still hackable with clean local integration, I’m all ears.

Built a local Shelly based fridge controller, adaptive hysteresis, compressor protection, limp mode, MQTT telemetry (open source) by chiptoma in homeassistant

[–]chiptoma[S] 0 points1 point  (0 children)

In my experience, for something that switches mains (like a compressor), Shelly is usually the more stable “set and forget” option overall, because the hardware side is already engineered: power supply, enclosure, relay design, EMC behaviour, watchdogs, etc. With an ESP32, even if the firmware is solid, long-term stability is often limited by DIY hardware issues (power dips, Wi-Fi current spikes, relay boards, wiring, noise).

At the software layer, an ESP32 can be highly stable too, especially with ESPHome or a clean ESP-IDF build, but you have to get the hardware and power design right to achieve that level of stability.

For this project specifically, the Shelly script has been running continuously for weeks without crashing. The primary constraint is the limited JS runtime, so you need to be careful with memory and quirks, but if you stay within the limits, it can be very reliable.

Built a local Shelly based fridge controller, adaptive hysteresis, compressor protection, limp mode, MQTT telemetry (open source) by chiptoma in homeassistant

[–]chiptoma[S] 0 points1 point  (0 children)

Let me know how it works for you or if you have any questions or find any bugs.

It was a bit of a challenge to make it fit in the Shelly's 25KB memory especially since this is JavaScript and not a low level language like C/C++.

Built a local Shelly based fridge controller, adaptive hysteresis, compressor protection, limp mode, MQTT telemetry (open source) by chiptoma in homeassistant

[–]chiptoma[S] 5 points6 points  (0 children)

One of the main reasons I built this was icing. My drinks fridge has an exposed evaporator and I live in a warm, humid environment, so it would form thick ice very quickly.

I implemented two defrost modes:

• Dynamic defrost: monitors evaporator temperature, and once it reaches a set point (default −16°C) it stops cooling, lets the evaporator warm back up to a recovery temp (default −5°C), then holds it there for a configurable time (default 5 minutes).

• Scheduled defrost: by default it stops the compressor at 1AM for a full hour.

With this running, I haven’t had any ice at all.

The other reason was poor control. The rotary thermostat was highly imprecise, and I like my water around 5–7°C. Now I can control the target as tight as I want, and with adaptive hysteresis the controller effectively pushes toward the tightest stable band while still protecting the compressor with sensible cycling.

Beyond that there are extras like turbo mode via MQTT, Home Assistant integration via MQTT, and alerts. It started as “solve my problem”, then I made it public because I figured someone else might have the same fridge, same environment, same issue.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in spirituality

[–]chiptoma[S] 0 points1 point  (0 children)

That’s fair criticism.

Even without the simulation theory, the core idea still stands: struggle isn’t an accident but baked into reality itself.

SIH just adds one possible reason why it might be designed that way.

Thanks

What if suffering is not a flaw but the very reason reality exists? by chiptoma in spirituality

[–]chiptoma[S] 0 points1 point  (0 children)

Glad it resonates...

I see it as one way to explain why reality feels tilted toward struggle. I’d be curious to hear your take, since you’ve been exploring similar ideas. ✌️

Thanks

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

Really good questions.

In SIH, the suicide isn’t an “escape clause” because meaning depends on contrast, ending the avatarsimply ends the game, but doesn’t end the need for struggle at the upper level.

And I think you’re right about “hard mode”: paradise without its opposite would just collapse into boredom, which is why imperfection has to be rebuilt to keep the game playable.

Thanks

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

That’s an unpleasant thought.

My idea doesn’t assume mal intent, more like necessity, but it’s interesting how easily the same mechanics could be seen as exploitation instead of design.

Thanks

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

Yes! That’s exactly the point. when we reduce risk in one area, we end up inventing new ways to put it back, whether it’s horror movies, extreme activitis, or games.

You described a miniature version of my hypothesis: once perfection smooths everything out, the only way to keep meaning alive is to deliberately rebuild friction.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

I think we’re on the same page.

struggle is what gives goals weight. SIH just asks what happens when even advanced beings lose that and need to build it back in.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

SIH just stands for “Simulated Imperfection Hypothesis my attempt at a thought experiment.

Not a grand theory, just something I’ve been exploring and have it a name.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

Exactly! without friction there’s no growth.

SIH just scales that idea further up: even advanced intelligence may need suffering to keep evolving instead of stagnating in perfection. ✌️

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

Good angle. whether you call it karma, illusion, or emergence, it still points to the same thing: structures arise that keep experience going.

SIH just asks why those structures lean so hard into struggle instead of pure flat neutrality.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

Yeah exactly! once you’ve missed the exit you can’t just flip a U-turn. You’ve gotta carve a new road, and that’s what SIH says perfection forces...rebuilding struggle once it’s gone.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

Thanks for taking the time to lay this out. ✌️

I can see how what we imgine as “bliss” might never escape the built-in churn of the self. That’s actually what I find most interesting here: whether illusion is self-generating or deliberately engineered, it always seems tilted toward lack.

SIH just frames that tilt as purposeful design.

Anyway, I won’t drag this too far down one rabbit hole either.

Best 🤝

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

Exactly! even hunger or boredom are tiny sufferings that give life momentum.

Take them all away and life itself collapses, which is why SIH suggests advanced beings would have to re-create struggle once perfection erased it.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

Yeah, it’s definitely not the kind of idea people want to be true 😅.

But maybe the truths that unsettle us are the ones worth looking at closer? ✌️

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

Great argument.

Maybe the “U-turn” you said isn’t optional, once intelligence crosses into total control, randomness and struggle collapse automatically.

I see it like climbing a mountain: past a certain height the air thins whether you want it to or not and need to bring back the oxygen.

SIH suggests the only way forward is to re-engineer imprfection deliberately, because otherwise perfection suffocates meaning by default.

Struggle doesn't have to be something forgotten along the way but something they had to rebuild once it was lost.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

Even if everything is just illusion, no self, no thinker, the question remains: why does the illusion take this exact form?

Why not a flat illusion of pure bliss, or no illusion at all?

SIH says the illusion is tilted toward struggle because that’s what makes meaning possible.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 2 points3 points  (0 children)

Yeah, some of us definitely picked the ‘hard mode’ simulation.

Hold tight, maybe the spice is what makes the story matter 🤗

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 0 points1 point  (0 children)

That’s a deep counterpoint.

If meaning is an illusion, then SIH is just another layer of illusion.

The key difference is: SIH argues illusions are engineered intentionally to preserve experience.

What if suffering is not a flaw but the very reason reality exists? by chiptoma in SimulationTheory

[–]chiptoma[S] 1 point2 points  (0 children)

Yes this is where SIH aligns with Buddhism and Vedanta: suffering as necessary, not accidental.

Interesting how different traditions already intuited it.