xiaomi_raw
xiaomi_raw copied to clipboard
switch state cannot be read correctly
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
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
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.