Xiaomi Gateway Integration

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.

Tap the button of your Gateway three times. A chinese woman talks about pairing a New decice. Push the small button of the new device. The voice will confirm the success. The button should show up now.

Are they at least available in the MiHome app?

Thanks @syssi I am able to add the square Wireless button and it is showing up in MiHome app. Only problem now is that instead of what I called out earlier as the enhancement of 1-click, 2-clicks, 3-clicks & 4-clicks, I am only able to see 1-click and 2-clicks. :scream: This is even worse than the original xiaomi button! I do hope that Xiaomi will update it soon.

They are all visible.

Good they will work, and await integration with HA