Xiaomi Gateway Integration

It’s possible, it also shows the status of arm/disarm.

Cool. May be the feature will be exposed for the local network protocol soon. I assume the “virtual click event” cannot be used.

my single wireless wall switch has stopped working and I have the latest firmware, grrr

Also what is the range of the hub and sensors please? I have a several motion/temp sensors down stairs, all perfect. but on my landing, the motion sensor/lux are sketchy and the temp on next to it, keeps going to offline. It is wise to have 1 gateway up and 1 downstairs?

Cheers
Mark

that’s how I do

thanks Claudio. Is it possible to roll back firmware? The wall switch produces a log of a click, but not in ha since the firmware upgrade :frowning:

I don’t know how to

Can you tell me the type of the device? It’s the wireless wall switch without a relay, right?

it is the Xiaomi Aqara Smart Light Switch Wireless Version, that runs from battery. It was working perfectly with a toggle automation, thanks to you :slight_smile:

May be the format of the event has changed. I will check it and report.

How guys can you see the json messages between the gateway and HA ? Only using Wireshark ? Or is there any other way ?

Just enable the debug log. Because of the official component it looks like this now:

logger:
  default: warn
  logs:
    homeassistant.components.xiaomi: debug
    homeassistant.components.binary_sensor.xiaomi: debug
    homeassistant.components.sensor.xiaomi: debug
    homeassistant.components.light.xiaomi: debug
    homeassistant.components.switch.xiaomi: debug

What is an “alert” for the Xiaomi cube? Throw it into the wall? Sink it in water? :_)

Something like an earth quake. :wink:

Isn’t that tap_twice event?

Huh? If I put the cube on a table and pass by the cube reports an “alert”. If I tap twice on the cube it reports “tap_twice”.

Just build a game for your guests: Connect each event to a custom ringtone of the gateway and ask your guests to discover all 9 gestures. :stuck_out_tongue: This could be the automation:

# automation
automation:
  - alias: Cube flip90
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: flip90
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10002
  
  - alias: Cube flip180
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: flip180
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10003
  
  - alias: Cube move
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: move
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10009
  
  - alias: Cube tap_twice
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: tap_twice
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10008
  
  - alias: Cube shake_air
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: shake_air
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10007
  
  - alias: Cube swing
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: swing
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10006
  
  #- alias: Cube alert
  #  trigger:
  #    platform: event
  #    event_type: cube_action
  #    event_data:
  #      entity_id: binary_sensor.cube_158d00011a052e
  #      action_type: alert
  #  action:
  #    - service: script.turn_on
  #      entity_id: script.play_sound
  #      data:
  #        variables:
  #          ringtone_vol: 8
  #          ringtone_id: 10005
  
  - alias: Cube free_fall
    trigger:
      platform: event
      event_type: cube_action
      event_data:
        entity_id: binary_sensor.cube_158d00011a052e
        action_type: free_fall
    action:
      - service: script.turn_on
        entity_id: script.play_sound
        data:
          variables:
            ringtone_vol: 8
            ringtone_id: 10004
  
# script
script:
  play_sound:
    sequence:
      - condition: state
        entity_id: input_boolean.mute_gateway_sounds
        state: 'off'
      - service: xiaomi.play_ringtone
        data_template:
          gw_mac: !secret xiaomi_sid
          ringtone_id: "{{ ringtone_id }}"
          ringtone_vol: "{{ ringtone_vol }}"

The alert event happens to often randomly for my taste.

1 Like

You are right. Channel 1 (the right button) and the dual channel (both_click) works fine. Channel 0 is utterly broken with firmware 1.4.1_149.0143. The new firmware has no benefits so far. :frowning:

Hi friends,
I have xiaomi gateway an sensors. I can connecting and control gateway on Iphone but I don’t add subdevicies.
How can add subdevice?

I haven’t tried yet. But Home gw has default automation for the wireless switch in case of double click to arm or disarm the alarm. That automation should be available with the virtual event too, my guess.

Well still can’t get a single “alert” action on cube - any tips?

Ans also instead of swing get the following with chinese lady speaking out of gateway
2017-08-12T22:07:34.034435+03:00 home hass[10638]: #033[32m2017-08-12 22:07:34 INFO (MainThread) [homeassistant.core] Bus:Handling <Event cube_action[L]: entity_id=binary_sensor.cube_15xxx, action_type=iam>#