MQTT Fan State

I have been banging my head against the wall on this one. No matter what I try I can not see the state of this fan in Home Assistant, it only shows as “unkown”. I can see it in MQTT Explorer and if I call the same state topic through a switch but it just will not give me the state when used for the fan below. My preset mode topics work fine but the state_topic does nothing. Any ideas? Thanks.

fan:
 - platform: mqtt
   name: Samuel Fan
   availability_topic: "home/OpenMQTTGateway/LWT"
   state_topic: "home/OpenMQTTGateway/433toMQTT/Samuel_Fan/state"
   command_topic: "home/OpenMQTTGateway/commands/MQTTto433"
   state_value_template: "{{ value_json.value }}"
   payload_on: '{"value":16774298,"protocol":11,"length":24,"delay":386, "repeat": 5}'
   payload_off: '{"value":16774299,"protocol":11,"length":24,"delay":386, "repeat": 5}'
   qos: "0"
   retain: true
   preset_modes:
    - "off"
    - "high"     
    - "medium"
    - "low"
   preset_mode_command_topic: "home/OpenMQTTGateway/commands/MQTTto433"
   preset_mode_command_template: >
     {% if value == 'high' %}
     {"value":16774145,"protocol":11,"length":24,"delay":386, "repeat": 5}
     {% elif value == 'medium' %}
     {"value":16774146,"protocol":11,"length":24,"delay":386, "repeat": 5}
     {% elif value == 'low' %}
     {"value":16774147,"protocol":11,"length":24,"delay":386, "repeat": 5}
     {% else %}
     {"value":16774144,"protocol":11,"length":24,"delay":386, "repeat": 5}
     {% endif %}
   preset_mode_state_topic: "home/OpenMQTTGateway/433toMQTT/Samuel_Fan/speed"
   preset_mode_value_template: "{{ value_json.value }}"

Ok I tried both experiments and neither worked…but in doing so I came up with a third experiment. If I put both of the payload statements to ON and OFF like this it works. Just one problem, now I am not sending the RF code to the fan. Any suggestions?

   payload_on: "ON"
   payload_off: "OFF"

What I’ve noticed is since I have a separate switch setup apart from the fan entity I can control things with that without any issues and the state is consistent. With that being said this is probably the best way for me to go. Thanks.

Can you add a screen grab of MQTT explorer showing what is received when the fans state changes? It can help us understand the format of what is sent and then we can better advise on how to interpret it. Thanks.