It’s finally completed after a week of work. It currently works with all Xiaomi sensors, plugs and wall switches. Communication is both way. You can turn on and off a plug from HA or from Xiaomi Hub and state will sync. Credits to @fooxy who started the project!
Right now, it has to be installed as a component, not as a custom component. The reason is a couple of limitation of using custom component such as issue importing classes
UPDATE : Feb 6, 2017
- Instant motion event trigger. Event will be triggered whenever motion is detected. It does not have a 60 second window. Event is instantly triggered when there’s a motion. Useful for sound notification.
trigger: platform: event event_type: motion event_data: entity_id: binary_sensor.motion_sensor_158d000113702f
- Easier to start using this component. Just put in config below and you’re ready to go. Just keep in mind that without a key, you won’t be able to control the gateway light, plug or switches. Useful if you only need to use the sensors.
UPDATE : Jan 19, 2017
- Performance improvement. Disabled polling in motion sensor. Motion sensor now only poll itself every 10 seconds after motion is detected. Once motion is deactivated, polling stopped.
- Added error check
UPDATE : Jan 14, 2017
- Multiple gateway support (Remember to update Configuration.yaml for new configuration. Check README)
- Support Gateway Light (RGB light now supported!) Make sure you’re on the latest gateway firmware
- Support Cube rotate action
- Motion sensor fix. Motion disabled after 1 minute (Polling enabled)
- Task to update device state from broadcast now handled by HA directly. Should improve performance
- Component will work without a valid key if no write action is required (16 characters fake key still required)
- Error logged if Key is invalid when sending action to gateway
- Added interface option for those who has issue with socket binding. thanks @kirichkov
- Updated README. Non-supported device is added. Don’t ask again in the thread questions like ‘if things like radio is supported or not’
UPDATE : Jan 03, 2017
- Added Cube
UPDATE : Dec 26, 2016 (Updated all .py files)
- Can now be installed into custom_components folder
- Fixed door sensor bug
- Pycrypto will install automatically
UPDATE : Dec 25, 2016 (Updated all .py files)
Entity_Id format has changed. This is because templating does not work if the device id starts with a number
binary_sensor.158d000xxxxxc2_switch to binary_sensor.switch_158d000xxxxxc2
Event data for switch has changed
Added battery but i’m not sure whether it works. I haven’t get been able to get the sensor to send any battery data