I recently purchased some Deta light & fan speed controllers (in Australia). I have another that I’ve had for a while, and just set up a glance card to change the fan speed as well as turn it on or off (Fan control - Album on Imgur)
We also recently added a smart fan to Home Assistant which uses the Tuya MCU. This fan uses a custom fan card (Fan Card - Album on Imgur)
What I would like to do is ‘convert’ the iFan02 output and YAML seen at Sonoff iFan02 — ESPHome so that I can use the custom fan card instead of the glance card for my new light & fan speed controllers. It seems like this is possible but I’m not aware of any possible caveats so just looking for a bit of a nudge in the right direction.
How do the Deta fan controllers get added to HA? Is there an integration fort them or do you use some other method to create the fan entity in HA?
I doubt you could use the iFan02 ESPHome code for that fan since the iFan02 uses a strange remote control functionality that needs that iFan02.h file to do some conversions.
If the Deta fan already exists in HA as a fan entity then you should be able to use one of my fan plugins to control it already like you already use for the Tuya fan.
So, the fan controllers are discovered via the ESPHome Integration, and the fan speed and on/off entities are all added as switches (so a switch each for low/med/high, light, and fan on/off). Here’s how it looks at the moment: Switches - Album on Imgur
you can create a template fan out of those switches and then you can use one of my plugins just like the one you already use.
there are examples of converting a broadlink fan to a fan entity at my github. They likely won’t be exactly what you need (although they might be) but you might be able to use it for inspiration.
Thanks finity. I think I’m close to having this set up, here’s what I have done, using your fan_package_preset_modes_broadlink.yaml example:
Added the ‘script’ section (lines 36 to 106) to scripts.yaml
Added the ‘automation’ section (lines 133 to 184) to automations.yaml
Ignored the switch section as I’ve already got the switches configured in the ESPHome config file
Added the ‘fan’ section (lines 1 to 21) to configuration.yaml
Where I’m stuck is where to put the input_select and input_boolean sections - It has been a couple of weeks since I last looked at this but from memory I tried putting those in the configurations.yaml and HA didn’t like it.
Ok so I dove back into this @finity - Code appears to all be OK unless I am missing something, but the fan control card does nothing when I click on the low/med/high buttons.
@finity thanks again for all your help here, I did a little more research and ended up using the below. It will probably need a little more tweaking, only issue I have now is that because fan_speed is deprecated I need to work out how I can modify this to use the percentage.
I’ve voted to bring the fan_speed back in as well, but based on the below are you able to help me “convert” this at all? I can’t seem to get the ol’ noggin around it.