{"id":15707395,"url":"https://github.com/robmarkcole/rf-doorbell-serial","last_synced_at":"2025-04-15T23:22:45.799Z","repository":{"id":85844537,"uuid":"114455788","full_name":"robmarkcole/RF-doorbell-serial","owner":"robmarkcole","description":"Using an Arduino with RF receiver to detect when my doorbell has been pressed","archived":false,"fork":false,"pushed_at":"2017-12-17T11:00:08.000Z","size":1452,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T11:14:54.922Z","etag":null,"topics":["arduino","home-assistant","home-automation"],"latest_commit_sha":null,"homepage":null,"language":"Arduino","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robmarkcole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-16T11:36:16.000Z","updated_at":"2021-08-18T15:07:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"302277ef-f829-4ec3-ba97-df9f9d2e5216","html_url":"https://github.com/robmarkcole/RF-doorbell-serial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2FRF-doorbell-serial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2FRF-doorbell-serial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2FRF-doorbell-serial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robmarkcole%2FRF-doorbell-serial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robmarkcole","download_url":"https://codeload.github.com/robmarkcole/RF-doorbell-serial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249168725,"owners_count":21223741,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","home-assistant","home-automation"],"created_at":"2024-10-03T20:40:26.423Z","updated_at":"2025-04-15T23:22:45.783Z","avatar_url":"https://github.com/robmarkcole.png","language":"Arduino","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RF-doorbell-serial\nUsing an Arduino with RF receiver to detect when my doorbell has been pressed.\n\nI purchased a cheap RF doorbell and receiver on Amazon. I wish to integrate it to Home-assistant so that I can receive mobile notifications when someone presses the doorbell. I previously did this using a dedicated raspberry pi that relayed RF events via MQTT. Here I use an Arduino relaying RF messages over the serial port. My reason for swapping pi for Arduino is mostly because it is overkill to use a pi and I would rather use mine for other projects. The reason for swapping MQTT for serial is that I can read from serial using Home-assistant and I now am not reliant on an MQTT server.\n\n## Usage\nI'm using a Mac. To check which port the Arduino is on I run:\n```\nls /dev/cu.*\n```\nIn my case the Arduino is connected on **/dev/cu.usbmodem14341**. I now use [screen](https://geekinc.ca/using-screen-as-a-serial-terminal-on-mac-os-x/) to check the data transmitted over the serial when the Arduino receives an RF input. In the terminal I launch screen with:\n```\nscreen /dev/cu.usbmodem14341 9600\n```\nI then press the doorbell remote and see **Doorbell pressed at 730**. I then kill the screen session using **ctrl + a + k**, and can now configure Home-assistant to display the message from the Arduino. I add to my Home-assistant config:\n```\nsensor:\n  - platform: serial\n    serial_port: /dev/cu.usbmodem14341\n```\nI restart Home-assistant and confirm that the state of this sensor is the message sent from the Arduino. Now I am only interested in displaying when the doorbell is pressed, and I would like a binary sensor which is ON when the doorbell is pressed. I will use a [little trick](https://community.home-assistant.io/t/binary-sensor-triggered-after-time-in-state/35826) I learned recently, of creating an [input_boolean](https://home-assistant.io/components/input_boolean/), and using an automation to toggle this ON/OFF when the state of the serial sensor changes. I first add the input_boolean to my Home-assistant config. However I wan't to see a boolean indicator on the front-end (rather than the input-slider) so I also add a [template binary sensor](https://home-assistant.io/components/binary_sensor.template/) and restart Home-assistant to make the changes take effect.\n```\ninput_boolean:\n  doorbell:\n    name: Doorbell\n    icon: mdi:alarm-bell\n\nbinary_sensor:\n  - platform: template\n    sensors:\n      doorbell:\n        value_template: \"{{ is_state('input_boolean.doorbell', 'on') }}\"\n```\nI now use the automations editor to create automations to toggle the input_boolean when the serial sensor changes state (after a doorbell button press). Additionally I publish ON/OFF on the MQTT topic 'doorbell' so that a remote HA instance can receive the doorbell state. I now have in automations.yaml.\n```\n- action:\n  - service: input_boolean.turn_on\n  - alias: ''\n    data:\n      payload: 'ON'\n      topic: doorbell\n    service: mqtt.publish\n  alias: Doorbell_on\n  condition: []\n  id: '1513433912908'\n  trigger:\n  - entity_id: sensor.serial_sensor\n    platform: state\n- action:\n  - service: input_boolean.turn_off\n  - data:\n      payload: 'OFF'\n      topic: doorbell\n    service: mqtt.publish\n  alias: Doorbell_off\n  condition: []\n  id: '1513433982733'\n  trigger:\n  - entity_id: input_boolean.doorbell\n    for:\n      seconds: 2\n    platform: state\n    to: 'on'\n```\nI now have a boolean on my Home-assistant front end which turns on when the doorbell is pressed. I can also view the state of the doorbell on a remote HA instance using an [MQTT binary sensor](https://home-assistant.io/components/binary_sensor.mqtt/), with the following in my config:\n```\nbinary_sensor:\n  - platform: mqtt\n    name: \"Doorbell\"\n    state_topic: \"doorbell\"\n```\nFinally I create an automation to send me a notification when the doorbell is pressed:\n```\n- action:\n  - data:\n      message: The doorbell was pressed\n    service: notify.robins_and_marias_iphones\n  alias: Doorbell notification\n  condition: []\n  id: '1513507538746'\n  trigger:\n  - entity_id: binary_sensor.doorbell\n    platform: state\n    to: 'on'\n```\n\n## Hassio\nI'm running Hassio on a pi3. To check the serial port that the Arduino is connected on I SSH into the Hassio and run **hassio host hardware**, and find that the Arduino is on **/dev/ttyACM0**.\n\n## Synology\nMy main HA instance runs in Docker on a Synology. To try https://philhawthorne.com/installing-home-assistant-io-on-a-synology-diskstation-nas/\n\n## Refs\n* Doorbell https://www.amazon.co.uk/gp/product/B01LQBRJFA/ref=oh_aui_detailpage_o01_s00?ie=UTF8\u0026psc=1\n* Arduino library https://github.com/sui77/rc-switch\n* HA blog post on reading over the serial https://home-assistant.io/blog/2017/10/23/simple-analog-sensor/\n* HA serial platform docs https://home-assistant.io/components/sensor.serial/\n\n\u003cimg src=\"https://github.com/robmarkcole/RF-doorbell-serial/blob/master/Arduino-rf-remote.JPG\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobmarkcole%2Frf-doorbell-serial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobmarkcole%2Frf-doorbell-serial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobmarkcole%2Frf-doorbell-serial/lists"}