MQTT Fan component is not working : 0.75.2

Need help with the fan component.
Is there a problem with the fan component.

I am trying to connect to a fan component with no luck.

  • platform: mqtt
    name: “Room Fan”
    state_topic: “/home/Room/fan/”
    command_topic: “/home/Room/fanConfirm/”
    speed_state_topic: “/home/Room/speed/”
    speed_command_topic: “/home/Room/speedConfirm/”
    qos: 1
    retain: true
    payload_on: “1”
    payload_off: “0”
    payload_low_speed: “2”
    payload_medium_speed: “3”
    payload_high_speed: “4”
    speeds:
    • Low
    • Medium
    • High

I have used my computer to connect to the MQTT server and subscribe and publish the topics to the device and it works fine.
Whereas the problem is that the front end is not turning ON or OFF the device.

Thanks a Ton!

If you can post the commands and results of this, it would help to see the problem.

Edit:
I just pasted your config into my configuration file and discovered that your quotes are non-ascii characters. I expect you edited them with a word processor rather than an editor. Just remove all the quotes and you should get better results.

@gpbenton, Removed the quotes with no luck.

It looks like a problem with the front end. As I have other topics on the same device that have been configured as switches and they are working.

Whereas the topics that have been set up as a fan aren’t working on the frontend, whereas the same topics published from my computer works.

Not sure, where I am going wrong.

You need to post the output of your successful attempts to get any help. This is the output I get from your configuration (with the quotes removed)

Aug 08 16:06:18 /home/Room/fanConfirm/ 1
Aug 08 16:06:26 /home/Room/fanConfirm/ 1
Aug 08 16:12:32 /home/Room/fanConfirm/ 1
Aug 08 16:13:10 /home/Room/fanConfirm/ 1
Aug 08 16:13:10 /home/Room/speedConfirm/ 3
Aug 08 16:13:23 /home/Room/fanConfirm/ 1
Aug 08 16:13:24 /home/Room/speedConfirm/ 4
Aug 08 16:13:29 /home/Room/fanConfirm/ 1
Aug 08 16:13:29 /home/Room/speedConfirm/ 2
Aug 08 16:13:35 /home/Room/fanConfirm/ 1

Thanks. I am not aware of how to generate the success message as a log. Kindly let me know and I shall post it.
I am using the internal MQTT broker on the same Pi that hassio is hosted.

Do not know how to see the log of the MQTT transactions.

Do you mean the embedded broker, or an addon that runs a mosquitto broker? Please read the MQTT component page to tell the difference.

See the MQTT testing page on how to do this. Note that there are many different clients that can subscribe to the broker, from any machine connected to your network. You do not have to use mosquitto_sub

Sorry with all these question, I am new to this and do not have a background in coding.

I am using the embedded MQTT broaker.

I am using an ESP8266 to connect to the broker, I have 3 switches and 1 fan configuration on the ESP.
The switches are working and connect to the MQTT broker and subscribe to the topic.

Where as the Fan isn’t responding.
I am trying to solve this.

I used my computer to send messages to the ESP and the FAN works, where as I use the front end on the home assistant, and nothing happens.

SO i presumed that there is something wrong at the HA side and trying to Debug it.

Thanks for all the help @gpbenton

If you show what messages you are sending to make it work, I can help, but until you do that there is really nothing else I can do.

I have tested that the fan component in HA sends the messages configured in the configuration file in version 0.75.2

Here is the response on my computer when subscribed to the topics.
Whereas the FAN switch on the front end isn’t still working.

Can you kindly check and advice. @gpbenton.


UPDATED CODE snipped from the configuration file on HA.

fan:

  • platform: mqtt
    name: “Moms Room Fan”
    state_topic: “/home/MomsRoom/fan/”
    command_topic: “/home/MomsRoom/fanConfirm/”
    speed_state_topic: “/home/MomsRoom/speed/”
    speed_command_topic: “/home/MomsRoom/speedConfirm/”
    qos: 1
    retain: true
    payload_on: “1”
    payload_off: “0”
    payload_low_speed: “2”
    payload_medium_speed: “3”
    payload_high_speed: “4”
    speeds:
    • Low
    • Medium
    • High

The quotes are fine, it’s just that they are displayed here incorrectly.

Thank you for all the help @gpbenton.

I figured it out, the state and command topics were called incorrectly. Replaced that and the component and the front end are working as expected.

Thanks a ton.

1 Like