Thanks guys.
I’m slightly confused by the whole need for a percentage thing? I mean, the fan has 3 pre-defined speeds and they are provided by 3 relays and two capacitors.
The original remote came with 3 speed buttons and Off, as does the one that came with the iFan04.
Therefore for the most simple control in HA you just need to be able to tell it to turn On/Off any of the 4 relays to ba able to make the fan or light do anything you want?
I understand if you want to use a Voice Assistant (I don’t) or if you have an Up/Down type remote you might want to be able to control the fan speeds with a slider, as would I if the fan actually had a linear speed control, but it doesn’t. ;-(
So last night I spent a good few hours using mostly trial and error and started to trim your .yaml down to something nearer to my needs (without the remote for now) and ended up with this:
esphome:
name: viper-fan
platform: ESP8266
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.0.224
gateway: 192.168.0.100
subnet: 255.255.255.0
ap:
ssid: “Viper hotspot”
password: !secret ap_wifi_password
captive_portal:
web_server:
port: 80
auth:
username: admin
password: !secret api_password
api:
password: !secret api_password
logger:
level: info
baud_rate: 0
ota:
#Wifi Info Text Sensor
text_sensor:
platform: wifi_info
ip_address:
name: Viper IP Address
ssid:
name: Viper SSID
sensor:
- platform: wifi_signal
name: Viper WiFi Signal
update_interval: 60s
switch:
Buzzer Setup
- platform: gpio
name: “Viper buzzer”
id: buzzer
pin:
number: 10
inverted: true
internal: true
restore_mode: ALWAYS_OFF
Fan and light setup
-
platform: gpio
name: “Fan speed 1”
icon: “mdi:fan-speed-1”
id: fan_relay1
pin: 14
interlock: &interlock_group [fan_relay1, fan_relay2, fan_relay3]
restore_mode: ALWAYS_OFF
-
platform: gpio
name: “Fan speed 2”
icon: “mdi:fan-speed-2”
id: fan_relay2
pin: 12
interlock: *interlock_group
restore_mode: ALWAYS_OFF
-
platform: gpio
name: “Fan speed 3”
icon: “mdi:fan-speed-3”
id: fan_relay3
pin: 15
interlock: *interlock_group
restore_mode: ALWAYS_OFF
-
platform: gpio
id: fan_light
name: “Fan Light”
icon: “mdi:lightbulb”
pin: 09
restore_mode: ALWAYS_OFF
-
platform: restart
name: “Restart!”
I’m not sure the light bit is right and haven’t tried to put the buzzer function back in or even if I want it?
Again, I’ve not got it connected to the fan as it’s stripped down but I can hear all 4 relays work when I toggle them on the HA desktop and all the entities appear as expected when you add that ESP integration.(I’m not sure about the purity of the light part though)?
Because the remote supplied with the iFan04 feels a bit crude in use (and I can’t read the icons), I may well just find a ‘better’ Zigbee remote or make one using an ESP32.
My Mrs, although now struggling with the early signs of Dementia can sill use her HA desktop on her smartphone to open / close the curtains and turn the main light on / off so should also be ok with the fan as the 1/2/3 Slow/Med/Fast controls are more intuitive to her because of the existing ‘cyclic’ pull string and radio push-button type fans we have here.
I really wish this coding lark didn’t put my head in a spin (it’s like trying to make sense of an alien language to me) as then I could do more of what I want without having to bother anyone. ;-(