Smart Fragrance Dispenser with Home Assistant

I modified an Air Wick Freshmatic Air Freshener to be able to interact and control it from Home Assistant.
Oct 19, 2023 — 3 mins read — Home Assistant

Smart Fragrance Dispenser with Home Assistant

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!


experiment nodemcu smart home
Read next

Review of a GPS Module Reyax RYS8839 and interfacing it on a PC

A while back I got this RYS8839 GPS module from Reyax to test out so I thought I'll give it a try. The module is super tiny, measuring 11 by...

You might also enojy this

Energy Harvesting Experiments and Examples

During a recent stay at my friend's house, I had the chance to explore and learn more about their smart home system. The system was based on...