Introduction: Control Your Fireplace With HomeKit and Alexa

About: Creator of multiple Apple HomeKit devices using homebridge in an attempt to increase the WAF score of my home automation attempts.

I recently had a gas fireplace installed, that included a remote control. And after seeing a few examples of people integrating their fireplaces into their home control setup's I started looking for the same. My fireplace has this remote control https://valorfireplaces.com/features/remote-contr... which uses Radio between the remote and and the fireplace on 315 Mhz.

Step 1: Pre-Requisites

As a prerequisite for this instructable, I have a gas fireplace with this remote control. If you look at the back of your remote, it needs to have the FCC ID RTD-G6RH and a frequency of 315 Mhz. If you don't have this remote, this instructable is not for you.

Also I have HomeBridge installed and working, and it is integrated with my Alexa.

Step 2: Bill of Materials

For this instructable, I leveraged my existing HomeBridge and Alexa implementation. I have had Homebridge running for a few years, and have also integrated it to my Alexa. The HomeBridge to Alexa integration used this https://www.npmjs.com/package/homebridge-alexa. These are a perquisite and I won't be detailing their setup.

To link my fireplace to this, I needed to add this to the system

Nodemcu ESP8266 - https://www.aliexpress.com/item/10pcs-lot-NodeMcu...

315 Mhz Transmitter - https://www.creatroninc.com/product/315mhz-rf-lin...

Breadboard

To find the codes for the radio remote, I used this NooElec NESDR Mini 2+ 0.5PPM TCXO RTL-SDR & ADS-B USB Receiver Set w/ Antenna, Suction Mount, Female SMA Adapter & Remote Control, RTL2832U & R820T2 Tuner. Low-Cost Software Defined Radio - https://www.amazon.com/gp/product/B00VZ1AWQA/ref=...

Step 3: Find Radio Codes for the Remote

To find the radio remote codes for the fireplace, I followed the steps up to #7 in this instructable. And used the IR Blaster code rather than their code. https://www.instructables.com/id/Reverse-Engineer...

For the fireplace remote I found that the signal was 23 bits long, and that it was repeated 10 times per button press. After analyzing the data in Audacity I came up with these bit patterns for each remote button:

On - 01110100010111000110011

Off - 01110100010111000110111

Up - 01110100010111000111011

Down - 01110100010111000000000

With Zero's being 200 ms of signal and 700 ms of no signal, and One's being 700 ms of signal and 200 ms of no signal. I suspect that the first portion of the data is unique information that identifies my fireplace, and the tail end is the unique command.

My workflow for determining the remote control code was:

1) Capture a button press in QGRX

2) Open the wav file created in step 1, and zoom into the relevant section until it was almost full screen width.

3) Did a screen grab of the individual button press, and saved the file.

4) Opened the screen grab in a spreadsheet, and adjusted the column width so that a column was equal to the width a bit.

5) Recorded if the bit was a zero or one in the row below.

7) Created a formal in the row below, =if(D19=0,"200,700,","700,200,"), and copied this across all the columns. Where D19 was the row above.

8) I then copied the text created by the if statements to my editor

If you convert the On code it would be

200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 700, 200, 200, 700, 200, 700, 700, 200, 700, 200

Do this for each button. The result should be 46 numbers for each button.

Step 4: Setup the Nodemcu As a Radio Transmitter

For the NodeMCU, I used Michael Higgins IR Blaster code to control the transmitter. Details on the installation are here:

https://github.com/mdhiggins/ESP8266-HTTP-IR-Blast...

To connect the Radio Transmitter, I just connected it as if it was an LED, but didn't use any of the resistors or transistor as the transmitter didn't need them.

Transmitter Pins to NodmePins

1 - Ground - Ground on the nodeMCU

2 - Data in - Connected directly to D2

3 - Vcc - Connected directly to Vin ( 5 volts )

4 - Antenna - Connected a 23cm length of wire

Step 5: Setup Homebridge With the Homebridge-HTTP-IRBlaster Plugin

To setup the plugin in HomeBridge I followed the instructions here

https://github.com/NorthernMan54/homebridge-HTTP-I...

And to configure the plugin I created the following config.json entry

{
"accessory": "http-irblaster", "name": "Fireplace", "url": "http://192.168.1.175/json?simple=1", "on_busy": 28000, "off_busy": 5000, "up_busy": 600, "down_busy": 600, "start": 100, "steps": 10, "rdelay": 600, "off_data": [{ "type": "raw", "out": 1, "khz": 500, "data": [200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 700, 200, 200, 700, 700, 200, 700, 200, 700, 200], "pulse": 10, "pdelay": 30 }], "on_data": [{ "type": "raw", "out": 1, "data": [200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 700, 200, 200, 700, 200, 700, 700, 200, 700, 200], "khz": 500, "pulse": 10, "pdelay": 30 }], "up_data": [{ "type": "raw", "out": 1, "data": [200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 700, 200, 700, 200], "khz": 500, "pulse": 10, "pdelay": 30 }], "down_data": [{ "type": "raw", "out": 1, "data": [200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 700, 200, 200, 700, 200, 700, 200, 700, 700, 200, 200, 700, 700, 200, 700, 200, 700, 200, 200, 700, 200, 700, 200, 700, 200, 700, 200, 700, 200, 700, 200, 700, 200, 700, 200, 700], "khz": 500, "pulse": 10, "pdelay": 30 }] }

This entry will not work for your device as the unique code and URL of your device will be different.

The URL would be the address of your device on your network, and you should only change the address portion. i.e. 192.168.1.175 to the values from your setup.

For off_data, on_data, up_data, and down_data change the "data" line to be the value you determined earlier in this.

Step 6: Try It Out

Restart HomeBridge, and you should now see a new accessory called Fireplace, that uses the FAN icon. You should be turn on, off and control the flame height with the Home app. Please note that when the fireplace is busy turning on or off, additional commands will be ignored and the Home app will show an error.

Step 7: Credits

For this particular setup, I have to thank a large number of people for their efforts as my piece of this was rather simple thanks to them sharing their efforts to the community

  • Michael Higgins and his ESP8266-HTTP-IR-Blaster project. This was most of the inspiration
  • veggiebenz and his Instructable

https://www.instructables.com/id/Reverse-Engineer-... for providing the details around decoding radio based remote controls.

Wireless Contest

Participated in the
Wireless Contest