DEV Community

Cover image for Puppy Assistant: the smart home for my dog
Andrea Tosatto
Andrea Tosatto

Posted on

Puppy Assistant: the smart home for my dog

I want to share with you 3 "smart" ideas that help me in some day-to-day tasks with my Dog.

🐶 Doc

This is like one of those long recipes' introduction nobody cares. But hey, there's a puppy photo!

I'm a proud owner of Doc, a funny 10 months old Lagotto Romagnolo.
We adopted Doc at the beginning of August 2020 when he was 3 months old. He is really a good boy, probably a 14/10 on the @WeRateDogs scale.

Alt Text

Doc is shy and easily frightened by new things, but fortunately this is nothing that the right treats can fix.
In the first weeks, he had a lot of personal battles against many things: his own shade and reflection, other dogs in the distance, the neighbor's shutter sound, the trash can, an orange cone, the sound of a moving chair, and so on.
After some training and a lot of care, he has now found a little bit more courage and he likes to play with the neighbor's dog, and most of the time he doesn't care anymore about his reflection.

Keep in mind that everything they say about having a puppy is true, it takes a lot of effort to create the right bond between you and your dog. I highly advise you to find a good dog trainer and to follow a puppy class, a smart home will not help you much in that.


The setup

You can start to add smart functionalities to your home with a relatively cheap setup. I'm going to share with you the devices I use in my home and some cheap alternatives to start with.

🏠 Home assistant

I'm a big fan of Home Assistant(HA), an open-source automation tool that runs in my home since the first day I entered the house. If you don't know it check it out on their official website, and if you speak Italian you can take a look at this introduction by me.

You can run HA on any computer, I suggest starting with an old computer or an economic Raspberry PI. After 1 year I moved my setup from a Raspberry Pi to a Synology DS218+ to have my NAS and my home automation hub in the same place.

Cheap alternative: A raspberry Pi with HA is quite cheap, but you can have some good results with just Google Home/Alexa/Siri mobile app.

🎙️ Audio Assistant

I have 3 Google Home in my house, I use them mostly to play music and to control lights and shutters. They are connected directly to HA so I can run powerful scripts and automation.

Cheap alternative: Use Android/iOS Home Assistant free app on your phone.

📹 Webcam

I bought a used D-Link webcam on Amazon, I prefer a webcam that doesn't require a cloud subscription and supports the most common protocol(i.e. ONVIF). I connected it to Synology Surveillance Station, an app pre-installed in all the latest Synology NAS, so the webcams are recorded and I can access the video stream quickly.
A good two-way audio camera it's the best solution, but the good ones usually are not quite cheap.

Cheap alternative: Use an old Android/iOS phone as a webcam, just install a webcam app (i.e. DroidCam) and connect it directly to HA

💡 Lights

All the internal/external lights (also the shutters) are connected to HA with Shelly devices.

Cheap alternative: Use Wi-Fi enabled light bulbs, they're quite cheap now.

🚪 Door/Window sensors

The doors and windows have sensors wired to a Konnected Alarm Panel. I like its support for HA and the compatibility will almost all the wired alarm systems.

Cheap alternative: Search for a wireless alarm system compatible with HA.


Puppy Assistant

I had many ideas since Doc joined us, but I want to share the ones I use the most. I implemented them with all the things listed above, but you can apply these three ideas to any other smart home platform and many different device combinations.

💤 Doc sleep, please!

Doc sleeps downstairs, when he wakes up he wants to be sure we're around and we've not been kidnapped while sleeping. It's cute but after one week of waking up at 3:00 A.M. we were definitely tired.

One night I've found out that just shouting something like "Doc sleep, please" calms him down, great! The neighbors were not thinking the same, apparently, it has the opposite effects on them.
The night after I remembered that you can use a Google Home as an intercom with the Broadcast functionality. I said the magical phrase, and yes it worked! Doc went to sleep immediately.
The annoying part is that this is still something too complicated to do at 3:00 A.M. because you need to be sure the volume is right, then you have to press a good amount of buttons and then talk.

The problem can be divided into two tasks:

  • Avoid talking when it's too late in the evening
  • Do it as quick as possible so I can go back to sleep

I solved the first task with this HA script that plays my recorded voice through the Google Home near Doc:

