homebridge-miot icon indicating copy to clipboard operation
homebridge-miot copied to clipboard

Replace switch by heater cooler for Air Fryer

Open nicoodeimos opened this issue 2 years ago • 7 comments

So I have just purchased a Xiaomi Air Fryer with identifier careli.fryer.maf02.

Everything works great, but I was wondering if is it possible to use the heater cooler accessory switch to turn on/off heating, instead of an additional switch? As this model supports target temperature, the default heater cooler HomeKit accessory already has a tiny switch to enable heating/cooling. On the current implementation, only the main additionnal button turns the fryer on/off. The heater cooler switch does nothing. image

Additionally, I was wondering if it could be possible to support current temperature in the heater cooler? It always seems to return 0.0 degrees when heating or off. Would it be possible to return the target temp as the current temp when heating? I noticed the specs as reference to a custom:work-temp property.

Finally, there is a "remaining time" Lux sensor that is always shown, whether the heater is on or off. Can it be temporary hidden if fryer is off? I don't really know if HomeKit supports this natively.

Many thanks!

nicoodeimos avatar Jul 14 '22 11:07 nicoodeimos

Yeah, there was a reason why it is like it is right now, but I honestly forgot why😅

With the remaining time at least it is not possible or at least not good behavior to remove and add service on the fly depending on the device state, so that will always have to be there.

There stuff I guess is a comprise which has to be taken right now because it is included in the oven module... maybe I would need to make a special module for air fryers...

merdok avatar Jul 14 '22 14:07 merdok

I guess it’s because some ovens do not support target temperature? Which I understand why a single button is necessary. What about having the heater cooler for accessories that support temperature and button devices that don’t? Or maybe you wanted temperature to be set before starting the fryer? that would be 100% more satisfying to use ❤️

nicoodeimos avatar Jul 14 '22 14:07 nicoodeimos

Also, what about having the target temp instead of 0.0 degrees when fryer is on? 68DF3D86-609F-4C5E-933B-0B7BAA389BAC

nicoodeimos avatar Jul 14 '22 14:07 nicoodeimos

I also have the same air fryer and I did the development by testing it in my device. Some stuff is not so intuitive when using the miot spec api. You are right with the temp, the same goes for time, they both need to be set before even starting the cooking. When using the heater service as soon as you start choosing the temperature the air fryer will start and the temperature cannot be set anymore during that period. That more or less means I would need to constantly turn off the device set temperature and turn it in again when you drag to choose the target temperature. You have to keep in mind that HomeKit officially does not support ovens or cooking device, hence some devices will only work with some workarounds.

merdok avatar Jul 14 '22 14:07 merdok

Just tested and it seems that the temp and time can be adjusted on the device and via HomeKit when the fryer is on.

nicoodeimos avatar Jul 14 '22 16:07 nicoodeimos

What happens when you change the time or temp during an active cooking phase?

merdok avatar Jul 14 '22 17:07 merdok

It changes on the oven, and vice-versa. If you long press the knob, the fryer will even allow you to do it manually.

nicoodeimos avatar Jul 14 '22 17:07 nicoodeimos

Hey @merdok, thank you for your work on this. Just updated, but it looks like the main service is now a lightbulb and not the heater cooler. Was the last release supposed to fix the issue discussed here or not? Many thanks !

nicoodeimos avatar Sep 05 '22 05:09 nicoodeimos

The main service is still a switch and a heater cooler as before. There was never a lightbulb as the main service. The heater cooler in HomeKit is not meant for controlling oven or air fryer devices hence there are some limitations. During my testing this is simply the best way that you can get an air fryer device working in HomeKit.

merdok avatar Sep 05 '22 06:09 merdok

But what about the solution I offered? Are you willing to consider it? Heater cooler already has a button to start/stop, this eliminates the need to have a dedicated button. Heater could report 0 degrees when off and target temperature when on. You can even include current temp in the heater cooler if supported by Air Fryer. Pause can be handled with dedicated button if necessary. Target time remains with lightbulb.

I can confirm that service is now a lightbulb with iOS 16 latest beta (icon is a bulb).

3B2555C0-E04A-43D6-ACDA-FACB4CB93150

nicoodeimos avatar Sep 05 '22 06:09 nicoodeimos

That this solution does not work because of the way how the heater cooler service expects device to behave. The air fryer device simply does not behave as it is expected. You need to understand that HomeKit is very limited regarding supported devices, hence there needs to be some workarounds and tricks to make certain devices work.

The service is not a lightbulb. Your accessory group might be a lightbulb, but that depends on some other factors which I cannot control, like what kind of service you are using in the group.

merdok avatar Sep 05 '22 06:09 merdok

Hey @merdok, I checked and main service is absolutely defined as a lightbulb. I know HomeKit is very limited, don't get me wrong, and fully appreciate your work on this plugin, but I don't think this should be the case. I understand about the HeaterCooler, but not sure why it has to be a lightbulb.

There is a ON/OFF switch declared that could perfectly do the trick and avoid the Home app tile to be always ON (as the lightbulb never gets off). Do you have any idea on how to make the switch the main service?

I can guarantee the main service used to be a switch before refactoring AirFryers, which made so much sense than a lightbulb! Let me know I can help.

image

nicoodeimos avatar Sep 25 '22 11:09 nicoodeimos

The air fryer main service is certainly not a lightbulb. It is using a HeaterCooler and a ON/OFF switch service. It was like that from the beginning. It might be that for some reason your Home app is showing you the target time (which is a lightbulb) as you group main service, but that i cannot control. As a workaround i can recommend you to set onlyMainService property to true, which will only leave the ON/OFF switch and HeaterCooler services, and the rest what you need add by using propertyControl

merdok avatar Sep 25 '22 12:09 merdok

I'll give it a go then. Maybe try to delete the accessory and re-add it. thanks.

nicoodeimos avatar Sep 25 '22 12:09 nicoodeimos

Ok, ive deleted the accessory and added it again and it seems to have fixed the lightbulb as main accessory. I guess recent changes fucked up HomeKit cache and resetting everything did the trick.

thanks @merdok

nicoodeimos avatar Sep 26 '22 06:09 nicoodeimos

Yeah, not sure on what basis HomeKit is selecting the service which is displayed as the group main service... but glad that the issue was resolved!

merdok avatar Sep 26 '22 07:09 merdok