Skip to content

owenb321/hampton-bay-fan-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Hampton Bay Fan MQTT

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

  • ESP8266 development board (Tested with a NodeMCU v2 and a D1 Mini)
  • CC1101 wireless transceiver

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 on/off (payload ON or OFF)
    • home/hamptonbay/<fan_id>/on/state
    • home/hamptonbay/<fan_id>/on/set
  • Fan speed (payload low, medium, or high)
    • home/hamptonbay/<fan_id>/speed/state
    • home/hamptonbay/<fan_id>/speed/set
  • Light on/off (payload ON or OFF)
    • home/hamptonbay/<fan_id>/light/state
    • home/hamptonbay/<fan_id>/light/set

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

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

fan:
- name: "Bedroom Fan"
  state_topic: "home/hamptonbay/1000/on/state"
  command_topic: "home/hamptonbay/1000/on/set"
  percentage_state_topic: "home/hamptonbay/1000/speed/state"
  percentage_value_template: >-
    {% if value == 'off' -%}
    0
    {% elif value == 'low' -%}
    1
    {%- elif value == 'medium' -%}
    2
    {%- else -%}
    3
    {%- endif %}
  percentage_command_topic: "home/hamptonbay/1000/speed/set"
  percentage_command_template: >-
    {% if value | int(default=0) == 0 -%}
    off
    {%- elif value | int(default=0) == 1 -%}
    low
    {%- elif value | int(default=0) == 2 -%}
    medium
    {%- else -%}
    high
    {%- endif %}
  speed_range_max: 3

light:
- platform: mqtt
  name: "Bedroom Fan Light"
  state_topic: "home/hamptonbay/1000/light/state"
  command_topic: "home/hamptonbay/1000/light/set"

About

MQTT / RF Bridge for Hampton Bay Fan control

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages