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

I made my dumb doorbell smart, because i want to create an 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 alreaye 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 pressing repeatedly.

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

1 Comment

  1. Hello. This post was extremely interesting, particularly
    because I was looking for thoughts on this topic last Thursday.

    King regards,
    Thompson Hessellund

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>
*
*