rytilahti / python-miio

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

[Scishare Coffe Maker] params commands not working #979

Open khmelevskikh opened 3 years ago

khmelevskikh commented 3 years ago

Hi, As discussed in a previous thread raising a separate report. I've tried to use Scishare Coffe Maker, but for me script doesn't work with parametrised commands like boil_water/brew_americano Device:

Model: scishare.coffee.s1102
Hardware version: ESP8266
Firmware version: 1.2.8

Version: miiocli, version 0.5.5

Testcase:

/usr/local/bin/miiocli -d scisharecoffee --ip <ip> --token <token> boil_water 300 90
INFO:miio.cli:Debug mode active
Boiling 300 ml water (90C)
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container: 
    data = Container: 
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = b'!1\x00 \x00\x00\x00\x00\x04:\xf3k\x00\x02\x973' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('043af36b')
            ts = 1970-01-02 23:09:39
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'&\xabD;\xc5~\xf2\xf9\x3d\rf4\xcg\x8e\x93%O\xf4' (total 16)
DEBUG:miio.miioprotocol:Discovered 043af36b with ts: 1970-01-02 23:09:39, token: b'<token>'
DEBUG:miio.miioprotocol:<ip>:54321 >>: {'id': 1, 'method': 'Hot_Wate', 'params': [300, 90]}
DEBUG:miio.miioprotocol:<ip>:54321 (ts: 1970-01-02 23:09:39, id: 1) << {'result': ['error'], 'id': 1}
False
rytilahti commented 3 years ago

I used the names given in https://github.com/rytilahti/python-miio/issues/833#issuecomment-709976659 for the implementation.

Could you manually try to change it to Hot_Water just in case it was fixed in some never firmware versions (although @matteos1 explicitly stated that the name misses r? Or test changing the parameters, just in case your selected parameters are out of range for what is accepted by the device?

khmelevskikh commented 3 years ago

This one works fine:

miiocli scisharecoffee --ip <ip> --token <token> raw_command Hot_Wate
Running command raw_command
['ok']

so I don't believe it relates to missing 'r' Other parametrised commands aren't working as well:

miiocli scisharecoffee --ip <ip> --token <token> brew_espresso 30 90
Brewing 30 ml espresso (90C)
False

In Mi Home I can set 30 ml 90C for espresso. I've also tried with different values

khmelevskikh commented 3 years ago

Played with python script a bit: This works fine: return self.send("Hot_Wate")[0] == "ok" This works fine as well and gives me correct ml value: return self.send("Hot_Wate",[amount])[0] == "ok" This one gives me 300ml(constantly) and temp is changing now: return self.send("Hot_Wate",amount,temperature)[0] == "ok"

rytilahti commented 3 years ago

Would you mind creating a PR for the necessary changes?

matteos1 commented 3 years ago

some solution?

khmelevskikh commented 3 years ago

Would you mind creating a PR for the necessary changes?

I'd love too.. But I didn't find the exact solution... I still have no idea how I can control both amount & temperature at the same time... If anyone have any suggestions I can test...

matteos1 commented 3 years ago

how could i help?

khmelevskikh commented 3 years ago

I've checked that for my machine it cannot pass more than one parameter for any command, even for raw_command Americano_Coffee [80] So I've no ideas... Can we make params optional? So at least we will be able pre-set params in mi home and use it from script without options

nekromant commented 2 years ago

Anybody tried wiresharking stock app? Can't try myself just yet - I'm only thinking of getting this very coffee machine quite soon.

rytilahti commented 2 years ago

I just added some information about how to perform traffic analysis to figure out the protocol to the docs (#1471 - https://python-miio.readthedocs.io/en/latest/contributing.html#improving-device-support). If someone with a device wants to do that and create a PR, I'm happy to help if needed.