Xiaomi Gateway Integration

Is there any model with UE Plug? Thanks :smiley:

Looks like I need to find an Android device - no worky on my iPhone.

Thanks for the instructions!

IOS instructions below…

Mi Home app: Select the relevant gateway from the list view of “My devices” -> Switch to “Device” at the top navigation -> select the gateway again -> Ringtone settings -> Door bell tone -> Press to record (make sure you hold on till you finish recording) -> save -> input name and Confirm. I forgot if need to press upload button after that or not.

3 Likes

… and that worked perfectly. Thanks!

How did you determine the ringtone id? Are you limited to just the ringtones or can you play anything that is uploaded to the gateway?

Thanks!

If I understood it correctly, it should be all. Probably @syssi can help more as I have not used the sound in HA yet.

1 Like

You can upload any audio file to the gateway. Your first upload is the 100001. The second 100002 and so on. :slight_smile: In my case the files are short notification sounds and they stops playing on its own. Real ringtones (lower numbers) are endless loops and you have to call the stop service.

1 Like

My gateway ringtones stop after about 5 seconds. How can I have a loop with the normal gateway?

Oh, you are right. There is no loop.

  action:                                                                                                                                                                                          
    - service: script.turn_on                                                                                                                                                                      
      entity_id: script.play_sound                                                                                                                                                                 
      data:                                                                                                                                                                                        
        variables:                                                                                                                                                                                 
          ringtone_vol: 8                                                                                                                                                                          
          ringtone_id: 10003  

How do I get service: “script.turn_on” ?

Thanks (I’m such a noob!)

Oooh, no. I posted a incomplete piece of code. This is the missing part:



input_boolean:
  mute_gateway_sounds:
    name: Mute
    icon: mdi:music-off

script:
  play_sound:
    sequence:
      - condition: state
        entity_id: input_boolean.mute_gateway_sounds
        state: 'off'
      - service: xiaomi.play_ringtone
        data_template:
          gw_sid: !secret 
          ringtone_id: "{{ ringtone_id }}"
          ringtone_vol: "{{ ringtone_vol }}"

I use the script to mute the notification sounds by an input_boolean.

4 Likes

Yup - working now - very nice!. Thank you for your help with this stuff!

My parcel arrived and I was so happy and relieved when i opened it. It is the new motion sensor. :heart_eyes: Will try to set it up later when I am free.

2 Likes

I’m curious. Does the current gateway firmware report a model name for the new sensor? :slight_smile:

This is what the sensor report from Mi Home app.

Are you referring to what we can see in HA?

No. Please enable the debug output of the xiaomi component:

# configuration.yaml
logger:
  default: warn
  logs:
    custom_components.xiaomi: debug
    custom_components.sensor.xiaomi: debug
    custom_components.binary_sensor.xiaomi: debug
    custom_components.light.xiaomi: debug
    custom_components.switch.xiaomi: debug

And check all the read_ack messages/lines of your home-assistant.log. Unsupported devices which needs a new gateway firmware to be supported from home assistant looks like this:

2017-07-07 18:31:57 DEBUG (Thread-9) [custom_components.xiaomi] >> b'{"cmd":"read","sid":"158d00017202ba"}'
2017-07-07 18:31:57 DEBUG (Thread-9) [custom_components.xiaomi] << {'model': '', 'data': '{"voltage":3055}', 'cmd': 'read_ack', 'short_id': 27539, 'sid': '158d00017202ba'}

Can you identify your new motion sensor and post the read_ack message?

I already have debug enabled…just wanted to know what you wanted to see. :slight_smile:

Below is the same thing I am seeing from HA log as in the new door/window sensor.

Door/Window sensor:

2017-07-15 14:51:05 DEBUG (Thread-10) [homeassistant.components.xiaomi] >> b'{"cmd":"read","sid":"158d000xxxxxxx"}'
2017-07-15 14:51:05 DEBUG (Thread-10) [homeassistant.components.xiaomi] << {'model': '', 'short_id': 60491, 'sid': '158d000xxxxxxx', 'cmd': 'read_ack', 'data': '{"voltage":3065}'}
2017-07-15 14:51:05 ERROR (Thread-10) [homeassistant.components.xiaomi] Unsupported devices : 

Motion sensor:

2017-07-15 14:51:05 DEBUG (Thread-10) [homeassistant.components.xiaomi] >> b'{"cmd":"read","sid":"158d000yyyyyyy"}'
2017-07-15 14:51:05 DEBUG (Thread-10) [homeassistant.components.xiaomi] << {'model': '', 'short_id': 49141, 'sid': '158d000yyyyyyy', 'cmd': 'read_ack', 'data': '{"voltage":3055}'}
2017-07-15 14:51:05 ERROR (Thread-10) [homeassistant.components.xiaomi] Unsupported devices :
1 Like

Just realized that the new square Wireless button is yet to be supported in Mi Home app :sob:Now i cannot even set it up for use. Hopefully will see an update from Xiaomi soon.

The square button works for me. Shows up at the top level with the gateway just like the cube.