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

Can't add multiple switches #20

Open
Ranchuking opened this issue Oct 31, 2021 · 2 comments
Open

Can't add multiple switches #20

Ranchuking opened this issue Oct 31, 2021 · 2 comments

Comments

@Ranchuking
Copy link

Hello, when I add multi switches in the config yaml. I only get one in the entity.

switch:

  • platform: xiaomi_miio_raw
    name: 'ricecooker_quick'
    ......
  • platform: xiaomi_miio_raw
    name: 'ricecooker_cake'
    ......
@syssi
Copy link
Owner

syssi commented Dec 19, 2021

This is strange. I will give it a try tomorrow. It should be possible.

@syssi
Copy link
Owner

syssi commented Dec 20, 2021

You are right. The issue is the unique_id which is the model name + mac_address + state_property f.e. philips.light.candle-78:11:DC:04:ED:EA-power. I was able to reproduce the issue with this configuration:


switch:
  - platform: xiaomi_miio_raw
    name: device a switch 1
    host: 192.168.1.238
    token: 36574882f3d245d693549df4cf56aeb6
    turn_on_command: 'set_power'
    turn_on_parameters: 'on'
    turn_off_command: 'set_power'
    turn_off_parameters: 'off'
    state_property: 'power'
    state_property_getter: 'get_prop'
    state_on_value: 'on'
    state_off_value: 'off'
  - platform: xiaomi_miio_raw
    name: device a switch 2
    host: 192.168.1.238
    token: 36574882f3d245d693549df4cf56aeb6
    turn_on_command: 'set_power'
    turn_on_parameters: 'on'
    turn_off_command: 'set_power'
    turn_off_parameters: 'off'
    state_property: 'power'
    state_property_getter: 'get_prop'
    state_on_value: 'on'
    state_off_value: 'off'

This is the error:

2021-12-20 18:24:08 ERROR (MainThread) [homeassistant.components.switch] Platform xiaomi_miio_raw does not generate unique IDs. ID philips.light.candle-78:11:DC:04:ED:EA-power already exists - ignoring switch.device_a_switch_1

May be we should make the unique_id optional.

@syssi syssi changed the title Can't add multi switches. Can't add multiple switches Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants