Automation ideas for pet dog whilst away?

We recently adopted a little Dachshund. He is very cute but daft as a brush and barks alot when no one is home, even for short periods.

Had a quick look online I see there are specialist dog cameras with treat despensers.

However they are pricey and more than I want to spend.

How about a cheap IP camera? that can detect audio like barking and send an alert or trigger into Vera. Maybe a Neos / Wyse cam?

Ideally I’d want it to be automated upon noise detection and play a recorded mp3 file TTS on the Google Home speaker, I should be able to do that via node red I would think.

Perhaps a scene in Vera that can randomly send different commands to play various mp3 recordings?

Also maybe a vibration sensor on the kitchen door so I know when he’s having a go at it trying to get out.

Just wondering what others may have done in this area?


OK I have a local .wav sample audio file working and playing on my Google Home speaker in the Kitchen via Node-Red.

This can be either triggered by a Scene in Vera with some LUA code or can be triggered by a virtual motion sensor I just created on my Vera Plus.


I’ve configured it so the virtual motion sensor must be Armed and Tripped e.g. ArmedTripped=1 for Node-Red to then play the .wav file.

Further more detailed information can be read in the text items in the Node-Red Flow.

Here is the Node-Red code you can import:

[{"id":"a300d823.d91888","type":"tab","label":"Audio Alerts","disabled":false,"info":""},{"id":"7c792e59.49c9b","type":"comment","z":"a300d823.d91888","name":"Dog Alert","info":"","x":80,"y":20,"wires":[]},{"id":"5245d4ba.777cfc","type":"http in","z":"a300d823.d91888","name":"","url":"/dog1","method":"get","upload":false,"swaggerDoc":"","x":80,"y":140,"wires":[["9a183a60.09fb28"]]},{"id":"e78fbd8e.3d3b9","type":"http response","z":"a300d823.d91888","name":"","statusCode":"","headers":{"content-type":"audio/mpeg"},"x":390,"y":140,"wires":[]},{"id":"9a183a60.09fb28","type":"file in","z":"a300d823.d91888","name":"Dog1","filename":"/home/pi/.node-red/naughty-dog.wav","format":"","chunk":false,"sendError":false,"x":230,"y":140,"wires":[["e78fbd8e.3d3b9"]]},{"id":"f6382b78.927ec8","type":"mios-in","z":"a300d823.d91888","name":"Noise Alert (Virtual Motion Sensor)","server":"db098590.052cd8","item":"Kitchen:Noise Alert:ArmedTripped","exact":false,"x":160,"y":320,"wires":[["38aa21bd.36581e"]]},{"id":"38aa21bd.36581e","type":"switch","z":"a300d823.d91888","name":"Noise Detected","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":320,"wires":[["5939e7a.7204218"]]},{"id":"46c31311.5c3a0c","type":"cast-to-client","z":"a300d823.d91888","name":"Kitchen-Speaker","url":"","contentType":"","message":"","language":"En-gb","ip":"","port":"8009","volume":"","x":370,"y":440,"wires":[[]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"d5547bb5.4c16b8","type":"http in","z":"a300d823.d91888","name":"http request from scene","url":"/audioTrigger1","method":"get","upload":false,"swaggerDoc":"","x":120,"y":440,"wires":[["46c31311.5c3a0c"]]},{"id":"69e3ad12.3c8d34","type":"comment","z":"a300d823.d91888","name":"Triggered from a Vera Scene - (Double Click for more info)","info":"Run this LUA code from your Vera Scene - Change to your Node-Red IP \nluup.inet.wget(\"\")\n\n/audioTrigger1 is specified in the HTTP IN Node in the URL field and can be changed if you wish.","x":230,"y":380,"wires":[]},{"id":"5939e7a.7204218","type":"cast-to-client","z":"a300d823.d91888","name":"Kitchen-Speaker","url":"","contentType":"","message":"","language":"En-gb","ip":"","port":"8009","volume":"","x":650,"y":320,"wires":[[]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"4e68f8d8.a6f268","type":"comment","z":"a300d823.d91888","name":"Audio File served up by HTTP in Node-Red - (Double Click for more info)","info":"I uploaded my .wav file on to my Raspberry Pi were Node-Red is running in to the /home/pi/.node-red/ directory.\n\nThe full path to this file and its name is:\n\n/home/pi/.node-red/naughty-dog.wav\n\nThe GET URL is /dog1 \n\ne.g. entering in to a web browser you can test if the audio file is being served up by Node-Red HTTP ? \n\nChange the IP address to that of your own Node-Red","x":280,"y":80,"wires":[]},{"id":"817c54e1.981ec8","type":"comment","z":"a300d823.d91888","name":"Triggered by Vera device - Virtual Motion Sensor - (Double Click for more info)","info":"In Vera my virtual motion sensor is named \"Noise Alert\" and is in the \"Kitchen\" room. \n\nNOTE - Also the virtual motion sensor must be Armed.\n\nTherefore the MIOS device item I am monitoring for in Node-Red is:\n\nKitchen:Noise Alert:ArmedTripped\n\nYou can test and manually trip your virtual motion sensor by entering this in to a web browser:\n\nhttp://VERA-IP/port_3480/data_request?id=lu_variableset&DeviceNum=X&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&Value=1\n\nEnter your Vera's IP address and the device number of your virtual motion sensor in the DeviceNum=X change X for the device number etc.\n\nYou can untrip it by setting it to ZERO instead\n\nTripped&Value=0","x":290,"y":200,"wires":[]},{"id":"6b14f43b.aefe3c","type":"comment","z":"a300d823.d91888","name":"Google Home / Cast (Double Click for more info)","info":"In the Cast devices specify the static LAN IP address of your Google Home speaker in the IP field. \n\nSpecify the port number of: \n\n8009\n\nIn the MediaURL field specify the GET of the HTTP hosted audio file. \n\nMine is:\n\nhttp://\n\nChange the IP address to that of your own Node-Red.\n\nIn the Language field specify either:\n\nEn-gb OR En-us OR some other language. \n\n\n\n\n\n","x":660,"y":440,"wires":[]},{"id":"1cc52c04.80b9c4","type":"comment","z":"a300d823.d91888","name":"Google Home / Cast (Double Click for more info)","info":"In the Cast devices specify the static LAN IP address of your Google Home speaker in the IP field. \n\nSpecify the port number of: \n\n8009\n\nIn the MediaURL field specify the GET of the HTTP hosted audio file. \n\nMine is:\n\nhttp://\n\nChange the IP address to that of your own Node-Red.\n\nIn the Language field specify either:\n\nEn-gb OR En-us OR some other language. \n\n\n\n\n\n","x":640,"y":260,"wires":[]},{"id":"db098590.052cd8","type":"mios-server","z":"","name":"Vera-Plus","host":"","port":"3480"}]

Attached is my naughty-dog.wav sample file also. (1.7 MB)

I am using the node-red-contrib-cast and the node-red-contrib-mios nodes in my palette.

You will need to install these in to Node-Red first and establish the connection in the MIOS node to your Vera’s LAN IP address and its API port number - 3480

And also connect the Cast nodes to your Google Home speaker via its IP address and its port number - 8009

It would be nice to be able to randomly play different local .wav or .mp3 files, haven’t figured that out as yet.

And now I need some way of detecting the dog barking to then trigger the virtual motion sensor in Vera to then have the .wav file play out on the Google Home speaker etc.

Suggestions ?

To detect audio, you’ll need some sort of ML (machine learning) solutions. I’m not sure audio-based ones are available, but video ones, based on tensorflow, are quite common.

It you have multiple files, it’s not complex to randomize the number in your scene and pass it to your node red. I’m not expert in node red, but I think it’d have a randomizer function as well. Maybe @ElCid could add something to this topic.

1 Like

My initial thoughts on noise detection is to maybe buy a cheap Neos / Wyse IP camera they have noise detection on them.

I don’t have a camera currently in the kitchen, so one with two way audio also could be handy.

I imagine the firmware and app software for these cheap cams is pretty limited with no RTSP stream or no local API for controlling them.

You can flash them with some 3rd party firmware Xiaomi Dafang to get RTSP stream, but I’ve read it can be a bit buggy.

The other option might be to use TinyCAM Pro app, as I believe that supports these cams and maybe TinyCam Pro can then be used to somehow send in a trigger to Vera ?

Or even to use these cameras native app on an Android device and use the Automate Android app to intercept their push notifications for noise detection and then have that maybe fire a trigger in to Vera etc.

On the virtual motion sensor I have added an AutoUntrip Variable and set it to 60 seconds. So once the motion sensor has been tripped it will untrip itself 60 seconds later etc.

New Service = urn:micasaverde-com:serviceId:SecuritySensor1
New Variable = AutoUntrip
New Value = 60 seconds


For the noise detection ?

I’m playing around with AutoVoice app on Android they have a Ambient Noise Detector.

“React to the ambient noise around you Create a baby monitor, or a clapper. Noise has never been more fun!”

And it works with Tasker etc.

I don’t have an Android device in the Kitchen, but I have an Android tablet in the lounge.

I have created a new Tasker Profile using the AutoVoice Noise Level. The Tasker “Task” action then fires off a HTTP Request GET command to Vera to trip the virtual motion sensor.


But its far too sensitive and detects the quietest of noises, the dog would only have to fart to set it off.

I’ve tried -90 and 0 seems to make no difference either way.

maybe a possibility, if you can teach it a bark as the wake word.

Shame there is no uk amazon guard, this would be so much simpler. there are also z-wave alarm detectors that may be able to listen for other sounds eg. breaking glass and dog barking etc

Reading your last post, reminded me Automate has a noise level block to. think it would be easy to have a sound level and a duration event(to weed out transient noises eg doorbell)

1 Like


Thanks for the suggestions. Not having much look with AutoVoice.

I will have a look at Automate instead.


I presume this is it:

I’ve never used Automate before, I guess its a Tasker alternative right.

Yes It’s like tasker but flow oriented.

I knocked a simple flow that sends a http request to vera to action a Veraalexa say command, you could edit to update a vitual switch etc. It needs a bit of refining, if you like i can post it.

Triggering it only when away is more than enough. I always use house mode to filter events. It’s not that useful to use TTS when away/night, or turn on the tablet, or look for motion, etc.

So, if you can do an HTTP call, you could just run a scene that’s execute only if the house mode is set to away (or vacation, if you use it).

OK I think I have a possible working solution with Tasker using an app called Sound Detector.

I can adjust the detectors sensitivity much better with this app.

Tasker instructions for Sound Detector are here.

In the Tasker profile you have to add an “Intent Received” and I had to reboot the tablet before it started working.

Receive events from detector Tasker: (Profiles → Event → System → Intent Received)

  • Action


I need to test the detector sensitivity levels with the dog, which is difficult, he barks when I don’t want and doesn’t bark when I do want him to :grin:

Been playing doorbell sounds off Youtube LOL. It seems to work with the detector sensitivity at the lowest level when he barks it plays the .wav file.


Do you have any ideas how to play different random .wav audio files in Node-Red ?

At the moment it will play the same one each time.

Many thanks

A simple function to return a random url, you can add as many urls as you wish.

var urls = ["/home/pi/.node-red/public/naughty-dog.wav", 
msg.url = urls[Math.floor(Math.random() * urls.length)];
msg.contentType = "audio/vnd.wav";
return msg;

OK thanks I will have a go at it.

I currently just have the one URL in the MediaURL field of the Cast node device.

Not sure how to pass a random URL to the actual MediaURL field of the Cast device though.

place the function before the node, and add the urls to the function. Leave the media url blank

You can set a folder in node-red to serve as a http server
you need to set this in your settings.js file.
You can put all your wave files in there.

media links would be

1 Like


Thanks for the updated posts.

I will give it a try tomorrow.

I have Node-Red running on a Raspberry Pi now the TTS has been working better since. Still not 100% but better.

As for the .wav file I just uploaded it to the Pi in this directory.


And its served up by the Node-Red HTTP node I added into the Flow as:


I’ve enabled these in the settings.js file:

httpAdminRoot: ‘/admin’,

httpStatic: ‘/home/pi/.node-red/public’,

I’ve uploaded three wav files in to the public folder.

My new function looks like this:

var urls = ["/home/pi/.node-red/public/naughty-dog.wav", 
msg.url = urls[Math.floor(Math.random() * urls.length)];
msg.contentType = "audio/vnd.wav";
return msg;

I placed the function in front of the Cast device and I removed the URL from the MediaURL field in the Cast device.

However I am getting an “Error Load Media”

In Chrome browser if I try to access the public folder I cannot.


I have rebooted the Pi several times.

There wasn’t an existing “public” folder, so I created it in WinSCP



I cannot seem to get the public folder working properly with httpstatic, I assume I should just be able to access the .wav files in a browser ?


I also uploaded a .jpg file and I cannot access that either in the browser.

I have it working a different way however and it randomly plays the 3x .wav files I have uploaded in to the public folder.

I had to add other HTTP nodes and I had to change the paths in the function.


I am happy to do it this way instead, but its been bugging me why I can’t seem to get the httpstatic working properly to serve up the files that way.

try http://ip:1880/alert.wav

I think it acts like th root www of a http server.

1 Like