owenb321 / hampton-bay-fan-mqtt

MQTT / RF Bridge for Hampton Bay Fan control
69 stars 18 forks source link

Receiving Remote Messages... #4

Open seastonestu opened 3 years ago

seastonestu commented 3 years ago

Ok getting pretty far with this I have my unit receiving MQTT messages AND receiving something from my remote. From what I can tell the remote triggers no change in the MQTT States nor does the Wemos change the fan when receiving commands from MQTT. I did end up purchasing an SDR(https://www.amazon.com/gp/product/B01GDN1T4S/ref=ppx_yo_dt_b_asin_title_o01_s02?ie=UTF8&psc=1) and got my frequency from the remote (304.95Mhz). Setting the Wemos to that allowed the signals from the remote to show up in the serial data. Also, checked that the signal from the CC1101 is the same frequency as the remote on the SDR and they seem to match perfectly. Here is what I'm getting from the serial data with annotations of each button I'm pressing, also deleted the repeats. Any help would be appreciated.

11 - 2047 - 12 //Light 11 - 3071 - 12 //Lo 11 - 4063 - 12 //Med 11 - 4079 - 12 //Hi 11 - 3583 - 12 //Fan Off 11 - 3839 - 12 //Reverse

patrickdk77 commented 3 years ago

What kind of fan is this, brand and model.

Does the remote have any ids on it?

None of that is needed to make this work, but searching for other source of information would be nice and to check out the fccid info on it.

The Freq used and the code patterns sent doesn't match any of the fans I have done so far. But I can easily add it, just need to tag it correctly so people know what it is, and what it works with.

seastonestu commented 3 years ago

Hampton Bay/Galleria model of the remote is FAN-HD CWE FCC ID: L3HMAY97FANHD It does have dimming and a reverse button but like most people I don't really use either all that often

seastonestu commented 3 years ago

Frequency range actually mentions 305.95 but not what I found in tests. https://fccid.io/L3HMAY97FANHD I can give you the codes on other dip settings to if needed mine was on 0000

patrickdk77 commented 3 years ago

Doing a code with the dip switches set as all 0's would help

patrickdk77 commented 3 years ago

Ok, code added, and it compiles, you will have to see if it works.

the config.h you will need will be like

#define WIFI_PASS "pass"

#define HOSTNAME "rf-fans"
#define OTA_PASS ""

// Configure MQTT broker settings
#define MQTT_HOST "192.168.1.1"
#define MQTT_PORT 1883
#define MQTT_USER "USER"
#define MQTT_PASS "PASS"
#define MQTT_CLIENT_NAME HOSTNAME

// Compile in Hampton Bay (a few of them) UC-7078TR (303.95mhz approx)
#define HAMPTONBAY3
#define HAMPTONBAY3_BASE_TOPIC "hamptonbay3"

then depending on if it works or not you might have to edit hamptonbay3.cpp Looking at the lines RF_PROTOCOL 13, might need to be 11 or something else (I cannot verify the chip used inside the remote) You may have to adjust the TX freq, but I doubt it, in my testing they are not very exact units at all and spray rf over a broad range (I can receive easily 30hkz off freq), making my receiving work for many different rf freqs at once. You would have to use my fork over at: https://github.com/patrickdk77/hampton-bay-fan-mqtt

seastonestu commented 3 years ago

Ok back to not receiving anything in serial monitor what other RF_PROTOCOL Numbers should I try? I can get you a picture of the inside of the remote if that would help. Also just confirming that I did not need to comment out anything in the config.h.

patrickdk77 commented 3 years ago

The one it was giving you was protocol 11, but it doesn't matter what protocol it is for receiving, it will receive any protocol and print it. The protocol is only used for transmitting.

I see it truncated the #define WIFI_SSID in the example I put above.

for receiving the only issue you should have is in rf-fans.h file to change the freq there:

define RX_FREQ 303.870

oh, yes oyu will need to change that, for some reason I thought it said it was on 303.95, but it's 304.95 I'll update the code and push it also so that can be set in config.h instead.