patrickdk77 / hampton-bay-fan-mqtt

MQTT / RF Bridge for Hampton Bay Fan control
16 stars 7 forks source link

Hampton Bay/Fanimation/DawnSun Fan MQTT

Features

Overview

ESP8266 project enabling MQTT control for a Hampton Bay fan with a wireless receiver. Wireless communication is performed with a CC1101 wireless transceiver operating at 303 MHz.

This will also monitor for Hampton Bay RF signals so the state will stay in sync even if the original remote is used to control the fan.

Fan control is not limited to a single dip switch setting, so up to 16 fans can be controlled with one ESP8266.

Dependencies

This project uses the following libraries that are available through the Arduino IDE

Hardware

Setup

Configuration

Change the WIFI_* and MQTT_* definitions in the sketch to match your network settings before uploading to the ESP.

MQTT

By default, the state/command topics will be

fan_id is a 4-digit binary number determined by the dip switch settings on the transmitter/receiver where up = 1 and down = 0. For example, the dip setting:

1 2 3 4

...corresponds to a fan ID of 1000

Home Assistant

When mqtt support for percentage speeds is supported it will use percent instead of speed cmnd and stat

To use this in Home Assistant as an MQTT Fan and MQTT Light, I'm using this config for hamptonbay

fan:
- platform: mqtt
  name: "Bedroom Fan"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  state_topic: "stat/hamptonbay/1000/fan"
  command_topic: "cmnd/hamptonbay/1000/fan"
  percentage_state_topic: "stat/hamptonbay/1000/percent"
  percentage_command_topic: "cmnd/hamptonbay/1000/percent"
  preset_mode_state_topic: "stat/hamptonbay/1000/speed"
  preset_mode_command_topic: "cmnd/hamptonbay/1000/speed"
  preset_modes:
    - "low"
    - "medium"
    - "high"

light:
- platform: mqtt
  name: "Bedroom Fan Light"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  state_topic: "stat/hamptonbay/1000/light"
  command_topic: "cmnd/hamptonbay/1000/light"

For HarborBreeze

fan:
- platform: mqtt
  name: "Bedroom Fan"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  state_topic: "stat/fanimation/1000/fan"
  command_topic: "cmnd/fanimation/1000/fan"
  percentage_state_topic: "stat/fanimation/1000/percent"
  percentage_command_topic: "cmnd/fanimation/1000/percent"
  preset_mode_state_topic: "stat/fanimation/1000/speed"
  preset_mode_command_topic: "cmnd/fanimation/1000/speed"
  preset_modes:
    - low
    - medium
    - high

light:
- platform: mqtt
  name: "Bedroom Fan Light"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  state_topic: "stat/fanimation/1000/light"
  command_topic: "cmnd/fanimation/1000/light"

For Fanimation (can use low/medium/high, or if FANIMATION6 is defined can also use all 6 speeds)

fan:
- platform: mqtt
  name: "Bedroom Fan"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  state_topic: "stat/fanimation/1000/fan"
  command_topic: "cmnd/fanimation/1000/fan"
  percentage_state_topic: "stat/fanimation/1000/percent"
  percentage_command_topic: "cmnd/fanimation/1000/percent"
  preset_mode_state_topic: "stat/fanimation/1000/speed"
  preset_mode_command_topic: "cmnd/fanimation/1000/speed"
  preset_modes:
    - I
    - II
    - III
    - IV
    - V
    - VI

light:
- platform: mqtt
  name: "Bedroom Fan Light"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  state_topic: "stat/fanimation/1000/light"
  command_topic: "cmnd/fanimation/1000/light"

For Doorbells

binary_sensor:
- platform: mqtt
  name: "Doorbell Front"
  state_topic: "stat/doorbell/1/state"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"    
  payload_on: "ON"
  payload_off: "OFF"

- platform: mqtt
  name: "Doorbell Rear"
  state_topic: "stat/doorbell/2/state"
  availability_topic: "tele/rf-fans/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"    
  payload_on: "ON"
  payload_off: "OFF"