It just works

Yes. Much faster when it comes to lights. Wi-fi stability is hands down better than Tasmota. There have been lots of issues with Tasmota falling off wifi. But that’s not the case with ESPHome. I have all of my LED’s on it and haven’t had any trouble. Also I have all of the computing work on my bed sensor happening on the ESP32 instead of having CORE process everthing. Then it only sends over true or false values to CORE. Makes it easier to process and no worries about flooding. And, yes, you can do that on Tasmota (I think) But I … .ME … I programmed the lambda for the bed sensor. That means it’s pretty easy. And ESPHome has a web interface as well. So you’re not missing out in that way, either.
It’s also easy to interface with NR through MQTT.
Did I mention that it’s fast?

1 Like

OK you have convinced me, I definitely will try it out for my fans. My worry is that the only guide I can find online is for an iFan02 not the newest 03/04 (240v/120v) ones.

Depending on your setup, you could lower the cost if you don’t need to open from the middle. Depending on if there is a continuous path from left to right you could clip the curtains together at the middle and run it off of one. Though I would be worried about the strength of the motor at that point.

1 Like

Well, once you have CORE, we’ll try to revisit at that little topic again. Markus just walked to his cabinet of goodies and pulled out some sonoff fan controllers.
:grin:

1 Like

That is another product segment that is severely lacking. If you do not have fan wiring coming to a switch (both power and speed) then you kind of are out of luck. There was that Zigbee Hampton Bay controller from Home Depot for Wink, but that has been discontinued, there are these Sonoff’s, and then there is the Inovelli LZW36’s, but those are OOS everywhere.

1 Like

I’d need them to run independently. I’d never be happy with all or nothing with that. It’s a main source of fresh air (crank out windows) and a source of bright sunlight that you might want to control if you’re spending an afternoon on the couch with a movie.

Well it is not all or nothing, you can still partially open it to anywhere you like, you just would not be able to open one side independently. I couldn’t do it in my case anyway because I had a support in the middle of the curtain rod. But everywhere else, I plan on just a single motor.

yah, I had power and speed run to my fans here. But, it’s a practice that’s missed in most construction nowadays. It’s unfortunate. My thoughts is that line should be run in any living room and bedroom regardless of the presence of a fan or not. Anticipating a fan install at some point is eminent.

1 Like

One of my fans is hardwired with no switch access, and the other is power only. Currently reliant on radio for all speed controls. Not going to be able to change either easily, but I will do my best to mask it. It is currently masked pretty well, I have these in each room so it looks like it is hardwired.

1 Like

That’s the deal-breaker for me. With crank out windows, you have to have the shade all the way up to open the window. Otherwise, the shade will billow and eventually break if the wind should gust.

Doesn’t shelly have a fan controller you could put in there to control? I thought they did. I also read some people wiring the switches into a box in the ceiling (attic) depending on setup and controlling them from there.

Hunter makes a nice fan. Had one in our other house. I can see the possibilities of hooking them up to an esp32. But I tend to shy away from figuring out the electricity part.

Not sure, don’t see anything branded as that, but I guess you could retrofit their dimmer maybe.

Not an option in my case really, open beam celings.

I am not sure why someone would go through the effort really when stuff like the Sonoff iFan exists. I guess to do it on the cheap… Now for devices that have no control, like those Mr. Cool DIY minisplits, I am all about trying to convert those. I wonder if @RRodman has made any progress on that front or if that has been on the backburner.

AFAIK he’s got them working just fine. I guess he and I haven’t talked about that one lately. I kind’ve forgot about it.

Did he end up just kind of wiring a nodeMCU into each air handler? How did he decipher what signals were important?

Update: I looked back over the thread and it looks like he is just using a NodeJS software to interface with their included hardware

1 Like

That’s probably another thing people will want to be working consistently, temperature measurement and then the controls that often flow from that, such as HVAC’s, etc.

My SensorPush temperature / humidity sensors won’t be so much a concern for OLL, as the sensors use Bluetooth and the API is cloud-hosted, but I don’t expect any issues setting this up in NR.

In terms of HVAC, if anyone transitions across that use Mitsubishi’s Kumo / MelCloud / MelView platforms I’d consider writing something, or suggesting people make use of existing Typescript-based integrations.

1 Like

I actually set up an iFan04 with esphome myself a month or so ago, this thread helped me out with the code to get it working.

I had to tweak it a bit to work for my needs, since I’m using mqtt and not homeassistant. I also have a smart dimmer controlling the light, and the iFan controlling just the fan, took some “creative” wiring to make that work. The remote included with the iFan still works too, buzzer and all.

The “light” on the iFan controls the actual light switch via mqtt & node-red, since it’s not actually wired to anything, I did that to maintain a physical switch on the wall, and use of the remote. Was told I couldn’t use picos as wall switches in this room so I made it work

Actually flashing it was fairly easy IMO, I just soldered a pin header into the iFan and used a spare esp32 as a usb-serial adapter.

Here's my code if it helps, cobbled together from that thread and a few other places

substitutions:
name: craft-room-fan
device_description: Sonoff iFan04-L
friendly_name: Craft Room Ceiling Fan

globals:

  • id: target_fan_speed
    type: int
  • id: start_time_offset
    type: int

esphome:
name: ${name}
comment: ${device_description}
platform: ESP8266
board: esp01_1m

on_boot:

priority: 225

# turn off the light as early as possible

then:

- light.turn_off: fan_light

on_loop:
lambda: |-
if (id(start_time_offset) && (millis() > id(start_time_offset))) {
ESP_LOGD(“IFAN04”, “Setting target speed: %d”, id(target_fan_speed));
auto call = id(the_fan).turn_on();
call.set_speed(id(target_fan_speed));
call.perform();
id(start_time_offset) = 0;
}

Disable logging on serial as it is used by the remote

logger:
baud_rate: 0

Enable Home Assistant API

#api:

ota:
password: !secret ota_password

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on

web_server:
port: 80
auth:
username: !secret web_server_username
password: !secret web_server_password

external_components:

  • source: github://ssieb/custom_components
    components: [ ifan04 ]

mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_user
password: !secret mqtt_pass
topic_prefix: home/craftroom/ceilingfan
on_message:
- topic: home/craftroom/ceilingfan/fan/cmnd
qos: 0
payload: PULLCHAIN
then:
- fan.cycle_speed: the_fan
- topic: home/craftroom/ceilingfan/buzzer/cmnd
qos: 0
payload: BEEP4X
then:
- lambda: |-
id(buzzer_pin).turn_on();
delay(400);
id(buzzer_pin).turn_off();
delay(500);
id(buzzer_pin).turn_on();
delay(400);
id(buzzer_pin).turn_off();
delay(500);
id(buzzer_pin).turn_on();
delay(400);
id(buzzer_pin).turn_off();
delay(500);
id(buzzer_pin).turn_on();
delay(400);
id(buzzer_pin).turn_off();

#time:

- platform: homeassistant

id: time_homeassistant

on_time_sync:

- component.update: sensor_uptime_timestamp

uart:
tx_pin: GPIO01
rx_pin: GPIO03
baud_rate: 9600

debug:

sequence:

- lambda: UARTDebug::log_hex(direction, bytes, ‘,’);

ifan04:
on_fan:
- lambda: |-
if (speed) {
auto call = id(the_fan).turn_on();
call.set_speed(speed);
call.perform();
if (id(buzzer_dummy).state) {
switch(id(target_fan_speed)) {
case 3:
id(buzzer_pin).turn_on();
delay(50);
id(buzzer_pin).turn_off();
delay(50);
case 2:
id(buzzer_pin).turn_on();
delay(50);
id(buzzer_pin).turn_off();
delay(50);
case 1:
id(buzzer_pin).turn_on();
delay(50);
id(buzzer_pin).turn_off();
}
}
} else {
id(target_fan_speed) = 0;
id(start_time_offset) = 0;
auto call = id(the_fan).turn_off();
call.perform();
}
on_light:
- switch.toggle: fan_light
on_buzzer:
- switch.toggle: buzzer_dummy

sensor:

- platform: uptime

id: sensor_uptime

- platform: template

id: sensor_uptime_timestamp

name: “${friendly_name} Uptime”

device_class: “timestamp”

