Gas fireplace (Mertik Maxitrol) with rfxtrx

When I try with this command as device ID I get the following error on start up of Home Assistant:

2019-01-08 20:57:05 ERROR (Thread-12) [homeassistant.components.rfxtrx] Invalid device: 0842010302B6A30000

Hi there,

In case anyone else is looking for a way to control their fireplace using a Mertik Maxitrol remote, I managed to get this working using OpenMQTTGateway, running on an ESP8266 NodeMCU, with a cheap 433MHz transmitter for sending codes to my fireplace. All for less than $10,

In Home Assistant, I then created two switches. One is for power on/off and the other is for flame up/down. I created buttons for these in the Lovelace UI. All working quite nicely.

  - platform: mqtt
    name: Fireplace Power
    command_topic: "home/OpenMQTTGateway/commands/MQTTto433"
    payload_on: '{ "protocol": 31, "delay": 400, "length": 12, "repeat": 150, "value": 1267 }'
    payload_off: '{ "protocol": 31, "delay": 400, "length": 12, "repeat": 10, "value": 1271 }'
    optimistic: false
    retain: false

  - platform: mqtt
    name: Fireplace Flame
    command_topic: "home/OpenMQTTGateway/commands/MQTTto433"
    payload_on: '{ "protocol": 31, "delay": 400, "length": 12, "repeat": 10, "value": 1275 }'
    payload_off: '{ "protocol": 31, "delay": 400, "length": 12, "repeat": 10, "value": 1277 }'
    optimistic: false
    retain: false
3 Likes

Hi,

pkozul, Can you share the NodeMCU code?

In version 0.113 of Home Assistant it will be possible to send RfxTrx event codes with the new rfxtrx.send service.

I just tested this in the beta release and this works great.

First capture and test the needed command code for each button of the fireplace remote in the Rfx Manager application. And copy this code so that it can be used in service call.

So I think this topic can be closed soon.

1 Like

Here is it :

@aerodolphin Due to having to use Ethernet, I am currently controlling our fireplace using ESPHome and an ESP32-POE with 433MHz transmitter.

In case it’s of any help, below is my configuration YAML in ESPHome. As you can see, I have four commands (power on/off, and flame up/down). Each command is defined as a switch (i.e. 433MHz transmitter sends the code to the fireplace), as well as a binary sensor (HA detects when the original remote’s buttons are pressed, and also when the 433MHz transmitter sends the codes). The binary sensors are not really necessary, but I really wanted to make sure I was able to go full circle (due to being a control freak :slight_smile: ).

esphome:
  name: esp32_poe_2
  platform: ESP32
  board: esp32-poe

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12

logger:

api:

ota:

remote_transmitter:
  pin: GPIO32
  carrier_duty_percent: 100%

remote_receiver:
  pin: 
    number: GPIO33
    inverted: True
    mode: INPUT_PULLUP
  filter: 200us # default = 10us
  idle: 4ms # default = 10ms

binary_sensor:

# Fireplace

  - platform: remote_receiver
    name: Fireplace On
    rc_switch_raw:
      code: '1010011110011'
      protocol:
        pulse_length: 380
        sync: [45, 1]
        zero: [1, 2]
        one: [2, 1]
        inverted: true
    filters:
      - delayed_off: 1000ms

  - platform: remote_receiver
    name: Fireplace Off
    rc_switch_raw:
      code: '1010011110111'
      protocol:
        pulse_length: 380
        sync: [45, 1]
        zero: [1, 2]
        one: [2, 1]
        inverted: true
    filters:
      - delayed_off: 1000ms

  - platform: remote_receiver
    name: Flame Up
    rc_switch_raw:
      code: '1010011111011'
      protocol:
        pulse_length: 380
        sync: [45, 1]
        zero: [1, 2]
        one: [2, 1]
        inverted: true
    filters:
      - delayed_off: 1000ms

  - platform: remote_receiver
    name: Flame Down
    rc_switch_raw:
      code: '1010011111101'
      protocol:
        pulse_length: 380
        sync: [45, 1]
        zero: [1, 2]
        one: [2, 1]
        inverted: true
    filters:
      - delayed_off: 1000ms

