Open JangoBritt opened 5 years ago
@JangoBritt despite my best intentions (just like you now, 1 example here https://github.com/peterbuga/HASS-sonoff-ewelink/issues/123) people kept asking for this feature but no one was kind enough to explain to me what are exact switch combinations for a fan device, in plain words: what is switch0 doing exactly, switch1 and so on.
if you'll be kind enough, just like you did in the previous issue start a debug session and try to activate all the fan states and post the output here + (very important) the order of what you did so that i can figure how it works exactly. it'll also help if you could post a screenshot from eWeLink app of how the device looks there (like in here https://github.com/peterbuga/HASS-sonoff-ewelink/issues/143 or here https://github.com/peterbuga/HASS-sonoff-ewelink/issues/34)
ps: this is not a priority right now and might take a while to till i might add it. right now the component is plagued by a bug due to the last HA updates that kinda makes to stop working sooo that's on the top list of fixes
No Probs.
CH1 = Light CH2 = Fan Low CH2 + CH3 = Fan Med CH2 + CH4 = Fan High
I started in the OFF state, then cycled through Low, Med, and High, then back to off.
Interestingly, I see that when I switched OFF, CH4 stayed on... so it looks like 3 and 4 remain on, to remember the last fan state.
--------------COPY-FROM-HERE--------------
2019-10-04 18:09:54.222 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "off"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:10:03.139 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:03.146 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:03.148 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:10:03.149 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "off"}
2019-10-04 18:10:03.151 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}]}, "sequence": "1570209002626", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:03.205 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:03.207 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:03.208 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:10:03.209 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "off"}
2019-10-04 18:10:03.211 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}]}, "sequence": "1570209003134", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:05.228 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:10:16.240 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:10:24.316 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:24.320 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:24.327 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "on"}
2019-10-04 18:10:24.333 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "off"}
2019-10-04 18:10:24.334 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "on"}, {"outlet": 3, "switch": "off"}]}, "sequence": "1570209024108", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:24.612 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:24.614 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:24.620 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:10:24.622 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "off"}
2019-10-04 18:10:24.624 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}]}, "sequence": "1570209024343", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:27.200 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "off"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:10:28.303 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:28.307 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:28.315 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "on"}
2019-10-04 18:10:28.317 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "off"}
2019-10-04 18:10:28.317 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "on"}, {"outlet": 3, "switch": "off"}]}, "sequence": "1570209028041", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:38.252 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "on"}, {"outlet": 3, "switch": "off"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:10:47.720 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:47.720 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:47.723 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:10:47.728 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "on"}
2019-10-04 18:10:47.729 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}]}, "sequence": "1570209047628", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:48.011 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:48.026 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:48.215 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "on"}, {"outlet": 3, "switch": "off"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:10:48.222 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "on"}
2019-10-04 18:10:48.234 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "off"}
2019-10-04 18:10:48.235 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "on"}, {"outlet": 3, "switch": "off"}]}, "sequence": "1570209047735", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:49.119 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:10:49.121 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:10:49.124 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:10:49.126 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "on"}
2019-10-04 18:10:49.127 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}]}, "sequence": "1570209049008", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:10:59.216 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:11:08.502 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:11:08.508 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "off"}
2019-10-04 18:11:08.515 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:11:08.517 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "on"}
2019-10-04 18:11:08.518 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "off"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}]}, "sequence": "1570209068428", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:11:09.199 [D] [{"brandName": "Sonoff", "devConfig": {}, "devGroups": [], "name": "OfficeFan", "offlineTime": "2019-09-27T00:15:25.609Z", "online": true, "onlineTime": "2019-09-29T12:32:10.639Z", "params": {"configure": [{"outlet": 0, "startup": "off"}, {"outlet": 1, "startup": "off"}, {"outlet": 2, "startup": "off"}, {"outlet": 3, "startup": "off"}], "fwVersion": "3.1.0", "init": 1, "lock": 0, "pulse": "off", "pulseWidth": 0, "pulses": [{"outlet": 0, "pulse": "off", "width": 1000}, {"outlet": 1, "pulse": "off", "width": 1000}, {"outlet": 2, "pulse": "off", "width": 1000}, {"outlet": 3, "pulse": "off", "width": 1000}], "sledOnline": "on", "switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "off"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}], "version": 8}, "productModel": "iFan02", "type": "10", "uiid": 34}]
2019-10-04 18:11:09.212 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:11:09.217 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "on"}
2019-10-04 18:11:09.224 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:11:09.231 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "on"}
2019-10-04 18:11:09.232 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "on"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}]}, "sequence": "1570209068944", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
2019-10-04 18:11:09.236 [s] {"entity_id": "switch.sonoff_10004bb450_1", "outlet": 0, "state": "on"}
2019-10-04 18:11:09.237 [s] {"entity_id": "switch.sonoff_10004bb450_2", "outlet": 1, "state": "off"}
2019-10-04 18:11:09.239 [s] {"entity_id": "switch.sonoff_10004bb450_3", "outlet": 2, "state": "off"}
2019-10-04 18:11:09.240 [s] {"entity_id": "switch.sonoff_10004bb450_4", "outlet": 3, "state": "on"}
2019-10-04 18:11:09.241 [W] {"action": "update", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "deviceid": "10004bb450", "params": {"switches": [{"outlet": 0, "switch": "on"}, {"outlet": 1, "switch": "off"}, {"outlet": 2, "switch": "off"}, {"outlet": 3, "switch": "on"}]}, "sequence": "1570209068980", "tempRec": "10004bb450", "ts": 0, "userAgent": "app"}
---------------END-OF-COPY----------------
@JangoBritt hey, i've done a bit of work please try this sonoff-ifan branch.
in theory you should see a new sonoff fan
entity, but for the time being all the other (previous) switches will be displayed too (to be removed later if all's good).
i'll appreciate if you can drop a follow anytime you can ;)
Just tested ifan branch with iFan03, it works good as expected.
Yea, that works in Hassio, thanks.
I think there's one small issue though.
The device pulls through to HomeKit, and can see the speed changes, but can't control the speed changes.
I think that the component is able to set the right combination of channels to achieve a hi/med/low speed, and then output that as a percentage in HomeKit, but that it's not doing it the other way round. Even if I specify the speed, rather than scroll to it, it's not reading the 33% output from HomeKit, and turning that back into on/off/off
@JangoBritt
Yea, that works in Hassio, thanks.
great! glad to get another confirmation
The device pulls through to HomeKit, and can see the speed changes, but can't control the speed changes.
well, technically speaking, this is not a problem :P as you've asked if iFan can be enabled to work as defined fan entity within HA. the fact that you want to kick it up a notch and push it over HomeKit is a type of improvement or feature request (and truth be told i have no idea yet how to make the to-from conversion with HomeKit 😬) after i clean the code a bit for this branch/device properly merge it to dev and so on, we can open another issue to address this part (and keep stuff separated)
You are indeed correct :)
@JangoBritt despite my best intentions (just like you now, 1 example here #123) people kept asking for this feature but no one was kind enough to explain to me what are exact switch combinations for a fan device, in plain words: what is switch0 doing exactly, switch1 and so on.
Ok, here's what I get from the fan/light (iFan02)
For some reason my phone doesn't like doing screenshots so.......When looking at the list of devices, I see the iFan02 with a button for the fan and one for the light, indicating (and allowing me to change) the power status for each. Off to one side it also tells me the gear/speed of the fan (1, 2 or 3.) If I tap on that device to show just it, I then get a row of buttons for speed (only one of which is highlighted but there's always one highlighted. Never all three dark.) and then two buttons for power for fan and light. Tapping on the fan power (here or in the list) results in a longer beep if powering off or 1, 2 or 3 beeps when powering on. So if telling Alexa to power it on or off, I can tell what gear it's in when powering on based on sound (and it keeps track of the gear settings.)
In HomeAssistant, I removed the "+1" and thus I have "device CH 0", "device CH 1", "device CH 2" and "device CH 3". CH 0 is the light. I started with CH 1, 2 & 3 all off. I click on CH 1 and get one short beep and the fan comes on low. Leaving that on and turning on CH 2 gives two short beeps and turning it off gets one short beep. If I leave CH 2 off and turn on CH 3, I get three short beeps. No matter if CH 2 or CH 3 is on, turning off CH 1 results in a long beep and the fan powers off. But having CH 1 on and leaving either CH 2 or 3 on and then turning on the other (so that CH 1, 2 and 3 are all on) gives me 4 short beeps, which isn't valid and, depending on the order of things, can actually wind up turning the fan off instead of a super-high speed.
So here's how it all breaks down for me:
If (ch_0==ON)
light=ON;
else
light=OFF;
if (something_changed){
if (ch_1==OFF){
fan=OFF;
longBeep();
//leaves speed set to whatever it was.)
}
If ((ch_1==ON) && (ch_2==OFF) && (ch_3==OFF)){
fan=ON;
speed=1;
shortBeep(speed);
}
If ((ch_1==ON) && (ch_2==ON) && (ch_3==OFF)){
fan=ON;
speed=2;
shortBeep(speed);
}
If ((ch_1==ON) && (ch_2==OFF) && (ch_3==ON)){
fan=ON;
speed=3;
shortBeep(speed);
}
If ((ch_1==ON) && (ch_2==ON) && (ch_3==ON)){
fan=?????????????; //it all depends on what was switched on first, etc. It may be off now
speed=???????????; //or may be on high
shortBeep(4); //This seems to be consistent, at least but doesn't match the
//actual speed OR power status
}
}
HTH
I just found where someone has code for ESPHome for the iFan02 that basically supports what I was showing as to the CH 1-3 (or CH 2-4) that's at https://gist.github.com/quazzie/09ee3ef2c419ecbcf979a7410062481b
In part:
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_fan
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02_fan
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_fan
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_fan
speed: HIGH
- switch.turn_off: update_fan_speed
@prabbit237 thanks for all the inputs, but out of curiosity have you tried the sonoff-ifan
branch yet? i pretty much already implemented the fan entity and kinda works as you described (minus the light, but that's still work in progress)
Sorry, I must have skimmed over those middle messages too fast sigh
Yes, the ifan branch seems to be working fine from my remote testing (I need to wait till I get home later today to make sure it's actually turning the fan off and on but HA says it is.) I still don't care for the +1 in the numbering scheme and removed that again but that's just my personal taste so don't take it personally at all :) I also want to dig a bit more into it and see if I can remove or hide the 1,2&3 from the switches section completely to clean up that section some. But other than that, it looks great. Thanx.
sarcasm And thanx as well for forcing me to actually learn python. I'm still struggling at times with C and C++ and now I gotta learn something ELSE!? sigh^2 /sarcasm
(And I hope ya realize that last WAS a joke laugh)
@prabbit237 all the switch.sonof_ID_1 to _4
entities will disappear and they will be converted in fan.sonoff_ID
and light.sonoff_ID
i don't think you'll need to worry about anything else IMO
How do I get those to disappear? Mine still show up
will disappear
follow the proper tense of the verb :P
i still have some work to do & merge everything
How do I get those to disappear? Mine still show up
I was about to ask the same "stupid question" laugh Actually, I was going to ask "will they disappear when I use that branch (because I was about to say they didn't) or will they disappear with a newer/as-of-yet-unreleased version that you're still working on?" Thanx for the hard work, BTW.
i've merge a bunch of new things in a new dev branch https://github.com/peterbuga/HASS-sonoff-ewelink/tree/dev if someone is willing to test it out
initial beta iFan + RF Bridge + B1 support 💪
Didn't see a comment here for the dev branch commit, it works great for my fan, Alexa works great with it too.
I wonder, is there any way to change the 4-channel fan controller so that it presents as a single entity, with speed control?