In our house we like use plugin-in air fresheners around the house, but we always forget them plugged in and constantly keep buying refills. To address this, I have decided to automate their on/off scenario using Apple Home. Initially I was looking for in-wall smart plugs but there was one major challenge specific to my house. Most of the in-wall smart plugs on offer at the time I was shopping needed neutral wire, which i don't have in my house (yes, my house is very old). To overcome this, I started looking for smartplugs that would plug into my current wall outlets. I ended up buying the "VOCOlinc SmartBar Wi-Fi Plug – VP5X" since it already had native support for Homekit.
Also, I wanted to be able to turn on the air freshener at anytime and it would turn off automatically after lets say 45 minutes, unfortunately we can't do that for smartplugs in Apple Home, but we can do so for switches. So I needed a switch that I can control via the Home App which will control the smart plug, this is where "Homebridge Dummy" plugin comes into play. Its simple, easy to configure and reliable. This way, I can have an automation that whenever I turn on the dummy switch it would turn on the smartplug (air freshener) and I have time limit on the smartplug of 45 minutes.
Download and install for your platform here: https://homebridge.io
I have it installed on my Synology NAS
Once installed, you should be able to access your homebridge via http://localhost:8581/
In the Plugins page search for "Homebridge Dummy"
Give your switch a name and choose "Stateful" and restart Homebridge. That is it for the Homebridge configuration.
First automation we need to setup is one that would allow me to turn on the air freshener any time I want and it would automatically turn off after 45 minutes, To do so I used "An Accessory is Controlled" automation to achieve this.
Second automation, is a simple one. In Home App I created a "A Time of Day Occurs" automation that would turn on the dummy switch at 2pm everyday which will turn on the smartplug/air freshener.
Now that turning on the dummy switch and smartplug are tightly coupled together, I needed to create a couple of automations for turning off scenarios.
Once the 45 minutes timer of the smartplug is done and it switched off, the dummy switch stayed in on state. so I had to create another automation that would turn the dummy switch off if the smartplug state is off.
To make switching off the smartplug/air freshener as seamless as turning it on, I needed to create one last automation. This one is a simple "An Accessory is Controlled" automation so I can manually turn off smartplug using the dummy switch. This way we only use the dummy switch to turn on and off the air freshener without having to worry about the smart plug state.