switch:

# Fireplace

  - platform: template
    name: Fireplace
    icon: "mdi:fireplace"
    optimistic: true
    assumed_state: true
    turn_on_action:
#      - remote_transmitter.transmit_raw:
#          carrier_frequency: 433MHz
#          code: [ 380, -380, 380, -760, 760, -380, 380, -760, 380, -760, 760, -380, 760, -380, 760, -380, 760, -380, 380, -760, 380, -760, 760, -380, 760, -17200 ]
#          repeat:
#            times: 120
      - remote_transmitter.transmit_rc_switch_raw:
          code: '1010011110011'
          protocol:
            pulse_length: 380
            sync: [1, 45]
            zero: [1, 2]
            one: [2, 1]
          repeat:
            times: 120
            wait_time: 10ms
    turn_off_action:
#      - remote_transmitter.transmit_raw:
#          carrier_frequency: 433MHz
#          code: [ 380, -380, 380, -760, 760, -380, 380, -760, 380, -760, 760, -380, 760, -380, 760, -380, 760, -380, 380, -760, 760, -380, 760, -380, 760, -17200 ]
#          repeat:
#            times: 60
      - remote_transmitter.transmit_rc_switch_raw:
          code: '1010011110111'
          protocol:
            pulse_length: 380
            sync: [1, 45]
            zero: [1, 2]
            one: [2, 1]
          repeat:
            times: 60
            wait_time: 10ms

  - platform: template
    name: Flame
    icon: "mdi:fire"
    optimistic: true
    assumed_state: true
    turn_on_action:
#      - remote_transmitter.transmit_raw:
#          carrier_frequency: 433MHz
#          code: [ 380, -380, 380, -760, 760, -380, 380, -760, 380, -760, 760, -380, 760, -380, 760, -380, 760, -380, 380, -380, 380, -760, 760, -380, 760, -17200 ]
#          repeat:
#            times: 60
      - remote_transmitter.transmit_rc_switch_raw:
          code: '1010011111011'
          protocol:
            pulse_length: 380
            sync: [1, 45]
            zero: [1, 2]
            one: [2, 1]
          repeat:
            times: 60
            wait_time: 10ms
    turn_off_action:
#      - remote_transmitter.transmit_raw:
#          carrier_frequency: 433MHz
#          code: [ 380, -380, 380, -760, 760, -380, 380, -760, 380, -760, 760, -380, 760, -380, 760, -380, 760, -380, 760, -380, 760, -380, 380, -760, 760, -17200 ]
#          repeat:
#            times: 60
      - remote_transmitter.transmit_rc_switch_raw:
          code: '1010011111101'
          protocol:
            pulse_length: 380
            sync: [1, 45]
            zero: [1, 2]
            one: [2, 1]
          repeat:
            times: 60
            wait_time: 10ms

For testing purposes, I include all of these entities in a Lovelace card:

I have some photos of the hardware in another post (bottom half of the post):

2 Likes

Based on the message from @Marsman, I have successfully added controls for the Mertik G6R-H4T5 to Home Assistant. After capturing the command codes with RFXmgmr, I have added the following code to configuration.yaml:

input_boolean:
  haard_switch:

switch:
  platform: template
  switches:
    haard_switch:
      value_template: >
        {{ is_state('input_boolean.haard_switch', 'on') }}
      turn_on:
        - service: input_boolean.turn_on
          entity_id: input_boolean.haard_switch
        - service: rfxtrx.send
          data:
            event: 0842010C005A0F0177
      turn_off:
        - service: input_boolean.turn_off
          entity_id: input_boolean.haard_switch
        - service: rfxtrx.send
          data:
            event: 08420118005A0F0074
      icon_template: >-
          {% if is_state('switch.haard_switch', 'on') %}
            mdi:fireplace
          {% else %}
            mdi:fireplace-off
          {% endif %}

Hi Corne. Is it possible to supply me all the events from all the buttons. My remote broke and I would like to control my fireplace by home assistant instead of replacing the remote witch is really expensive and I already have a rfxcom. I can pair it as a new remote.