doc_sleep:
  alias: Doc Sleep
  mode: single
  sequence:
  # set the right volume level to the nearest Google Home
  - data:
      volume_level: 0.2
    entity_id: media_player.gh_living # my Google Home device
    service: media_player.volume_set
  # play a custom mp3 with my recorded voice
  - data:
      media_content_id: https://www.your.domain/your-voice.mp3 # the recorded voice
      media_content_type: music
    entity_id: media_player.gh_living # my Google Home device
    service: media_player.play_media
Enter fullscreen mode Exit fullscreen mode

The second part of the solution is to find a way to easily and blindly trigger the script, a big button you can press without turning on the lights is the perfect thing. I used a spare Amazon Dash Button that I keep on my bedside table. They're not sold anymore but you can find many ways of triggering the script with a wireless button or your phone.

When the button is pressed Dasshio HA add-on will trigger the script. Dasshio configuration is the following:

timeout: 20
buttons:
  - name: DashButton
    address: 'AA:AA:AA:AA:AA:AA'
    domain: script
    service: doc_sleep # the previous script name
    service_data: '{}'
Enter fullscreen mode Exit fullscreen mode

🐕‍🦺 Good night pee

Before going to sleep I give Doc some time to relieve himself, but because it's dark outside and he is a suspicious dog he needs some time to check no one is around. I noticed that when the lights are on he is more comfortable so what about doing it automatically? I've automated the garden lights to turn on for 5 minutes when I open the main door and it's dark outside.

The idea is to use the alarm sensor mounted on the main door to trigger an automation that turns on the light and starts a timer.

- id: '123123123123'
  alias: Turn on garden light on the main door opened
  trigger:
  - entity_id: binary_sensor.main_door
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  action:
  - data:
      entity_id:
      - light.garden
    service: homeassistant.turn_on
  - data:
      entity_id: timer.garden_light # remember to setup the timer on your configuration.yaml
    service: timer.start
Enter fullscreen mode Exit fullscreen mode

And then turn it off with another automation:

- id: '456456456456'
  alias: Turn off garden light at the end of the timer
  trigger:
  - event_data:
      entity_id: timer.garden_light
    event_type: timer.finished
    platform: event
  action:
  - data:
      entity_id:
      - light.garden
    service: homeassistant.turn_off
Enter fullscreen mode Exit fullscreen mode

👁️ DocCam: the big brother

A puppy is a puppy and he needs to discover his surroundings, but sometimes he can find something that is not good for him or he can do something he should not do. I work from home so it's easier for me to keep an eye on him with a webcam and be there if something is not right.

I configured the Synology integration in HA to watch the live feed or the recordings, but I mostly use the official mobile app (DS Cam). The notifications on movement are configured to be sent directly to a Telegram group where I get all the notifications from my house.

Before using Synology Surveillance Station my MJPEG compatible camera was directly connected to HA and I used a sensor to trigger the script that sends to Telegram 3 photos at 5 seconds distance between each other.

This is the automation that starts the Telegram notifications:

- id: '7897897879789'
  alias: Send multiple photos to telegram on dog movement
  trigger:
  - entity_id: binary_sensor.dog_sensor
    platform: state
    to: 'on'
  sequence:
  - delay: '5'
  - service: script.telegram_photo
  - delay: '10'
  - service: script.telegram_photo
  - delay: '10'
  - service: script.telegram_photo
Enter fullscreen mode Exit fullscreen mode

This is the script that gets an image from the webcam and sends it through Telegram:

telegram_photo:
  alias: Telegram Photo
  sequence:
  - data:
      data:
        photo:
          auth: basic
          password: randomrandom # your camera password
          url: http://192.168.2.26/IMAGE.JPG # your camera ip
          username: admin # your camera username
      message: ''
    service: notify.telegram_house # your telegram house group
Enter fullscreen mode Exit fullscreen mode

What's next?

The ideas shared in this post are the ones I still use every day. I have some other things in my mind and I'm gonna post something new if I find anything useful to share.

Leave a comment below if want to share some of the things you did for your dog!

Top comments (3)

Collapse
 
chris_levis_d1e25f4e33755 profile image
Chris Levis

It's great to hear about your experience with Doc! It's incredible how much effort goes into raising a puppy, especially one with such unique personality traits. I love how you've integrated smart home tech to make both yours and Doc's life easier. We also went through some similar challenges with our Shiba Inu puppy, especially with his hesitance towards certain noises. I found that using treats and a calming environment worked wonders for him. If you're interested, I recently came across some great resources about caring for a Shiba Inu puppy, which you might find helpful.

Collapse
 
codewithtim profile image
Tim Knight

Great post!

Collapse
 
embob profile image
Emma Karayiannis

Andrea this is so good!!