Home Assistant speech to text with Asterisk and DeepSpeech

I live outside city limits, so we don't have a municipal garbage service. Instead we get to choose from a handful of private trash collection companies. The one we chose is fine as far as garbage collection goes, but their website is stuck in the dark ages. Their contact email is an AOL.com address, if that tells you something. When I want to find out if garbage collection has been delayed due to a holiday, I have to call their phone number and listen to a voice message. It's terribly inconvenient and a lot more difficult to integrate with my Home Assistant installation.

tags: 

Viseron EdgeTPU Device Not Found

I've been messing around with object detection using software such as Viseron, Frigate, or DOODS. I finally managed to get my hands on a Coral.ai device via Mouser and set it up, but sadly Viseron wasn't automatically discovering it. The error came through like this:

[2021-06-15 21:59:51] [viseron.mqtt ] [INFO ] - Initializing MQTT connection
[2021-06-15 21:59:51] [viseron.detector ] [DEBUG ] - Initializing object detector edgetpu
[2021-06-15 22:00:16] [viseron.detector.edgetpu] [ERROR ] - EdgeTPU not found. Detection will run on CPU
[2021-06-15 22:00:16] [viseron.detector.edgetpu] [DEBUG ] - Error when trying to load EdgeTPU: Failed to load delegate from libedgetpu.so.1

The other noticeable symptom was that the CPU was going crazy at over 300%, and that's just for a single 720p camera!

The fix ended up being pretty simple. Make sure in your Docker startup you have "-v /dev/bus/usb:/dev/bus/usb" and "--privileged". That part was pretty well documented. I also had to set the permissions of the Coral device node to 0666 before the Viseron process could open it.

/etc/udev/rules.d/99-edgetpu-accelerator.rules

SUBSYSTEM=="usb",ATTRS{idVendor}=="1a6e",GROUP="plugdev",MODE="0666"
SUBSYSTEM=="usb",ATTRS{idVendor}=="18d1",GROUP="plugdev",MODE="0666"

And now CPU load is only about 2%, which is much better.

Screen Mirroring From Android

This is probably old hat by now, but I finally had need to set up screen mirroring from my Android to a Mac so I set out on a quest to find a good solution. I didn't have to look very long, thankfully. I ended up going with scrcpy, which is available for Mac, Windows, and Linux. Documentation is good, installation is easy, and it does just what I need without any extra crap.

Breaking broken websites that break copy and paste

Sites that block copy and/or paste drive me nuts. Most especially are the ones where they want you to type in your password or email address multiple times. Look man, I use a password manager for a really good reason and I don't need your 2 bit website to try and convince me otherwise.

Luckily in Firefox there's a way to disable that nonsense. Just set dom.event.clipboardevents.enabled=false and problem solved.

Locking Cron Jobs

Some cron jobs have the potential for running longer than their allotted interval, and you don't want to end up running multiple copies, especially where that creates additional load meaning the jobs take even longer to complete. That's a sure-fire recipe for disaster.

Historically I've always coded this into a shell script to use "ps" and exit if a copy of the job is already running. That works, but it's a pain to reimplement it every time. Somehow I missed that there is a tool built exactly for this specific function, named flock.

As a simple example:

flock -xn /tmp/lockfile -c /path/to/script

Hat tip to https://bencane.com/2015/09/22/preventing-duplicate-cron-job-executions/.

Random Greetings in Home Assistant

There's a server in my office and it has an audio card in it, so I figured why not have Home Assistant speak things to me. I started simple with just a basic greeting when the lights came on, and a goodbye when the lights went off. But then I decided to up the ante and have Home Assistant pick a greeting randomly from a list. Spice things up a bit.

Deploying Pi-hole

During the process of managing my Home Assistant server, I discovered a neat little tool named Pi-hole and decided to give it a whirl. It's a DNS server which uses blacklists to block ads and various flavors of crapware. So far it's been working really well, without any negative side effects that I've noticed.

Among the things I've discovered by browsing the reports:

  1. Google Chrome sends out a handful of DNS requests for random domains every time it starts up, to try and detect DNS hijacking
  2. My son's phone goes bonkers at midnight and requests a few thousand Google ads. I'm thinking maybe there's a bad app installed on there. That alone counts for 80% of the blocked requests.
  3. There are a lot of apps that phone home to the mother ship. I knew it happened, but I'm blown away by the actual scale of it. It's ridiculous. Not just the advertising, but the privacy leaks.
  4. Just from DNS, there is a lot you can infer about site a person is visiting. TLS won't help you there.

My next step is deciding whether to deploy this via VPN on my phone. I like the idea, but not sure if I want the hassle of it.

Naming Screen Sessions

Screen has a built-in limit of 40 windows. When I first exceeded that, I just recompiled it with a limit of 100. But just recently I hit that limit as well. I considered bumping it to 200, but that's just getting out of hand.

Pages

Subscribe to zmonkey.org RSS Subscribe to zmonkey.org - All comments