Thanks

Hi Tekno,

I hereby send you my configuration in HA. I have also added the signal information for Up and Down, however I don’t use these buttons. Good luck!

input_boolean:
  haard_switch:

switch:
  platform: template
  switches:
    haard_switch:
      value_template: >
        {{ is_state('input_boolean.haard_switch', 'on') }}
      turn_on:
        - service: input_boolean.turn_on
          entity_id: input_boolean.haard_switch
        - service: rfxtrx.send
          data:
            event: 0842010C005A0F0177
      turn_off:
        - service: input_boolean.turn_off
          entity_id: input_boolean.haard_switch
        - service: rfxtrx.send
          data:
            event: 08420118005A0F0074
      icon_template: >-
          {% if is_state('switch.haard_switch', 'on') %}
            mdi:fireplace
          {% else %}
            mdi:fireplace-off
          {% endif %}

6-8-2020 05:00:33:781= 08420114005A0F0277
Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 20
ID = 0x05A0F decimal:23055
Command = Up
Signal level = 7 -64dBm

6-8-2020 05:00:54:161= 08420116005A0F0377
Packettype = Thermostat3
subtype = Mertik G6R-H4TB, G6R-H4T5, G6R-H4T, G6R-H4TV21-Z22
Sequence nbr = 22
ID = 0x05A0F decimal:23055
Command = Down
Signal level = 7 -64dBm

Thanks. I will let you know if it worked.

1 Like

I just found out that the Mertik Maxitrol has a (expensive) WiFi module that communicates using a serial interface with the gasblock controller (G6R-R4AU). So the WiFi module is nothing more than a protocol convertor.
If someone does have the WiFi module, we could monitor the serial connection and the integration in HA is piece of cake. :slight_smile:

hi is there still someone working on this?? I got the wifi module, but don’t have the knowledge

If you would have the tools to look into the serial connection between the Wifi module and the controller, that would help us out a lot :slight_smile:

what tool I need to that?? another thing would it be possible somehow hack the API form the myfire app ??

I also have the WiFi module. I asked Mertik about the protocol, but they referred my to the producer of the fireplace?! The I reverseved engineered the android app, but I could see how the actual communication is done.
(https://apkpure.com/myfire/com.iqontrol.mertik)

Any ideas on how to approach this?

Will the WiFi module offer more functionality or performance to HA than the radio version does?

May be this link helps some of you getting rfxtrx working on ghe Mertik Fireplace:

This is an old thread but I found it as I was researching automating my fireplace. I don’t have a Mertik but I have a Valor which appears to use the same Wifi module as Mertik.

I’ve been meaning to attempt to reverse engineer the protocol used for the Wifi app but haven’t been able to spend the time yet. I was able to get a network capture on from my phone while I was using the app. I wasn’t able to easily and quickly decipher the data so I put the project on hold.

Since then I’ve learned a little more. My guess (haven’t verified this yet) is that the app simply sends the same commands as the RF remote but wrapped in TCP. I’d have to do another capture and verify this assumption but if it’s true it should be pretty easy to code something up.

I’ll get around to doing this sometime but if anyone is still interested in working on this and gets to it before I do I could share a network capture.

Hello,

For what it’s worth, I too am about to try to do this with a valor fireplace so any updates or findings in getting this to work would be awesome! My initial approach was going to be to try to capture the codes using an ardunio and a receiver and try to use esphome to build a second remote, but I also admittedly don’t really know what I’m doing…

While searching to see if there was an HA integration I happened across this thread but also this GitHub repo which seems to have done at least something toward getting a working solution with the WiFi module with Homey.

Not much more to add than that unfortunately. Maybe the above helps someone to put something together for the WiFi module.

Did anyone came up with working solution ? My idea was to replace this wifi module of mertik maxitrol with esp32.

I got the source code from apkpure.When i try to run the app in Android studio, it always shows error in String str = BuildConfig.FLAVOR;
^
symbol: variable FLAVOR
location: class BuildConfig

if anyone has any guide in replacing this wifi module, please write. :pray: I have been struggling with this for two weeks, and i have to complete this task. :weary: