ring doorbell – Automation Fixation https://automation.moebius.site A site dedicated to home automation and technologies. Sun, 28 May 2023 07:18:38 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 156416546 Home Assistant with a Ring Doorbell in 2022 https://automation.moebius.site/home-assistant-with-a-ring-doorbell-in-2022/ Sun, 28 Aug 2022 11:07:00 +0000 http://automation.moebius.site/?p=1549 In this post, we will go through in detail how to integrate Home Assistant with a Ring doorbell, add an automation and download videos locally. If you haven’t seen my introduction video for first time users, please check it out as this video follows on directly from there including the Samba and Visual Studio Plugins used in this video.

What you need for this tutorial:

Step 1Adding the Ring Doorbell with Home Assistant

  • Open up your Home Assistant Browser
  • Navigate to Settings and then Device and Services
  • Select Add Integration in the bottom right
  • Search for Ring and select it
Home Assistant Ring Doorbell Tutorial
  • Follow the prompts to enter in the associated account details including 2FA if this has been enabled
  • Select the area where the device is located and then finish. If you need to create an area, select add new area and then add
  • The Ring integration should now be visible in the integration screen
Home Assistant Ring Doorbell Tutorial
  • If you go to the overview screen, the Ring sensors and key values should have been added as a new card
  • From here, you can see the sensors which show if a ding or motion is currently active, and historical details on the last activity, ding or motion. You can also see the volume settings and there are additional values to add such as battery level if you need them.
Home Assistant Ring Doorbell Tutorial
  • If you click on a value, you will be able to see the historical details.

Step 2Adding an Ring Doorbell Automation

Ok, now that we have integrated Home Assistant with the Ring platform, let’s add an automation for when something occurs with the doorbell.

  • Navigate to Settings and then Automations and Scenes
  • Click Create Automation and then Start with an empty automation
  • Let’s call this automation – “Front Door Light Motion” as I want to be able to turn on a switch when there is motion at the door
  • First we need to set up a Trigger to specify when the automation will start
  • Select Trigger type State and then the entity. We are going to select the binary sensor Front Door Motion
  • I will leave the From and To blank so that it switches on when the motion sensor is triggered
Front door light motion triggers
  • Now we need to select an Action, so select Action type call service and then switch turn on and then select the entity. In this case, I’m going to use the Front Door light switch.
Front door light motion actions
  • Once complete, Save the automation and return

Step 3 – Saving the Ring Doorbell Videos Locally

I’ve received a lot of requests on my older Ring video on how to save videos locally. Please note that you will need to have a Ring Plan for this to work.

  • To start, open up your configuration yaml file to add in the downloader module config.
  • Paste the following config and select an appropriate downloads folder:
Configuration.yaml file editing with download module
downloader: 
  download_dir: downloads 
  • Make sure you create also create a downloads folder that matches the config or you will get an error when trying to download
  • Go to Developer Tools and check that the configuration is fine and then restart Home Assistant.
Home Assistant Configuration validation
  • Back now in Settings, select Devices and Services and confirm the camera name so that we can use it in the next automation. e.g. camera.front_door
Ring Doorbell entity name
  • Go back to Settings, select Automations and Scenes
  • Click Create Automation and then Start with an empty automation
  • Let’s name this automation “Download Ring on Motion”
  • The Trigger again will be State and Front Door Motion
Download Ring Video on motion automation
  • You will need to add in a couple of Actions
  • Generally there will be some time required before the video is ready on the Ring Server, so I suggest adding a Delay step.
  • Add in “Wait for Time to Pass” and a 2 minute period to allow time for the video to upload to Ring and then download
  • Now we need a second action to download the file
  • Select “Call Service” and search for downloader
Ring Doorbell automation actions
  • Now click on the extra options to edit in YAML
  • Paste the code and adjust based on your camera name which we confirmed previously. In my case, it is camera.front_door and add in the filename script to name the file with an appropriate timestamp
Ring Doorbell automation Actions
data:
  url: "{{ state_attr('camera.front_door', 'video_url') }}"
  subdir: "{{ state_attr('camera.front_door', 'friendly_name') }}/{{ now().strftime("%m.%Y") }}"
  filename: "{{ now().strftime('%Y-%m-%d-at-%H-%M-%S') }}.mp4"
  • Save the automation and return to the previous screen
  • Trigger the automation to check if it worked
  • Navigate to the downloads directory using the Samba share addon and see if the video worked. This should show the last video recorded by the Ring.
Samba share download screenshot of Ring video
  • If the automation is triggered by actual motion, you will be able to see the history showing that it was triggered by state of Front Door Motion.
Download Ring on Motion History

Thanks for reading. If you liked this article, please like and subscribe to the YouTube video at the start of this page.

Additional Links:

]]>
1549
Home Assistant Beginner’s Guide in 2022 https://automation.moebius.site/beginners-guide-to-home-assistant-in-2022/ Sat, 27 Aug 2022 14:31:59 +0000 http://automation.moebius.site/?p=1518

Home Assistant is an Open source home automation tool that is constantly being updated and enhanced through contributions from a large DIY community. Home Assistant is perfect to run on a Raspberry Pi or a local server to bring together various different technologies for a cohesive ecosystem, create automation and rules and integrate with your smart speaker. This post is a Home Assistant Beginner’s Guide in 2022 and targeted to those who are planning to set up Home Assistant using for the first time and will cover the following topics:

  • Installing Home Assistant – Basic install from scratch on a Raspberry Pi
  • Understanding addons and top recommended Addons – Making use of the community and some of the great addons that are out there
  • Adding devices – Installing an example device for each installation type

Refer to my Instruction video here or follow the detailed instructions below:

What will you need:

  • Raspberry Pi (Model 3 or 4)
  • Power Supply (make sure the power supply is sufficient to avoid stability issues)
  • USB Cable for Raspberry Pi Power
  • > 32GB microSD card
  • Ethernet Cable

Installation

Step 1 – Determine which type of the Home Assistant build is correct for you.

Home Assistant is the program which we will be using and can pretty much be built to work on most key operating systems.

For the purposes of this article, we will be using Home Assistant for the Raspberry Pi.

Step 2 – Determine the correct image

Determine which device to which you will be deploying Home Assistant. For this guide, we will be installing onto a Raspberry Pi 3 Model B and have selected the Raspberry Pi 3 Model B and B+ 32bit image at the following link. You will need to copy the link to use in Step 4.

Home Assistant Beginner's Guide in 2022

Step 3 – Download and install flashing software

You will need software to install the Home Assistant image onto your MicroSD card. Etcher is a good option which is a free, open source software to flash devices.

Home Assistant Beginner's Guide in 2022

Step 4 – Flash Home Assistant image to MicroSD card

Use your preferred software to flash the image URL that you copied in Step 2.

Etcher image installation

Step 6 – Start up the Raspberry Pi

After inserting the MicroSD memory card, connecting Ethernet and power, you will need to wait for the device to initialise.

Step 7 – Connect to your Home Assistant installation

If all has gone well, you should now be able to connect to your Home Assistant installation through your browser. If your router supports mDNS then it will be accessible through http://homeassistant.local:8123 or else you will need to identify the IP address from your router e.g. http://192.168.x.x:8123. If it is not ready, then refresh and wait until you can see the “Preparing Home Assistant” screen.

Preparing Home Assistant

The screen will then automatically change and allow you to configure locale settings and create an initial account and password and confirm any discovered devices.

You should then be presented with the initial overview screen and potentially some devices that have automatically been detected on your network.

Home Assistant overview screen

The left sidebar has useful screens including:

  • Overview: The main screen to configure cards and views for managing and using your automations.
  • Energy: To view smart energy data
  • Map: To view devices sharing location in the Home Assistant App
  • Logbook: To view logs generated for Home Assistant system and linked services and devices
  • History: To view a historical view of logs
  • Media: To manage any configured media devices

Top Addons

Step 8 – Install Samba share add-on

You may already have some devices discovered, however you may need to edit configuration files to add additional devices and sensors. An easy way to do this is to add the Samba share add-on to allow editing outside of the browser. To do this:

  • Go to the Settings link in the left-hand side navigation panel
  • Click on Add-ons
  • Click Add-on store button
  • Click/search for Samba share and then Install
Samba share addon
  • Once installed, Click Start
  • Click Edit Config and be sure to enter in a user name and password as Samba share will open your Home Assistant device to the network:
Samba share addon configuration screen
  • Click Save and return to the previous screen.
  • Click Start to enable Samba share

Step 9 – Edit your configuration files

Your configuration files should now be accessible through Windows Explorer e.g. \\homeassistant.local\config or an IP address (same IP as how you reached Home Assistant in the browser):

Configuration files shared folder

The key configuration files are:

  • automations.yaml – Used to specify your automations and the underlying scripts that are executed. These can also be added from within the Home Assistant interface
  • configuration.yaml – The key configuration file which is where you will add your manual components and key configurations
  • scripts.yaml – Used to specify a sequence of actions to be executed by Home Assistant when turned on
  • secrets.yaml – Used to store your user names, passwords, APIs and other sensitive information to avoid disclosing via the configuration.yaml file

Additional Hints:

  • I use Visual Studio Code to edit my files as it helps maintain the strict formatting for the configurations and is free and open source.
Visual Studio editing screen
  • If you make changes to your configuration files, you can run a validation over the files to check if you have made any errors. Go to Developer Tools > Check Configuration.
Check configuration screen

Step 10 – Install Studio Code Server Addon

In the hint noted above, I use a locally installed version of Visual Studio Code, however there are new addons available to edit in-browser with Studio Code. To install, follow these steps:

  • Go to the Settings link in the left-hand side navigation panel
  • Click on Add-ons
  • Click Add-on store button
  • Click/search for Studio Code Server and then Install
  • Once installed, Start the addon
  • Select ‘Show in sidebar’ to make it visible
Studio Code Server tab

  • You will now be able to edit your configuration files from the browser
Studio Code Server configurations

Step 11 – Install MQTT Mosquito Broker

Local MQTT is one of the best options for communicating between devices and Home Assistant. Using MQTT locally will mean that in the event that you have power or internet issues, your devices can still communicate back and forth with Home Assistant. Toinstall, follow these steps:

  • Go to the Settings link in the left-hand side navigation panel
  • Click on Add-ons
  • Click Add-on store button
  • Click/search for MQTT Mosquito Broker and then Install
MQTT Mosquito Broker Addon

Installing MQTT takes a little bit more effort to set up and there are some additional steps.

  • First you should create a separate user account for MQTT and to do this, go to Settings, People and create an account such as mqttuser. You will need to allow the person to login and set an appropriate
  • You will need to select ‘allow login‘ to set a password and can further restrict this to allow log in from the local network.
Add user to Mosquito MQTT broker
  • If you want to lock down the account further, you can remove login ability afterwards and MQTT will still work
  • You now need to Configure the MQTT integration, so navigate to settings, configure button under MQTT
  • Follow the prompts to initialise and then under settings, enter in the mqtt user name and password that was just created
Edit Mosquito MQTT Broker options

Adding Devices

There are a few different ways to add devices including:

  • Automatically Discover
  • Installing Platform integration or Device
  • Manual

There are also different device classifications based on how the device communicates with Home Assistant:

ClassifierDescriptionProsCons
Assumed StateWe are unable to get the state of the device. Best we can do is to assume the state based on our last command.N/AN/A
Cloud PollingIntegration of this device happens via the cloud.Simple integration with cloud provider– Polling the state means that an update might be noticed later.
– Requires an active internet connection.
Cloud PushIntegration of this device happens via the cloud.– Simple integration with cloud provider
– Home Assistant will be notified as soon as a new state is available.
– Requires an active internet connection.
Local PollingOffers direct communication with device. Polling the state means that an update might be noticed later.– Does not require active internet connection
– Limited lag between messaging
– Privacy maintained as used within internal network
– Polling the state means that an update might be noticed later.
– More complex setup for devices generally required
Local PushOffers direct communication with device. Home Assistant will be notified as soon as a new state is available.– Does not require active internet connection
– Limited lag between messaging
– Privacy maintained as used within internal network
– Home Assistant will be notified as soon as a new state is available.
More complex setup for devices generally required
For more information, refer to the Home Assistant Guidance.

Step 12 – Adding an automatically discovered device

  • First of all, go to the “Settings” and “Devices and Services”.
  • Any discovered devices will have a blue heading noting ‘Discovered
Epson Printer discovered by Home Assistant
  • Home Assistant has picked up that I have an Epson printer on my network and shows on the screen.
  • Click Configure to follow the prompts to add the device and location

Step 13 – Adding a device through the UI

Next we will go through how to install a device or platform integration through the user interface.

  • Go back to Settings and “Device and Services”.
  • Select “Add Integration” in the bottom right
Add integration to Home Assistant
  • For this example, I’m going to add my Ring Doorbell
  • Search for the device or platform and select it
Ring integration with Home Assisstant
  • Enter in the associated account details including 2fA if this has been enabled.
  • Select the area where the device is located and then finish. If you need to create an area, select add new area and then add.
  • The Ring integration is now visible in the integration screen.
  • If you go to the overview screen, you can now see the last image on the camera and key details on last ding and motion.
Ring Overview Screen card

If you are interested in more Ring automations and details, check out my Ring integration post.

Step 14 – Adding a device manually

The final type of device is through manually adding it. This may be due to it not being supported or in the case I am about to show you, you want to add it through MQTT.

  • We can use Studio Code Server to edit our configuration files and add in the details.
  • For the example below, I have added in a Tasmota switch which will connect into my MQTT Broker
Ring configuration for downloader module
  • Now that we have updated the configuration file, navigate to the “Developer Tools” screen, use the Check Configuration button to see if the changes we made are valid and then Restart the system.
Home Assistant Beginner's Guide in 2022
  • Once it has restarted, in the Overview switch, I can see my Switch called “Coffee Machine” and I am able to turn it off and on.
Overview screen switch card

Hopefully you learnt something and enjoyed the Home Assistant Beginner’s Guide in 2022! If you haven’t checked out the video at the top of this page, please check it out and like and subscribe to my channel.

Good luck using Home Assistant!

]]>
1518