Github Boards Devices Community Docs Blog

Multiple Ceiling Fans, Speeds, and Home Assistant

To me, a ceiling fan is a pretty basic item. It typically has 3 speeds and an off button (not even an on typically because if a speed is set, it’s obviously on. Obviously not all cases, but most I have ran into). I feel like Home Assistant makes it over complicated at times.

Anyway, I am having a few a couple issues in a few areas.

  1. When I publish through a mqtt client, its not recognizing the additional settings I am passing in the subject and it simply uses the defaults for protocol, length, etc:

homeassistant/OpenMQTTGateway/commands/MQTTto303/303_6/RFBITS_12/PLSL_370 then a payload of: {“value”: 631} // id rather just use the raw number if possible

I am forced to use:

homeassistant/OpenMQTTGateway/commands/MQTTto303
{"value":631,"protocol":6,"length":12,"delay":370}

for the signal to get repeated with the correct values.

My other confusion is that since there isnt a new topic for each fan, I am not sure if I should even have a state topic in my home assistant configuration. Every button press on a remote is simply going to change the that single subject of ‘homeassistant/OpenMQTTGateway/commands/MQTTto303’ to a new value no matter which fan its for or what button (could even be a light instead of a fan speed, etc). With Home Assistant devs introducing breaking changes constantly, its hard to even know what the correct configs really are. Fan speeds for some reason arent even showing up with the entity. Here is a snippet of by config_RF.h and my fans.yaml

config_RF.h

//303Mhz MQTT Subjects and keys
#define subjectMQTTtoRF    "/commands/MQTTto303"
#define subjectRFtoMQTT    "/303toMQTT"
#define subjectGTWRFtoMQTT "/303toMQTT"
#define RFprotocolKey      "303_" // protocol will be defined if a subject contains RFprotocolKey followed by a value of 1 digit
#define RFbitsKey          "RFBITS_" // bits  will be defined if a subject contains RFbitsKey followed by a value of 2 digits
#define repeatRFwMQTT      true // do we repeat a received signal by using mqtt with RF gateway
#define RFpulselengthKey   "PLSL_" // pulselength will be defined if a subject contains RFprotocolKey followed by a value of 3 digits
// subject monitored to listen traffic processed by other gateways to store data and avoid ntuple
#define subjectMultiGTWRF "+/+/303toMQTT"
//RF number of signal repetition - Can be overridden by specifying "repeat" in a JSON message.
#define RF_EMITTER_REPEAT 8

fans.yaml  

- platform: mqtt
    name: "Master Bedroom Fan"
    state_topic: "homeassistant/OpenMQTTGateway/303toMQTT"
    command_topic: "homeassistant/OpenMQTTGateway/commands/MQTTto303/303_6/RFBITS_12/PLSL_370"
    state_value_template: "{{value_json.value}}"
    payload_on: "119"
    payload_off: "125"
    payload_low_speed: "119"
    payload_medium_speed: "111"
    payload_high_speed: "95"
    speeds:
      - 'low'
      - 'medium'
      - 'high'
    retain: true

  - platform: mqtt
    name: "Patio Fan"
    state_topic: "homeassistant/OpenMQTTGateway/303toMQTT"
    command_topic: "homeassistant/OpenMQTTGateway/commands/MQTTto303/303_6/RFBITS_12/PLSL_370"
    state_value_template: "{{value_json.value}}"
    payload_on: "631"
    payload_off: "637"
    payload_low_speed: "631"
    payload_medium_speed: "623"
    payload_high_speed: "607"
    speeds:
      - 'low'
      - 'medium'
      - 'high'
    retain: true