Xiaomi smart home

Hi guys, can I get some help with the wireless switches. There are three active states that can be picked up: single, double and hold. How can i use these as a trigger in an automation?

I’m guessing it’s something similar to the motion one, but I can’t figure it out…
trigger: platform: event event_type: motion event_data: entity_id: binary_sensor.motion_sensor_158d000113702f

Two examples here https://github.com/Danielhiversen/home-assistant_config/blob/master/automation/soverom.yaml#L294

2 Likes

You’re my savior man, thank you!

Does anyone have code for motion and door sensors. I had them triggering via state but it seems they they start in the ‘on’ state when i reset home assistant and they are setting off my automation.
And the example didn’t seem to work:

trigger:
  platform: event
  event_type: motion
  event_data:
      entity_id: binary_sensor.motion_sensor_158d000113702f

I tried the above and this:

trigger:
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: binary_sensor.motion_sensor_158d00013fb1c7  #Motion 01
      new_state: 'on'

Hi, is there a way to detect xiaomi gateway that belongs to a different network? Now i have raspberry pi connected on a local LAN with ip 192.168.1.* and the gateway is connected on a local lan with ip 192.168.3.*, both lans are managed by the same router and they are enabled to comunicate each other but the hass plugin can’t detect xiaomi gateway.

I don’t think multicast (how xiaomi gateway API talks to HA) works on different subnet.

Is there a way to change the icons for the motion sensors? I find the stationary man and moving man too similar at a glance and would prefer the empty circle (no motion) and circle with a tick (motion) if I can change them?

Any possible to integrate xiaomi air purifier?

2 Likes

Did you find how?

my say only off/on and nos close / open.

Thanks!

MP

I ended up making a sensor to change the state to something more obvious:

# Door 1
  - platform: template
    sensors:
        front_door_sensor:
          friendly_name: 'Front Door Sensor'
          value_template: '{% if states.binary_sensor.door_window_sensor_158d00011xxxxx.state == "on"%} Open {%- else -%} Closed {%- endif -%}'

kudos to all on this,

I fumbled along last night and got the xiaomi temp/humidty sensors working just fine. Even logging and dispalying on influxdb/grafana is working perfect.

I have 2 requests which I can’t figure if its possible

  1. To get battery life or status out of each sensor

  2. If the sensor stops communicating ie out of range or battery or plain dead, there seems to be no indication, just last reading, can anything be done using the xiamo protocol to highlight a dropped sensor

Great work, guys

Can you show image how that look at your?

wow, can you share me your config file?
i dont know why, that not working for me… :frowning:

Just make sure you put you “158d000xxxxxxx” to your door sensor and it’s under the sensor section with the correct spacing.

sensor:
# Door 1
  - platform: template
    sensors:
        front_door_sensor:
          friendly_name: 'Front Door Sensor'
          value_template: '{% if states.binary_sensor.door_window_sensor_158d000xxxxxxx.state == "on"%} Open {%- else -%} Closed {%- endif -%}'

Yes i did it, but i just get a Circle on top and not like you, front door sensorr open/Closed.

I be happy if you can share me your configure file and i will be add to my.

Big big Thanks!

oh make a group and it will not be at the top in a circle. I still get the regular circle, this will just add another one that says open/closed rather than the man image that is still/running.

  door:
    name: "Door"
    view: no
    entities:
      - sensor.front_door_sensor
      - sensor.back_door_sensor
      
  motion:
    name: "Motion"
    view: no
    entities:
      - sensor.laundry_motion_sensor
      - sensor.front_motion_sensor
      - sensor.toilet_motion_sensor
      - sensor.motion_2_sensor
      - sensor.motion_3_sensor
      - sensor.motion_4_sensor
      - sensor.motion_5_sensor
      - sensor.motion_6_sensor
1 Like

Invalid config
The following components and platforms could not be set up:

group

that what i get, why you cannot share me your file? that will very help me.

Have you tried hass --script check_config ?
And read this https://home-assistant.io/docs/configuration/troubleshooting/

Help :slight_smile: or share me yourr config?