i am getting the above screenshot error , where is the problem ?
Two things:
1 did you restart HA after you installed the card?
2 I’ve never used the UI editor for anything but I’m not 100% sure it supports custom cards (and the error kind of says that). you probably will have to go into the raw editor and add it there.
Otherwise the config in the screen shot looks OK.
EDIT: are you using lovelace thru yaml mode or thru the ui editor?
yes i have restarted HASS many time after loading the card
after ur reply i also tried the RAW editor but same problem .
i have not tried to do anything before with lovelace , this is my first time i am trying with lovelace ,
this Lovelace was installed by default.
Ok, i’m starting to understand the problem…
I’m going to assume from here on out that you have gone to the top right menu and clicked on “configure UI” and then clicked on “take control”.
the problem is that you aren’t using yaml mode so anything you put in ui-lovelace.yaml isn’t even being looked at.
So, what you need to do is go to the raw config editor and paste this at the very top:
resources:
- url: /community_plugin/fan-control-entity-row/fan-control-entity-row.js
type: js
save it and then restart HA.
hopefully, then your lovelace will see the new card and it will work.
is there any way we can flash and use ifan03 with esphome ?
I don’t have an iFan03 so I don’t know if the existing code I’m using for the iFan02 will work for the iFan03 but if I had to guess I would say it wouldn’t. I think I read that the way the remote control works is different between the two and that might make them not compatible.
I can post the code I’m using for the iFan02 if you want to be the guinea pig and try it.
the way I use ESPHome on my device it takes three files:
ifan02.h:
#include "esphome.h"
using namespace esphome;
class IFan02Output : public Component, public output::FloatOutput {
public:
void write_state(float state) override {
if (state < 0.3) {
digitalWrite(5, LOW);
digitalWrite(4, LOW);
digitalWrite(15, LOW);
}
if (state >= 0.32 && state <= 0.34) {
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(15, LOW);
}
if (state >= 0.65 && state <= 0.67) {
digitalWrite(5, HIGH);
digitalWrite(4, HIGH);
digitalWrite(15, LOW);
}
if (state >= 0.9) {
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(15, HIGH);
}
}
};
common_sonoff_ifan02.yaml:
esphome:
name: ${name}
platform: ESP8266
board: esp8285
includes:
- ifan02.h
wifi:
#hostname: ${name}
ssid: !secret wifi_ssid
password: !secret wifi_pwd
#reboot_timeout: 0s
fast_connect: true
manual_ip:
static_ip: ${ip}
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
#password: !secret esphome_api_pwd
reboot_timeout: 0s
ota:
#password: !secret esphome_ota_pwd
binary_sensor:
- platform: gpio
id: vbutton_light
pin:
number: GPIO0
inverted: True
on_press:
then:
- light.toggle: lamp
- platform: gpio
id: vbutton_relay_1
pin:
number: GPIO9
inverted: True
on_press:
then:
- switch.toggle: fan_relay1
- switch.turn_on: update_fan_speed
- platform: gpio
id: vbutton_relay_2
pin:
number: GPIO10
inverted: True
on_press:
then:
- switch.toggle: fan_relay2
- switch.turn_on: update_fan_speed
- platform: gpio
id: vbutton_relay_3
pin:
number: GPIO14
inverted: True
on_press:
then:
- switch.toggle: fan_relay3
- switch.turn_on: update_fan_speed
output:
- platform: custom
type: float
outputs:
id: fanoutput
lambda: |-
auto ifan02 = new IFan02Output();
App.register_component(ifan02);
return {ifan02};
- platform: gpio
pin: GPIO12
id: light_output
light:
- platform: binary
name: ${friendly_name_light}
output: light_output
id: lamp
switch:
- platform: template
id: update_fan_speed
optimistic: True
turn_on_action:
then:
- delay: 200ms
- if:
condition:
and:
- switch.is_off: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_off: ifan02
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02
speed: LOW
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_on: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02
speed: MEDIUM
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_on: fan_relay3
then:
- fan.turn_on:
id: ifan02
speed: HIGH
- switch.turn_off: update_fan_speed
- platform: gpio
pin: GPIO5
id: fan_relay1
- platform: gpio
pin: GPIO4
id: fan_relay2
- platform: gpio
pin: GPIO15
id: fan_relay3
fan:
- platform: speed
output: fanoutput
id: ifan02
name: ${friendly_name_fan}
text_sensor:
- platform: version
name: ${friendly_name} ESPHome Version
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi Signal Strength
update_interval: 60s
sonoff_ifan02.yaml:
substitutions:
name: ifan02
ip: 192.168.1.60
friendly_name: iFan02
friendly_name_light: iFan02 Light
friendly_name_fan: iFan02 Fan
<<: !include common_sonoff_ifan02.yaml
Silly question:
Some fans, already have a device that looks like ifan. You replace it or they need to work both of them at the same time?
Thanks!
you need to replace the existing one with the iFan.
i have a sonoff 4 ch , in which i have used 1 gpio for light and the remaining 3 gpio for controlling fan using interlocking mode in tasmota and it is working , showing all the 4 entities as saperate switches ,
now i want to control that fan like that ifan03 , how can i do that ?
2019-08-16 23:12:40,599 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/tele/STATE
2019-08-16 23:12:40,605 INFO --- MqttFX ClientModel : messageArrived() added: message #45 to topic 'lcwss4/tele/STATE'
2019-08-16 23:12:40,623 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/RESULT
2019-08-16 23:12:40,624 INFO --- MqttFX ClientModel : messageArrived() added: message #46 to topic 'lcwss4/stat/RESULT'
2019-08-16 23:12:40,627 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/POWER2
2019-08-16 23:12:40,628 INFO --- MqttFX ClientModel : messageArrived() added: message #47 to topic 'lcwss4/stat/POWER2'
2019-08-16 23:12:41,142 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/tele/STATE
2019-08-16 23:12:41,143 INFO --- MqttFX ClientModel : messageArrived() added: message #48 to topic 'lcwss4/tele/STATE'
2019-08-16 23:12:41,567 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/tele/STATE
2019-08-16 23:12:41,567 INFO --- MqttFX ClientModel : messageArrived() added: message #49 to topic 'lcwss4/tele/STATE'
2019-08-16 23:12:41,586 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/RESULT
2019-08-16 23:12:41,586 INFO --- MqttFX ClientModel : messageArrived() added: message #50 to topic 'lcwss4/stat/RESULT'
2019-08-16 23:12:41,591 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/POWER2
2019-08-16 23:12:41,591 INFO --- MqttFX ClientModel : messageArrived() added: message #51 to topic 'lcwss4/stat/POWER2'
2019-08-16 23:12:41,616 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/tele/STATE
2019-08-16 23:12:41,617 INFO --- MqttFX ClientModel : messageArrived() added: message #52 to topic 'lcwss4/tele/STATE'
2019-08-16 23:12:41,620 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/RESULT
2019-08-16 23:12:41,620 INFO --- MqttFX ClientModel : messageArrived() added: message #53 to topic 'lcwss4/stat/RESULT'
2019-08-16 23:12:41,624 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/POWER3
2019-08-16 23:12:41,624 INFO --- MqttFX ClientModel : messageArrived() added: message #54 to topic 'lcwss4/stat/POWER3'
2019-08-16 23:12:42,549 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/tele/STATE
2019-08-16 23:12:42,550 INFO --- MqttFX ClientModel : messageArrived() added: message #55 to topic 'lcwss4/tele/STATE'
2019-08-16 23:12:42,559 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/RESULT
2019-08-16 23:12:42,560 INFO --- MqttFX ClientModel : messageArrived() added: message #56 to topic 'lcwss4/stat/RESULT'
2019-08-16 23:12:42,560 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/POWER3
2019-08-16 23:12:42,560 INFO --- MqttFX ClientModel : messageArrived() added: message #57 to topic 'lcwss4/stat/POWER3'
2019-08-16 23:12:42,611 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/tele/STATE
2019-08-16 23:12:42,612 INFO --- MqttFX ClientModel : messageArrived() added: message #58 to topic 'lcwss4/tele/STATE'
2019-08-16 23:12:42,615 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/RESULT
2019-08-16 23:12:42,616 INFO --- MqttFX ClientModel : messageArrived() added: message #59 to topic 'lcwss4/stat/RESULT'
2019-08-16 23:12:42,619 INFO --- MqttFX ClientModel : messageArrived() with topic: lcwss4/stat/POWER4
2019-08-16 23:12:42,620 INFO --- MqttFX ClientModel : messageArrived() added: message #60 to topic 'lcwss4/stat/POWER4'
23:12:11 MQT: lcwss4/stat/POWER3 = OFF
23:12:11 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:11","Epoch":1565977331,"Uptime":"0T11:49:44","UptimeSec":42584,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","POWER4":"ON","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:11 MQT: lcwss4/stat/RESULT = {"POWER4":"ON"}
23:12:11 MQT: lcwss4/stat/POWER4 = ON
23:12:29 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:29","Epoch":1565977349,"Uptime":"0T11:50:02","UptimeSec":42602,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","POWER4":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":76,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:29 MQT: lcwss4/stat/RESULT = {"POWER4":"OFF"}
23:12:29 MQT: lcwss4/stat/POWER4 = OFF
23:12:30 MQT: lcwss4/tele/HASS_STATE = {"Version":"6.6.0.2(5953b8b-sonoff)","BuildDateTime":"2019-07-18T15:01:51","Core":"2_4_2","SDK":"2.2.1(cfd48f3)","Module":"Sonoff 4CH","RestartReason":"Exception","Uptime":"0T11:50:03","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:04","MqttCount":1,"BootCount":1793,"SaveCount":3937,"IPAddress":"192.168.9.84","RSSI":"74","LoadAvg":19}
23:12:41 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:41","Epoch":1565977361,"Uptime":"0T11:50:14","UptimeSec":42614,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"ON","POWER3":"OFF","POWER4":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":76,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:41 MQT: lcwss4/stat/RESULT = {"POWER2":"ON"}
23:12:41 MQT: lcwss4/stat/POWER2 = ON
23:12:42 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:42","Epoch":1565977362,"Uptime":"0T11:50:15","UptimeSec":42615,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"ON","POWER3":"OFF","POWER4":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":74,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:42 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:42","Epoch":1565977362,"Uptime":"0T11:50:15","UptimeSec":42615,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":28,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","POWER4":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":76,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:42 MQT: lcwss4/stat/RESULT = {"POWER2":"OFF"}
23:12:42 MQT: lcwss4/stat/POWER2 = OFF
23:12:42 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:42","Epoch":1565977362,"Uptime":"0T11:50:15","UptimeSec":42615,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":28,"POWER1":"ON","POWER2":"OFF","POWER3":"ON","POWER4":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":78,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:42 MQT: lcwss4/stat/RESULT = {"POWER3":"ON"}
23:12:42 MQT: lcwss4/stat/POWER3 = ON
23:12:43 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:43","Epoch":1565977363,"Uptime":"0T11:50:16","UptimeSec":42616,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":29,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","POWER4":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":74,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:43 MQT: lcwss4/stat/RESULT = {"POWER3":"OFF"}
23:12:43 MQT: lcwss4/stat/POWER3 = OFF
23:12:43 MQT: lcwss4/tele/STATE = {"Time":"2019-08-16T23:12:43","Epoch":1565977363,"Uptime":"0T11:50:16","UptimeSec":42616,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":29,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","POWER4":"ON","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"C8:3A:35:5C:26:62","Channel":11,"RSSI":80,"LinkCount":1,"Downtime":"0T00:00:04"}}
23:12:43 MQT: lcwss4/stat/RESULT = {"POWER4":"ON"}
23:12:43 MQT: lcwss4/stat/POWER4 = ON
I have a fan that is controlled by RF signals that are sent by a Broadlink RM Pro. The Broadlink switches that control the speeds are individual switches that I created in HA so in that respect the set up for that fan is much like yours. The exception is that you have the advantage of having feedback on the state of the fan speed and light.
All of that being said you can create a “template fan” in HA to control your fan on/speed/off settings.
And using the above RF fan I have an example of what needs to be done at my github.
The code you want is below the section that says:
“### the rest of this is for using a Broadlink RF controller to control a dumb fan.####”
It might not work exactly the same for yours because of the extra feedback that you have that I didn’t but it should get you to a starting point to modify it and get yours working.
And…
Did you ever get ESPHome flashed on your iFan03?
No i didnt tried esphome in my ifan03 yet ,
But after using ifan03 with tasmota , i thought y should i but ifan03 for other rooms when i have some sonoff 4ch with me , and i can modify the fan speed with just simple tweaking according to my ifan03 and i did that and its working fine,
But now what i m unable to do is i cannot operate with ha same like my ifan03 buttons .
Help needed
read my post above. especially the part from the beginning up until the “and…”
Hello @finity, and thanks for the code ! I am trying to make it work with an iFan03 and ESPHome.
The good :
I pretty much used your code “as is” except I made some substitutions to the names because my Fan was already called iFan03…
Here is the code i have :
ifan03.yaml
esphome:
name: ifan03
platform: ESP8266
board: esp8285
includes:
- ifan02.h
wifi:
ssid: "xxxxxxx"
password: "xxxxxxx"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
id: vbutton_light
pin:
number: GPIO0
inverted: True
on_press:
then:
- light.toggle: lamp
- platform: gpio
id: vbutton_relay_1
pin:
number: GPIO9
inverted: True
on_press:
then:
- switch.toggle: fan_relay1
- switch.turn_on: update_fan_speed
- platform: gpio
id: vbutton_relay_2
pin:
number: GPIO10
inverted: True
on_press:
then:
- switch.toggle: fan_relay2
- switch.turn_on: update_fan_speed
- platform: gpio
id: vbutton_relay_3
pin:
number: GPIO14
inverted: True
on_press:
then:
- switch.toggle: fan_relay3
- switch.turn_on: update_fan_speed
output:
- platform: custom
type: float
outputs:
id: fanoutput
lambda: |-
auto ifan02 = new IFan02Output();
App.register_component(ifan02);
return {ifan02};
- platform: gpio
pin: GPIO12
id: light_output
light:
- platform: binary
name: Master Fan
output: light_output
id: lamp
switch:
- platform: template
id: update_fan_speed
optimistic: True
turn_on_action:
then:
- delay: 200ms
- if:
condition:
and:
- switch.is_off: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_off: ifan02
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02
speed: LOW
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_on: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02
speed: MEDIUM
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_on: fan_relay3
then:
- fan.turn_on:
id: ifan02
speed: HIGH
- switch.turn_off: update_fan_speed
- platform: gpio
pin: GPIO5
id: fan_relay1
- platform: gpio
pin: GPIO4
id: fan_relay2
- platform: gpio
pin: GPIO15
id: fan_relay3
fan:
- platform: speed
output: fanoutput
id: ifan02
name: Master Fan
text_sensor:
- platform: version
name: Master Fan ESPHome Version
sensor:
- platform: wifi_signal
name: Master Fan WiFi Signal Strength
update_interval: 60s
ifan02_test_yaml
substitutions:
name: ifan02_test
ip: 192.168.1.60
friendly_name: iFan02 Test
friendly_name_light: iFan02 Test Light
friendly_name_fan: iFan02 Test Fan
<<: !include ifan03.yaml
ifan02.h
using namespace esphome;
class IFan02Output : public Component, public output::FloatOutput {
public:
void write_state(float state) override {
if (state < 0.3) {
digitalWrite(5, LOW);
digitalWrite(4, LOW);
digitalWrite(15, LOW);
}
if (state >= 0.32 && state <= 0.34) {
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(15, LOW);
}
if (state >= 0.65 && state <= 0.67) {
digitalWrite(5, HIGH);
digitalWrite(4, HIGH);
digitalWrite(15, LOW);
}
if (state >= 0.9) {
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(15, HIGH);
}
}
};
The code uploads fine with this problem though (in the ifan02_test.yaml file)
I am sure i missed something but don’t know what…perhaps you can spot it.
I am using the fan-control-entity-row from here : https://github.com/finity69x2/fan-control-entity-row , Low and Medium have no effect on the fan, while “high” turns on the fan.
Big caveat though : I actually have not installed it in the ceiling yet , I have it hooked up to this : https://www.amazon.com/SUNON-SP101A-1123HST-GN-2550-Sleeve-Bearing/dp/B00DE2RYWI/ref=sr_1_2?hvadid=77927948435095&hvbmt=be&hvdev=c&hvqmt=e&keywords=sunon+sp101a&qid=1566171131&s=gateway&sr=8-2 and it is very possible that this fan only supports one speed ?
How would one test the setup before actually replacing a working fan and irate an already over-tested spouse if it does not work ?
Thanks for your help !
Since you aren’t using any substitutions in your code then don’t try to compile the “ifan02_test_yaml” file. Just go straight to compiling the ifan03.yaml and see if that works.
And I’m not even sure the same code will work with the new ifan03 since it was made for the ifan02. It’s very possible (likely…?) that any or all of the GPIO’s are different between the two so it would explain why things aren’t working quite right.
I haven’t had a chance to test my ifan03 yet with either tasmota or esphome yet.
Lastly, i don’t know if that fan will work on multiple speeds or not.
The easiest way to tell if it might be working is if you can hear all three relays click when you turn different speeds & the light off & on.
Thanks @finity. Only hearing one click when fan set to High. Your are likely correct, GPIOs are different…Perhaps with time someone with better skills than me will setup iFan03 with ESPhome…
Could it be that it is not working as the ifan03 uses a ESP8285 ?
I doubt that’s the problem. It’s my understanding that there’s not much functional difference between the two chips. I’m pretty sure that even the “board:” setting is the same between the two. But I haven’t checked that to be sure…
But it’s more likely that the two devices use different GPIO’s to control different functions.
Did you get this working eventually? I have the same problem with the lovelace error
This doesn’t work for me for ifan03 with latest tasmota. I see the same error about the missing .js file but the file is there. Home assistant is showing me some warnings in the .js file when I open it with the configurator, could it have smth to do? Any pointers would be appreciated.
If I understand your problem correctly, Tasmota shouldn’t have anything to do with what you are experiencing.
What are the errors and warnings you are seeing?
How did you install the custom component? HACS? Manually?