Automated Popcorn Maker Project - OpenHAB 2.x Integration

Hey everyone! I wanted to share a fun project I’ve been working on to add a bit of automation to my movie nights. I’ve always loved the idea of a fully automated home, and what better way to start than with an automated popcorn maker? :popcorn::sparkles:

The Setup

I’ve got a small popcorn maker sitting beside my TV, and I’ve integrated it with OpenHAB 2.x using a Sonoff outlet and a 433Mhz button linked to a Sonoff RFBridge. The setup is pretty straightforward:

  1. Hardware: Popcorn maker plugged into a Sonoff outlet, controlled by a 433Mhz button.
  2. Software: OpenHAB 2.x with MQTT integration for handling the button presses and outlet commands.
  3. Automation: When the button is pressed, OpenHAB triggers the popcorn maker and starts a 5-minute timer.

The Workflow

Here’s how it all comes together:

  1. Press the button to start the popcorn maker.
  2. The outlet turns on, and a 5-minute timer begins.
  3. During the cooking process, the interface shows a working popcorn maker icon.
  4. Once done, a 3-minute cooldown timer starts, and the interface shows a ‘popcorn ready’ icon.
  5. The machine then resets itself for the next use.

The Code

I’ve included the essential parts of my configuration below for anyone interested in replicating this:

Items File

plaintext
Switch Popcorn_maker_power “Popcorn Maker” { mqtt=“<[^command:default], >[command::default]" }
String Popcorn_time “Turn on the Popcorn Maker” { mqtt="<[^command:default], >[command:
:default]” }
Switch Popcorn_maker_countdown_timer “Popcorn Maker Runtime” { expire=“5m, command=OFF” }
Switch Popcorn_maker_done “Popcorn Maker cooldown period” { expire=“2m, command=OFF” }

Rules File

plaintext
rule “Popcorn Maker”
when Item Popcorn_time received command ON
then
logInfo(“INFO”, “[SCRIPT: Places - Workshop] [ RULE: Popcorn Maker”)
say(“Excellent idea - I shall make the popcorn now, Sir!”)
Thread::sleep(10000)
sendCommand(Popcorn_maker_countdown_timer, “ON”)
Popcorn_maker_power.sendCommand(ON)
end

rule “Popcorn Maker Power down & Cool down”
when Item Popcorn_maker_countdown_timer received command OFF
then
logInfo(“INFO”, “[SCRIPT: Places - Workshop] [ RULE: Popcorn Maker Timer shut down”)
sendCommand(Popcorn_maker_power, “OFF”)
sendCommand(Popcorn_maker_done, “ON”)
say(“Just letting it cool down, sir”)
end

rule “Popcorn Maker Cooldown”
when Item Popcorn_maker_done received command OFF
then
logInfo(“INFO”, “[SCRIPT: Places - Workshop] [ RULE: Popcorn all finished, sir - I hope you like it!!”)
say(“Popcorn all finished, sir - I hope you like it!!”)
sendCommand(Popcorn_time, “OFF”)
end

The Interface

I’ve added some custom icons to make it more visually appealing:

  • popcornmaker-off.svg - Popcorn maker in standby
  • popcornmaker-on.svg - Popcorn maker active
  • popcorn_maker_working.svg - Cooking in progress
  • popcorn_maker_done.svg - Ready to serve

Sitemap Example

plaintext
Switch item=Popcorn_time label=“Popcorn Maker” icon=popcornmaker visibility=[Popcorn_time==“OFF”]
Text label=“Popcorn - I’m making it…” icon=popcorn_maker_working visibility=[Popcorn_maker_power==“ON”]
Text label=“Popcorn - Just letting it cool” icon=popcorn_maker_done visibility=[Popcorn_maker_done==“ON”]

Why I Love This

It’s not just about the automation; it’s about the little touches that make home automation fun. The sound of the popcorn maker starting, the countdown timer, and the visual feedback all add up to create a delightful experience. Plus, it’s a great conversation starter when friends come over!

If you’ve got any suggestions on how to improve this or if you’ve built something similar, I’d love to hear about it! :clapper::popcorn: