rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.69k stars 553 forks source link

Add support for xiaomi scishare coffee machine #833

Closed matteos1 closed 3 years ago

matteos1 commented 4 years ago

@rytilahti Is it possible to integrate xiaomi scishare coffee machine in home assistant ? I tried with raw miio commands and it seems to work. thank you

Model: scishare.coffee.s1102 Hardware version: esp8266 Firmware version: 2.1.0

https://github.com/aholstenson/miio/issues/284

rytilahti commented 4 years ago

The first step is to implement support for this library, which can then be used to create a homeassistant integration.

matteos1 commented 3 years ago

can you integrate it into miio? If you give me advice I could help you ..

rytilahti commented 3 years ago

Sorry, I don't have time to work on this, but if you want to add support to this library, look at some implementations of already existing ones (e.g., #544 is a fairly simple device) for some ideas how the implementation should look like.

After this library supports the device, integrating it to homeassistant will require more work, especially as there is no device class for this type of devices to my knowledge. Here's a relevant architecture issue: https://github.com/home-assistant/architecture/issues/51

matteos1 commented 3 years ago

Sorry, I don't have time to work on this, but if you want to add support to this library, look at some implementations of already existing ones (e.g., #544 is a fairly simple device) for some ideas how the implementation should look like.

After this library supports the device, integrating it to homeassistant will require more work, especially as there is no device class for this type of devices to my knowledge. Here's a relevant architecture issue: home-assistant/architecture#51

I tried to read the code of the examples you mentioned but sometimes it is incomprehensible to me. Maybe, if one day you have time, I would be very grateful for a possible implementation.

matteos1 commented 3 years ago

@rytilahti there is a possibility to use commands via the custom component https://github.com/syssi/xiaomi_raw/tree/develop/custom_components/xiaomi_miio_raw ?? Machine_OFF : turns the machine off. No params. Returns {"result":["ok"],"id":5685} Machine_ON: turns the machine on. No params. {"result":["ok"],"id":5688} Query_Machine_Status: returns {"result":["ok",5],"id":5689} or {"result":["ok",203],"id":5696} . The ID is incremented every call. No idea of what the 5 or 203 means. Buzzer_Frequency_Time: returns {"result":["ok"],"id":5694} . ID is also incremented. No idea of what it means. Espresso_Coffee: "params":[35,85] those params are mililiters (35) and temperature (85 Celsius). Returns {"result":["ok"],"id":5 Stop_Boiler_Preheat : No params. Returns {"result":["ok"],"id":6446} Cancel_Work_Alarm : No params. Returns {"result":["ok"],"id":6430} Hot_Wate : (missing the R for Water). "params":[160,55] (160 ml, 55 Celsius). Returns {"result":["ok"],"id":6427} Americano_Coffee: "params":[80,90,40,85] (80 ml water, 90 C, 40 ml coffee, 85 C). Returns {"result":["ok"],"id":6409}

matteos1 commented 3 years ago

hi @rytilahti and @syssi , with some friends we tried to integrate the scishare coffee machine but it still doesn't seem to work. It does not appear in entities. could you take a look at the code and maybe fix it? thanks

xiaomi_miio_coffee.zip

rytilahti commented 3 years ago

I just created a PR to add initial support for this. It would be great to find out what those unknown commands do, and what sort of status codes are available. Could you please try it out and report back what status codes you are getting for status during different phases of brewing?

syssi commented 3 years ago

Some additional feature/methods:

Query_Machine_Status []
Machine_ON []
Machine_OFF []
Buzzer_Frequency_Time [1, 100]
Espresso_Coffee_Set [35,85]
Americano_Coffee_Set [80,90,40,85]
Hot_Wate_Set [160,55]
coffeeType params
Cancel_Work_Alarm []
Boiler_Preheating_Set [temp]
coffee []
All_Recovery []
Machine_Descaling []
Stop_Boiler_Preheat []
Continue_Operation []

I assume you can store some presets at the machine (Espresso_Coffee_Set [35,85]). If you call the method "Espresso_Coffee" the configuration is used.

syssi commented 3 years ago

Some status codes: