Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for numeric parameters #9

Open
ptbsare opened this issue Dec 30, 2020 · 4 comments
Open

Support for numeric parameters #9

ptbsare opened this issue Dec 30, 2020 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ptbsare
Copy link

ptbsare commented Dec 30, 2020

The following command line works:

miiocli device --ip 192.168.1.12 --token XXX raw_command setPrepareDish "[5,6390]"

But when I set the following in the config:

  - platform: xiaomi_miio_raw
    name: 餐厅蒸烤箱预约
    host: 192.168.1.12
    token: XXX
    turn_on_command: "setPrepareDish"
    turn_on_parameters: [5, 6390]
    turn_off_command: "canclePrepare"
    turn_off_parameters: ""
    state_property: "prepareTime"
    state_property_getter: "get_prop"
    state_on_value: "0639"
    state_off_value: "0000"

From the log I can see that it sends the following instead:

2020-12-30 15:26:16 DEBUG (SyncWorker_5) [miio.miioprotocol] 192.168.1.112:54321 >>: {'id': 6, 'method': 'setPrepareDish', 'params': ['5’, ’6390’]}

What I want is sending the following:

{'id': 6, 'method': 'setPrepareDish', 'params': [5, 6390]}

What should I do?

I tried the config:

  - platform: xiaomi_miio_raw
    name: 餐厅蒸烤箱预约
    host: 192.168.1.12
    token: XXX
    turn_on_command: "setPrepareDish"
    turn_on_parameters: "[5, 6390]"
    turn_off_command: "canclePrepare"
    turn_off_parameters: ""
    state_property: "prepareTime"
    state_property_getter: "get_prop"
    state_on_value: "0639"
    state_off_value: "0000"

It sends the following parameters:

{'id': 6, 'method': 'setPrepareDish', 'params': ['[5, 6390]']}

Which is also incorrect.
THANKS.

@syssi syssi added enhancement New feature or request help wanted Extra attention is needed labels Dec 30, 2020
@ptbsare
Copy link
Author

ptbsare commented Jan 11, 2021

xiaomi_miio_raw.sensor_raw_command also works.

@syssi
Copy link
Owner

syssi commented Jan 17, 2021

@rytilahti May I ask you about your support here? My python skills are pretty limited. Could you provide an example how to convert a string "[1,2,3]" to a list of integers?

@rytilahti
Copy link

Hey @syssi, check out ast.literal_eval() :-):

>>> import ast
>>> ast.literal_eval("[1,2,3]")
[1, 2, 3]

@anhnvme
Copy link

anhnvme commented Sep 14, 2021

I have the same issue with xiaomi.aircondition.ma1. I can't not set
"set_energysave" with params [1]
to enable Eco mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants