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

switch state cannot be read correctly #18

Open
blakadder opened this issue Aug 5, 2021 · 2 comments
Open

switch state cannot be read correctly #18

blakadder opened this issue Aug 5, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@blakadder
Copy link

I tried setting a switch but have difficulties setting the on/off state.

config:

switch:

  - platform: xiaomi_miio_raw
    name: xjx night light
    host: 10.1.1.262
    token: xxxxxxxxxxxxxxxxxxxxxx
    turn_on_command: 'night_led_on'
    turn_on_parameters: ''
    turn_off_command: 'func_off'
    turn_off_parameters: 'night_led'
    state_property: 'status_led'
    state_property_getter: 'get_prop'
    state_on_value: '1'
    state_off_value: '0'
``
tried with `(0)/(1)` and `[0]/[1]` with and without quotes

error:

2021-08-05 18:37:13 DEBUG (SyncWorker_4) [miio.miioprotocol] 10.1.1.162:54321 (ts: 1970-01-01 04:58:06, id: 213) << {'id': 213, 'result': [1], 'exe_time': 140}
2021-08-05 18:37:13 INFO (MainThread) [custom_components.xiaomi_miio_raw.sensor] New state: {'status_led': 1}
2021-08-05 18:37:13 DEBUG (SyncWorker_10) [miio.miioprotocol] 10.1.1.162:54321 (ts: 1970-01-01 04:58:07, id: 11) << {'id': 11, 'result': [0], 'exe_time': 210}
2021-08-05 18:37:13 DEBUG (SyncWorker_11) [miio.miioprotocol] 10.1.1.162:54321 >>: {'id': 13, 'method': 'get_prop', 'params': ['status_led']}
2021-08-05 18:37:13 DEBUG (SyncWorker_11) [miio.miioprotocol] 10.1.1.162:54321 (ts: 1970-01-01 04:58:07, id: 13) << {'id': 13, 'result': [1], 'exe_time': 150}
2021-08-05 18:37:13 WARNING (MainThread) [custom_components.xiaomi_miio_raw.switch] New state (1) doesn't match expected values: 1/0

@Ranchuking
Copy link

Same problem.
2021-10-23 23:29:45 WARNING (MainThread) [custom_components.xiaomi_miio_raw.switch] New state (1) doesn't match expected values: 2/1 2021-10-23 23:30:15 WARNING (MainThread) [custom_components.xiaomi_miio_raw.switch] New state (1) doesn't match expected values: 2/1 2021-10-23 23:30:45 WARNING (MainThread) [custom_components.xiaomi_miio_raw.switch] New state (1) doesn't match expected values: 2/1 2021-10-23 23:31:15 WARNING (MainThread) [custom_components.xiaomi_miio_raw.switch] New state (1) doesn't match expected values: 2/1 2021-10-23 23:31:45 WARNING (MainThread) [custom_components.xiaomi_miio_raw.switch] New st ate (1) doesn't match expected values: 2/1

@Ranchuking
Copy link

ok, I think I have found the problem. The state value is set to string, and the value we get is int. I have to add another config to support the int value.

@syssi syssi added the bug Something isn't working label Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants