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.
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
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.
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
- if:
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();
}
- lambda: |-
-
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
I think you forgot to attach the code you used.
Whoops! I must’ve still been half asleep, edited with the code now
ESPHome on an esp8266, a logic converter to shift between 3.3 and 5v, and a usb endpiece. Using HA for control as it has a pretty interface for it even granny can understand
I would love a walkthrough guide once you have some free time. No rush though as I have not pulled the trigger yet, but given these energy costs, I am thinking that switching from resistive to heat pump heating will be worth its weight in gold.
How do you control ESPHome devices without home assistant? Is there an API where you can send requests via node-red similar to MQTT or do you need a central device manager to handle that like NR or presumably what CORE will have?
Yes. I’ve only ever controlled it through NR. But it will have a direct integration in CORE.
A naive question that probably unmasks how little I paid attention during online meetings …
Which of the following flows is correct for an ip-based device, for example based on EspHome?
Flow 1
- first of all you need to “declare / add” the device to the CORE hub only once
- at this point it is possible to use NR and / or (?) CORE (… rule engine) and any other environments integrated into CORE for writing rules
Flow 2
- “declare / add” the device in NR
- “declare / add” the device in CORE
- at this point I can create rules in NR, CORE, … only for the devices I added in the specific environment
What’s about the flow for zigbee / zwave devices?
What’s about the flow for devices managed by other hubs (for example HE)?
If I can make a wish … once I receive CORE I would like to have some sample video pills on how to implement a motion light for different devices: Shelly, EspHome, Xiaomi or other zigbee on different environments (NR, CORE, …)
Obviously mine is just a wish …
A walkthrough has actually been on my to-do list for awhile now. Sadly with grannies health issues recently I haven’t really had the time for anything. Thankfully we have Markus and April so my current situation hasn’t slowed things down with CORE at all
Although there is an API with ESPHome the most common way to interact with devices outside of HA is by enabling MQTT or the web interface on the device.
Depending on use case you can often set up all the logic on device and eliminate the need for external control entirely. This is especially useful in places where a network connection isn’t easily made available but automation is still desired.