I've been using an automatic air freshener for quite some time now and I always had the idea to try and hack it so I can connect it with Home Assistant and be able to control it from my smart home system.
The freshener works quite OK on its own, but one of the things I wanted to improve was the ability to turn it off when we are not at home and also to turn it off at night so it does not spray any of the fragrance in vain.
The freshener is manufactured by Air Wick and it has three settings where it can spray fragrance once every 9, 18, or 36 minutes depending on the position of the built-in switch.
When I opened it, I tried to find more details on the used IC but I only managed to find resources in Russian, but that was more than enough info that I needed to solder some wires to the PCB and connect it all up with a NodeMCU board. All of the details are explained in the video below.
The ESPHome configuration code for the device can be found below.
output:
- platform: gpio
id: pin1
pin:
number: D1
inverted: true
- platform: gpio
id: pin2
pin:
number: D2
inverted: true
- platform: gpio
id: pin3
pin:
number: D3
inverted: true
# select:
# - platform: template
# name: Mode
# id: mode
# options:
# - "OFF"
# - "Every 9 Minutes"
# - "Every 18 Minutes"
# - "Every 36 Minutes"
# initial_option: "OFF"
# optimistic: true
# set_action:
# - logger.log:
# format: "Chosen option: %s"
# args: ["x.c_str()"]
button:
- platform: template
id: btn_off
name: "Turn Off"
on_press:
- output.turn_off: pin1
- output.turn_off: pin2
- output.turn_off: pin3
- platform: template
id: btn_slow
name: "Slow"
on_press:
- output.turn_on: pin1
- output.turn_off: pin1
- output.turn_on: pin3
- platform: template
id: btn_medium
name: "Medium"
on_press:
- output.turn_off: pin1
- output.turn_off: pin2
- output.turn_on: pin3
- platform: template
id: btn_fast
name: "Fast"
on_press:
- output.turn_on: pin1
- output.turn_off: pin2
- output.turn_off: pin3
- platform: template
id: btn_spray
name: "Spray"
on_press:
- output.turn_on: pin1
- delay: 100ms
- output.turn_on: pin2
- delay: 1000ms
- output.turn_off: pin1
- output.turn_off: pin2
You can support me and the channel by buying from the links below at no additional cost to you!
- Programmable Air Freshener - https://s.click.aliexpress.com/e/_DCnuejh
- WiFi Air Freshener - https://s.click.aliexpress.com/e/_DeIOIzd
- NodeMCU - https://s.click.aliexpress.com/e/_Ejv5WZD
- Mini PC for Home Assistant - https://s.click.aliexpress.com/e/_msrHCog
- Soldering Station - https://s.click.aliexpress.com/e/_EzQ4Aab
- Screwdriver Set - https://s.click.aliexpress.com/e/_DFvd9Jd
- Repair Toolkit - https://s.click.aliexpress.com/e/_DBnunr5
- Soldering Mat - https://s.click.aliexpress.com/e/_DchreR1
- Multimeter - https://s.click.aliexpress.com/e/_DkGtZpt
- Mini Breadboards - https://s.click.aliexpress.com/e/_DE16dRN