Control ceiling fan via 433 MHz RF Bridge with Alexa

Here is a little tutorial on how I integrated my new ceiling fan into openHAB.

Because I wanted a modern and simple looking fan I could not find a suitable one hat could be controlled by a Sonoff iFan03.

Instead I bought a Faro Pemba wich comes with a simple 433 MHz remote.

So I bought a Sonoff RF Bridge 433 MHz as a gateway between openHAB (via mqtt) and the ceiling fan.

I flashed the RF Bridge with Tasmota.

Next step was to learn the RF commands like described in the Tasmota Wiki.

Here is the result of my openHAB configuration:

fan.items

Switch  RF01_Reachable    "RF01 reachable [%s]"             <network>                     {mqtt="<[mosquitto:tele/rf01/LWT:state:MAP(reachable.map)]"}
Number  RF01_RSSI         "RF01: RSSI [%d %%]"              <switch>                      {mqtt="<[mosquitto:tele/rf01/STATE:state:JSONPATH($.Wifi.RSSI)]"}
String  RF01_Verbose      "RF01: MQTT return message [%s]"  <signal>                      {mqtt="<[mosquitto:tele/rf01/INFO1:state:default],
                                                                                                 <[mosquitto:stat/rf01/STATUS2:state:default],
                                                                                                 <[mosquitto:stat/rf01/RESULT:state:default]"}

// Deckenventilator

Group   gCeilingFan       "Deckenventilator"                                              {alexa="Endpoint.Fan"}
Number  CeilingFanSpeed   "Deckenventilator Geschw."        <heating>      (gCeilingFan)  {mqtt=">[mosquitto:cmnd/rf01/Backlog:command:0:RfRaw AAB01503080154029E2BE82809090909091818181818091855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:1:RfRaw AAB0150308014A028A2BDE2809090909091818180918181855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:2:RfRaw AAB0150308015E02942BDE2809090909091818180918091855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:3:RfRaw AAB0150308015E02942BDE2809090909091818091818181855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:4:RfRaw AAB0150308014A029E2BD42809090909091818090918181855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:5:RfRaw AAB0150308015E029E2BD42809090909091809181818091855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:6:RfRaw AAB0150308015402942BDE2809090909091809181818181855; RfRaw 0]",
                                                                                           alexa="RangeComponent" [supportedRange="0:6:1",
                                                                                           presets="1=@Value.Low,3=@Value.Medium,6=@Value.High",
                                                                                           friendlyNames="@Setting.FanSpeed,Speed"]}
Switch  CeilingFanPower   "Deckenventilator Power"          <fan_ceiling>  (gCeilingFan)  {mqtt=">[mosquitto:cmnd/rf01/Backlog:command:ON:RfRaw AAB0150308015E02942BDE2809090909091818091818181855; RfRaw 0],
                                                                                                 >[mosquitto:cmnd/rf01/Backlog:command:OFF:RfRaw AAB01503080154029E2BE82809090909091818181818091855; RfRaw 0]",
                                                                                           alexa="PowerController.powerState"}
Switch  CeilingFanRotate  "Deckenventilator Richtung"       <movecontrol>  (gCeilingFan)  {mqtt=">[mosquitto:cmnd/rf01/Backlog:command:ON:RfRaw AAB01503080154029E2BDE2809090909091818181809181855; RfRaw 0]",
                                                                                           autoupdate="false",
                                                                                           alexa="ToggleController.toggleState" [friendlyNames="@Setting.Oscillate,Richtung"]}

fan.rules (Thanks to @jeshab for this)

rule "CeilingFan Power Command"
when
  Item CeilingFanPower received command
then
  if (receivedCommand == ON)
    CeilingFanSpeed.sendCommand(3)
  else
    CeilingFanSpeed.sendCommand(0)
end

rule "CeilingFan Speed Update"
when
  Item CeilingFanSpeed received update
then
  if (CeilingFanSpeed.state == 0)
    CeilingFanPower.postUpdate(OFF)
  else
    CeilingFanPower.postUpdate(ON)
end

fan.sitemap

sitemap fan label="fan"
{
    Frame label="Deckenventilator" {
        Switch    item=CeilingFanPower
        Selection item=CeilingFanSpeed mappings=[0="aus", 1="langsam", 2="2", 3="mittel", 4="4", 5="5", 6="schnell"]
        Switch    item=CeilingFanRotate
        Text      item=RF01_Reachable
        Text      item=RF01_RSSI
        Text      item=RF01_Verbose
    }
}

It can be controlled with Alexa.

The downside of this solution is that there is no feedback from the fan to the bridge/openHAB.
So your smart home does not know if you turned on/off the fan with the remote or if the fan did not respond to your commands.
I did not test the light feature.

Some info about the device:
Model: Faro Pemba 33471
Remote: RH787T

3 Likes

I use the IFAN03 running tasmota with things.

Bridge mqtt:broker:myMQTTBroker [ host="192.168.1.18", secure=false,clientID="myMQTTClient" ]
{
 
    Thing topic fan1 "Dining FAN" {
    Channels:
        Type switch : Power1   "Dining Light "  [ stateTopic="IFANdining/stat/POWER", commandTopic="IFANdining/cmnd/POWER", on="ON", off="OFF" ]
        Type dimmer : fanspeed "Fan Speed"      [ stateTopic="IFANdining/stat/FANSPEED", transformationPattern="JSONPATH:$.FanSpeed", commandTopic="IFANdining/cmnd/FANSPEED", 0="OFF", 1="LOW", 2="MED", 3="HIGH", 2=100  ]
      }
]

Items

Switch Dining_light "Dining Light" { ga="Light", channel="mqtt:topic:myMQTTBroker:fan1:Power1" }
Dimmer Dining_fan "Dining Fan" { ga="Fan" [ speeds="0=off:zero,1=slow:low:one:on,2=medium:two,3=high:three:100", lang="en", ordered=true, roomHint="Dining" ], channel="mqtt:topic:myMQTTBroker:fan1:fanspeed" }

Sitemap

Switch item=Dining_fan icon="fan_ceiling"label="Dining Fan []" mappings=[ 0="OFF", 1="LOW", 2="MEDIUM", 3="HIGH" ]