joe-ng / homebridge-dyson-link

MIT License
206 stars 40 forks source link

Turning on the fan disables auto mode #72

Open epheterson opened 5 years ago

epheterson commented 5 years ago

It’d be nice to be able to use the Dyson in auto mode as the primary mode. This isn’t actually possible.

To turn on the Dyson, you enable the Fan tile. If auto was previously on, it’s then off.

Auto isn’t off in HomeKit though, due to another issue the tile stays on. You then need to tap the tile twice to turn it off, and on.

So, to turn on the fan to auto mode it requires 3 taps instead of just the 1 to turn it back on.

Can it persist auto mode across a power cycle?

epheterson commented 5 years ago

I think you just need to add auto mode to an if(value == 0) condition here:

                // Try to set the fan status according to the value in the home app
                if(value ==1) {
                    if(this.accessory.getFanSpeedValue() >0 && !this.fanState.fanAuto) {
                        this.log.info(this.displayName + " Try to restore the fan speed state from home app to " + this.accessory.getFanSpeedValue());
                        this.setState({ fnsp: Math.round(this.accessory.getFanSpeedValue() / 10).toString() });
                    }
                    if(this.accessory.isSwingModeButtonOn()) {
                        this.log.info(this.displayName + " Try to restore the fan swing state from home app");
                        this.setState({ oson: "ON" });
                    }
                    if(this.accessory.isNightModeSwitchOn()) {
                        this.log.info(this.displayName + " Try to restore the night mode state from home app");
                        this.setState({ nmod: "ON" });
                    }
                }
epheterson commented 5 years ago

Actually, that alone won't work because we're discarding that auto is on while the fan is off.

Example of my state with the fan off, but Auto still reporting on – Home App shows off:

[2018-11-15 02:09:56] [DysonPlatform] {"msg":"CURRENT-STATE","time":"2018-11-15T10:09:54.000Z","mode-reason":"LAPP","state-reason":"MODE","dial":"OFF","rssi":"-34","channel":"1","product-state":{"fpwr":"OFF","fdir":"ON","auto":"ON","oscs":"OFF","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"OFF","ercd":"NONE","wacd":"NONE","nmdv":"0004","fnsp":"AUTO","bril":"0002","corf":"OFF","cflr":"0100","hflr":"0100","sltm":"OFF","osal":"0180","osau":"0225","ancp":"CUST"},"scheduler":{"srsc":"0000000000000000","dstv":"0000","tzid":"0001"}}
mrowlinson commented 5 years ago

Does it correctly read the fan speed when you have auto on? Mine won’t even do that with my TP04. If auto is on it always reads as 50%

These issues basically make this plugin useless for anything other than seeing if the fan of on or off and using the Air Quality sensor to automatically turn the fan on and off if the air quality drops below ‘good’. Otherwise you still need to just use the Dyson app.

epheterson commented 3 years ago

Yeah I've noticed that with this plugin the fan will always read at 50% if it's set to auto mode for air purification.