python-miio icon indicating copy to clipboard operation
python-miio copied to clipboard

[Scishare Coffe Maker] params commands not working

Open khmelevskikh opened this issue 4 years ago • 10 comments

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

khmelevskikh avatar Mar 20 '21 07:03 khmelevskikh

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?

rytilahti avatar Mar 20 '21 21:03 rytilahti

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 avatar Mar 21 '21 09:03 khmelevskikh

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"

khmelevskikh avatar Mar 24 '21 20:03 khmelevskikh

Would you mind creating a PR for the necessary changes?

rytilahti avatar Apr 10 '21 21:04 rytilahti

some solution?

matteos1 avatar Apr 12 '21 12:04 matteos1

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...

khmelevskikh avatar Apr 13 '21 15:04 khmelevskikh

how could i help?

matteos1 avatar Apr 26 '21 09:04 matteos1

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

khmelevskikh avatar Apr 30 '21 19:04 khmelevskikh

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

nekromant avatar Dec 20 '21 12:12 nekromant

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.

rytilahti avatar Jul 20 '22 17:07 rytilahti