Dumb Fan to Smart Fan with Node-Red

I took a cheap infrared controlled fan and integrated it with Home Assistant using the MQTT Fan component and some logic in Node-Red.

Hardware wise I used a Sonoff POW to determine the state and a Broadlink RM Mini to send the infrared commands.

Node-Red JSON: https://pastebin.com/WYMAbtjF

The state of the fan is determined by the power consumption. When the state changes Node-Red updates the fan entity in HA by sending an appropriate MQTT message. So the state is accurately reflected no matter how the fan is controlled (HA, it’s remote, or the buttons on the fan).

If the fan is turned on/off or speed changed in HA entity, Node-Red determines the correct infrared command to send. This was a little tricky with the speed as the only remote command my fan has is a simple toggle. I used a function node to compare the current speed and the desired speed, and then send the toggle command the appropriate number of times.

More detailed info here

5 Likes

Sweet! I only wish my fans were IR controlled instead of RF at some weird frequency that no one supports. I’ve got a Sonoff iFan 02 on it’s way from china, hopefully it will work for me. The stupid ceiling fans are pretty much the last devices in the house that are not ‘smart’

This is quite slick, thanks for the flow.

I’m curious, does your fan have a light on it, and if so, are you able to detect if it’s on or not, in addition to the fan speed (I suspect not, as the light’s power consumption is probably less than the variations you’re seeing within any given spped now)

I have 6 speed fan with light. Yes there is a significant power increase in power usage with light (20W). But nothing is perfect, i have two identical number consumption at two different speed combined with light. Speed 1 with light on consumes 20W, speed 5 with light off consumes also 20W. The power varies slightly up and down at constant speed, i guess it must be a limitation on the power reader which is a POW1 and 2, i think the pow2 has a better chip and fives more steady reads. I wanted to give shelly1pm a try but stil haven’t bough one.
To simplify this i have a boolean call winter mode, when is on there is no speed evaluation so just any power above 2W i assume the light is on. Since we don’t use the fans on winter sort of works.

my diy project with dumb fan for 20 euro, with connected Sonoff iFan03, flashed Tasmota. Tasmota template set to DN20 and set MQTT to Hass. All is in Node-red