This is the first ESPHome device (iFan04-H) so coding isn’t that obvious to me at the moment.
The good news is, I got your code working just fine once I got the basics of getting code to a device. Even managed to add a few diagnostics and an uptime sensor.
However what I’m looking for is a switch to enable/disable the buzzer when required without having edit the code. A liitle help there would be appreciated.
I was using cpyarger’s code. I changed to that one because it had the buzzer working hard coded.
The yaml code you referred too is from one that wouldn’t enable the buzzer regardless of the switch state.
My current code is a merger of the two, mainly to get the other stats like uptime, wifi ssid etc.
I know its a little picky, but I like the little details
I just found this person’s code and it works exceptionally well with the remote so far. Very responsive.
Everyone may want to give it a test and if so report back.
I commented out the controller flash writing stuff. As I never want it to boot up in the last state (power outage or turn on randomly in the night etc.) Always want it off on boot. Probably need to do more than that.
Looks like they also use my I2C addon discovery work.
You can conveniently reuse the buzzer/wifisync buttons on the remote like this for other lights or stuff in the room.
- if: # Press one of the two bottom buttons on the remote Wifi/RF unsync (Do not hold down)
condition:
lambda: return x == "0101000102";
then:
- homeassistant.service:
service: light.toggle
data:
area_id: living_room
Make sure to turn this on to control other devices in HA from the ESPHome device
Thanks for posting this. I just started using esphome and switched this device from tasmota. I actually use smartbulbs in my fan since the sonoff doesn’t dim (the light wire goes right to hot and not through the sonoff). Adding the light.toggle call service for the bulbs right in the config lets me still use the remote to turn the bulbs on and off with no extra automations.
Overall the code works well, but i did have a situation where quickly turning the fan off after first setting it to low caused the fan to come back on high after a few seconds. It was one of the first times after flashing, I’ll have to see if it happens again.
Came here after finding that exact github project. Have you been working with it? I’ve been using your code from earlier this year with no issues. Hate switching code out unless this guy’s git is a better method.
INFO ESPHome 2023.12.5
INFO Reading configuration /config/ifan04.yaml...
WARNING ESP8266: Pin 9 (9-10) might already be used by the flash interface in QUAD IO flash mode.
WARNING ESP8266: Pin 10 (9-10) might already be used by the flash interface in QUAD IO flash mode.
Failed config
uart: [source <unicode string>:15]
Pin 3 is used in multiple places.
- tx_pin:
number: 1
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
analog: False
inverted: False
rx_pin:
number: 3
mode:
input: True
output: False
open_drain: False
pullup: False
pulldown: False
analog: False
inverted: False
baud_rate: 9600
rx_buffer_size: 256
stop_bits: 1
data_bits: 8
parity: NONE
remote_receiver: [source <unicode string>:20]
Pin 3 is used in multiple places.
- pin:
number: 3
mode:
input: True
output: False
open_drain: False
pullup: False
pulldown: False
analog: False
inverted: False
dump: []
tolerance: 25
buffer_size: 1000
filter: 50us
idle: 10ms
memory_blocks: 3
I did a little searching and it sounds like there might be some brand new checking to prevent accidental config errors. I experimented with adding allow_other_uses: True but I couldn’t figure out the syntax.
Things like that are why it was added. You’re using the same pin for uart RX and the remote receiver which really doesn’t make sense and you’re lucky it works.
You know what they say if it’s not broken don’t fix it.
As for me, it was driving the people in my house nuts that the remote wouldn’t properly respond all the time. Nobody else in this thread seems to confirm this behavior or say they don’t use the remote enough for it to matter. To me that is broken. @ssieb told me that the old code defines the UART twice which may be the problem there. The code that rh1rich did does this as well but the remote works 99% of the time with 1 press which is better than barely ever. I made an issue on rh1rich’s repo for it. Also, the ability shown above to reuse two buttons on the remote pretty easily, lets the little people in my house scared of the dark, turn the lights on downstairs from their room instead of waking others up to do that.
The only downfall to this code I see is the dev made this code and then disappeared. They Don’t seem to look at their GitHub issues or may be away on a long vacation UART conflict · Issue #1 · rh1rich/esphome-ifan04 · GitHub So if you find anything wrong you are probably still on your own just like the other methods above to find a way to fix it.
It’s been running pretty much fine all this time so far. I wouldn’t use anything else personally, specifically for the remote responsiveness. I had a few glitches where the remote randomly decided to pick one of the other speeds instead of the one you pressed. Not sure if this is a flaw in the code or the RF remote sending or not receiving the right bit to translate to the right action.
The remote in my scenario is used as the primary switch for the room light so it’s noticeable if it doesn’t work 100% of the time. The controller is directly powered with the hotline no hardwired switch in between. The switch on the wall for the room won’t turn the power to the controller off like most setups, so wondering if maybe people turning off the power to the unit all the time helps with also not seeing remote problems.
@NonaSuomy Would you mind helping guide me on getting a IFAN04-L flashed with esphome and adopted into my local Home Assistant installation? I’m trying to replace a failed Insteon Fanlinc at our second home, which I am only physically at for the next few days. I don’t really care about remotes and/or particular flavors of esphome projects to use, as I just need to be able to automate fan speeds to match the other fans in the house. I soldered pins onto the board and have it physically connected to my Mac which has esphome on it. I am just a n00b at how to proceed from here and cannot find any examples of working yaml that I can use to get it going.