/ September 30, 2019/ Articles, Home Assistant, Uncategorized, Xiaomi/ 0 comments

I made my dumb doorbell smart. First of all we have to make shure there is some integration in Home Assistant. Therefore i made a hack to a Xiaomi Door/Window Sensor.

I desoldered the little contact strip and soldered 2 wires.
I am using a Finder Relais to provide at one side an input of the Doorbell powersupply and at the other site a powerless contact to the sensor.

Finder 40.52.8.012.0000

At last, offcourse the Xiaomi Door/Window sensor is integrated in HA alreay with the Xiaomi Aqara integration, but you can also use Zigbee2MQTT or another Zigbee integration.

My Home Assistant config is as follow. The code is providing a push notification with an video stream of the door camera and also saving a snapshot. At last there is a condition to prevent repeating doorbells when somebody is fast pressing.

edit: I changed the code a bit. Now there are 2 notifications. 1 with the snapshot and 1 with a video stream. Advantage is that the snapshot can be seen later, when you missed the notification and secondly the videostream is a live video, which is handy. The snapshot is also saved locally in your Home Assistant environment and just called with the url option. This is making the notification fast, without any attatchment.

- alias: Notify Doorbell
  initial_state: on
  trigger:
    platform: state
    entity_id: 
     - binary_sensor.door_window_sensor_xxxxx 
    from: 'off'
    to: 'on'
  condition:
    condition: template
    value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.notify_doorbell.attributes.last_triggered | default(0)) | int > 10)}}'
  action:
    - service: camera.snapshot
      data:
       entity_id: camera.doorbell
       filename: '/config/www/snapshot_doorbell.jpg'
    - service: notify.yourphone
      data:
        title: 'Doorbell'
        message: 'Doorbell! - Snapshot'
        data:
          push:
            sound: "Doorbell.wav"
          attachment:
            url: https://hass.domain.com/local/snapshot_doorbell.jpg
    - service: notify.yourphone
      data:
        title: 'Doorbell'
        message: 'Doorbell! - Videostream'
        data:    
          push:
            category: camera
          entity_id: camera.doorbell
Share this Post

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*

fourteen − six =