accuracy_decimals: 0

update_interval: never

lambda: |-

static float timestamp = (

id(time_homeassistant).utcnow().timestamp - id(sensor_uptime).state

);

return timestamp;

  • platform: wifi_signal
    name: ${friendly_name} Signal
    update_interval: 60s
    state_topic: home/craftroom/ceilingfan/sensor/signal

binary_sensor:

  • platform: gpio
    id: button
    pin: GPIO0
    on_press:
    then:
    - switch.toggle: fan_light

interval:

  • interval: 500ms
    then:
    • if:
      condition:
      not:
      wifi.connected:
      then:
      - light.turn_on:
      id: led1
      brightness: 100%
      transition_length: 0s
      - delay: 250ms
      - light.turn_off:
      id: led1
      transition_length: 250ms

output:

  • platform: template
    id: fanoutput
    type: float
    write_action:

    • lambda: |-
      if (state) {
      int speed = int(state / 0.33);
      if (!id(target_fan_speed) && (speed < 3)) {
      ESP_LOGD(“IFAN04”, “Fan currently off, boosting speed”);
      id(target_fan_speed) = speed;
      state = 1.0;
      id(start_time_offset) = millis() + 5000; // 5 second delay
      } else {
      id(start_time_offset) = 0;
      id(target_fan_speed) = speed;
      }
      }
      if (state < 0.3) {
      // OFF
      id(target_fan_speed) = 0;
      id(start_time_offset) = 0;
      id(fan_relay1).turn_off();
      id(fan_relay2).turn_off();
      id(fan_relay3).turn_off();
      } else if (state < 0.6) {
      // low speed
      id(fan_relay1).turn_on();
      id(fan_relay2).turn_off();
      id(fan_relay3).turn_off();
      } else if (state < 0.9) {
      // medium speed
      id(fan_relay1).turn_on();
      id(fan_relay2).turn_on();
      id(fan_relay3).turn_off();
      } else {
      // high speed
      id(fan_relay1).turn_off();
      id(fan_relay2).turn_off();
      id(fan_relay3).turn_on();
      }
  • platform: gpio
    id: light_relay
    pin: GPIO9
    inverted: true

  • platform: esp8266_pwm
    id: buzzer_pin
    pin: GPIO10
    inverted: true

  • platform: esp8266_pwm
    id: led_pin
    pin: GPIO13
    inverted: true

light:

  • platform: monochromatic
    id: led1
    output: led_pin
    default_transition_length: 0s
    restore_mode: always off

switch:

  • platform: restart
    name: “${friendly_name} Restart”
    state_topic: home/craftroom/ceilingfan/restart/state
    command_topic: home/craftroom/ceilingfan/restart/cmnd

  • platform: template
    id: fan_light
    name: “${friendly_name} Light”
    optimistic: True

output: light_relay

state_topic: home/craftroom/ceilingfan/light/state
command_topic: home/craftroom/ceilingfan/light/cmnd
  • platform: template
    id: buzzer_dummy
    name: “Buzzer”
    optimistic: True
    state_topic: home/craftroom/ceilingfan/buzzer/state
    command_topic: home/craftroom/ceilingfan/buzzer/cmnd

  • platform: gpio
    id: fan_relay1
    pin: GPIO14

  • platform: gpio
    id: fan_relay2
    pin: GPIO12

  • platform: gpio
    id: fan_relay3
    pin: GPIO15

fan:

  • platform: speed
    id: the_fan
    name: “${friendly_name}”
    output: fanoutput
    speed_count: 3
    state_topic: home/craftroom/ceilingfan/fan/state
    command_topic: home/craftroom/ceilingfan/fan/cmnd
    speed_level_state_topic: home/craftroom/ceilingfan/fan/speed_level/state # optional
    speed_level_command_topic: home/craftroom/ceilingfan/fan/speed_level/cmnd # optional
    speed_state_topic: home/craftroom/ceilingfan/fan/speed/state
    speed_command_topic: home/craftroom/ceilingfan/fan/speed/cmnd
2 Likes

I think you forgot to attach the code you used.

:man_facepalming: Whoops! I must’ve still been half asleep, edited with the code now

2 Likes