Using Home Assistant to integrate a Unifi Protect G4 Doorbell and Amazon Alexa to announce visitors

I am not a Home Assistant expert, but it's clearly a massive and powerful ecosystem. I've interviewed the creator of Home Assistant on my podcast and I encourage you to check out that chat. Home Assistant can quickly become a hobby that overwhelms you. Every object (entity) in your house that is even remotely connected can become programmable. Everything. Even people! You can declare that any name:value pair that (for example) your phone can expose can be consumable by Home Assistant. Questions like "is Scott home" or "what's Scott's phone battery" can be associated with Scott the Entity in the Home Assistant Dashboard. I was amazed at the devices/objects that Home Assistant discovered that it could automate. Lights, remotes, Spotify, and more. You'll find that any internally connected device you have likely has an Integration available. Temperature, Light Status, sure, that's easy Home Automation. But integrations and 3rd party code can give you details like "Is the Living Room dark" or "is there motion in the driveway." From these building blocks, you can then build your own IFTTT (If This Then That) automations, combining not just two systems, but any and all disparate systems. What's the best part? This all runs LOCALLY. Not in a cloud or the cloud or anyone's cloud. I've got my stuff running on a Raspberry Pi 4. Even better I put a Power Over Ethernet (PoE) hat on my Rpi so I have just one network wire into my hub that powers the Pi. I believe setting up Home Assistant on a Pi is the best and easiest way to get started. That said, you can also run in a Docker Container, on a Synology or other NAS, or just on Windows or Mac in the background. It's up to you. Optionally, you can pay Nabu Casa $5 for remote (outside your house) network access via transparent forwarding. But to be clear, it all still runs inside your house and not in the cloud. OK, to the main point. I used to have an Amazon Ring Doorbell that would integrate with Amazon Alexa and when you pressed the doorbell it would say "Someone is at the front door" on our all Alexas. It was a lovely little integration that worked nicely in our lives. However, I swapped out the Ring for a Unifi Protect G4 Doorbell for a number of reasons. I don't want to pump video to outside services, so this doorbell integrates nicely with my existing Unifi installation and records video to a local hard drive. However, I lose any Alexa integration and this nice little "someone is at the door" announcement. So this seems like a perfect job for Home Assistant. Here's the general todo list: Install Home Assistant Install Home Assistant Community Store This enables 3rd party "untrusted" integrations directly from GitHub. You'll need a GitHub account and it'll clone custom integrations directly into your local HA. I also recommend the Terminal & SSH (9.2.2), File editor (5.3.3) add ons so you can see what's happening. Get the UniFi Protect 3rd party integration for Home Assistant NOTE: Unifi Protect support is being promoted in Home Assistant v2022.2 so you won't need this step soon as it'll be included. "The UniFi Protect Integration adds support for retrieving Camera feeds and Sensor data from a UniFi Protect installation on either an Ubiquiti CloudKey+, Ubiquiti UniFi Dream Machine Pro or UniFi Protect Network Video Recorder." Authenticate and configure this integration. Get the Alexa Media Player integration This makes all your Alexas show up in Home Assistant as "media players" and also allows you to tts (text to speech) to them. Authenticate and configure this integration. I recommend going into your Alexa app and making a Multi-room Speaker Group called "everywhere." Not only because it's nice to be able to say "play the music everywhere" but you can also target that "Everywhere" group in Home Assistant. Go into your Home Assistant UI at http://homeassistant.local:8123/ and into Developer Tools. Under Services, try pasting in this YAML and clicking "call service."service: notify.alexa_media_everywheredata: message: Someone is at the front door, this is a test data: type: announce method: speakIf that works, you know you can automate Alexa and make it say things. Now, go to Configuration, Automation, and Add a new Automation. Here's mine. I used the UI to create it. Note that your Entity names may be different if you give your front doorbell camera a different name.Notice the format of Data, it's name value pairs within a single field's value....but it also exists in a file called Automations.yaml. Note that the "to: 'on'" trigger is required or you'll get double announcements, one for each state change in the doorbell. - id: '1640995128073' alias: G4 Doorbell Announcement with Alexa description: G4 Doorbell Announcement with Alexa trigger: - platform: state entity_id: binary_sensor.front_door_doorbell to: 'on' condition: [] action: - service: notify.alexa_media_everywhere data: data: type: announce method: speak message: Someone is at the front door mode: singleIt works! There's a ton of cool stuff I can automate now!Sponsor: Make login Auth0’s problem. Not yours. Provide the convenient login features your customers want, like social login, multi-factor authentication, single sign-on, passwordless, and more. Get started for free.© 2021 Scott Hanselman. All rights reserved.     

Upgrading a 20 year old University Project to .NET 6 with dotnet-upgrade-assistant

I wrote a Tiny Virtual Operating System for a 300-level OS class in C# for college back in 2001 (?) and later moved it to VB.NET in 2002. This is all pre-.NET Core, and on early .NET 1.1 or 2.0 on Windows. I moved it to GitHub 5 years ago and ported it to .NET Core 2.0 at the time. At this point it was 15 years old, so it was cool to see this project running on Windows, Linux, in Docker, and on a Raspberry Pi...a machine that didn't exist when the project was originally written. NOTE: If the timeline is confusing, I had already been working in industry for years at this point but was still plugging away at my 4 year degree at night. It eventually took 11 years to complete my BS in Software Engineering. This evening, as the children slept, I wanted to see if I could run the .NET Upgrade Assistant on this now 20 year old app and get it running on .NET 6. Let's start:$ upgrade-assistant upgrade .TinyOS.sln-----------------------------------------------------------------------------------------------------------------Microsoft .NET Upgrade Assistant v0.3.256001+3c4e05c787f588e940fe73bfa78d7eedfe0190bdWe are interested in your feedback! Please use the following link to open a survey: https://aka.ms/DotNetUASurvey-----------------------------------------------------------------------------------------------------------------[22:58:01 INF] Loaded 5 extensions[22:58:02 INF] Using MSBuild from C:Program Filesdotnetsdk6.0.100[22:58:02 INF] Using Visual Studio install from C:Program FilesMicrosoft Visual Studio2022Preview [v17][22:58:06 INF] Initializing upgrade step Select an entrypoint[22:58:07 INF] Setting entrypoint to only project in solution: C:UsersscottTinyOSsrcTinyOSCoreTinyOSCore.csproj[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable[22:58:07 INF] Initializing upgrade step Select project to upgrade[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable[22:58:07 INF] Initializing upgrade step Back up projectSee how the process is interactive at the command line, with color prompts and a series of dynamic multiple-choice questions? Interestingly, it builds on the first try, no errors.When I manually look at the .csproj I can see some weird version numbers, likely from some not-quite-baked version of .NET Core 2 I used many years ago. My spidey sense says this is wrong, and I'm assuming the upgrade assistant didn't understand it. <!-- <PackageReference Include="ILLink.Tasks" Version="0.1.4-preview-906439" /> --> <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0-preview2-final" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0-preview2-final" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0-preview2-final" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0-preview2-final" />I also note a commented-out reference to ILLink.Tasks which was a preview feature in Mono's Linker to reduce the final size of apps and tree-trim them. Some of that functionality is built into .NET 6 now so I'll use that during the build and packaging process later. The reference is not needed today.I'm gonna blindly upgrade them to .NET 6 and see what happens. I could do this by just changing the numbers and seeing if it restores and builds, but I can also try dotnet outdated which remains a lovely tool in the upgrader's toolkit. This "outdated" tool is nice as it talks to NuGet and confirms that there are newer versions of certain packages.In my tests - which were just batch files at this early time - I was calling my dotnet app like this:dotnet netcoreapp2.0/TinyOSCore.dll 512 scott13.txt This will change to the modern form with just TinyOSCore.exe 512 scott13.txt with an exe and args and no ceremony.Publishing and trimming my TinyOS turns into just a 15 meg EXE. Nice considering that the .NET I need is in there with no separate install. I could turn this little synthetic OS into a microservice if I wanted to be totally extra.dotnet publish -r win-x64 --self-contained -p:PublishSingleFile=true -p:SuppressTrimAnalysisWarnings=trueIf I add -p:EnableCompressionInSingleFile=trueThen it's even smaller. No code changes. Run all my tests, looks good. My project from university from .NET 1.1 is now .NET 6.0, cross platform, self-contained in 11 megs in a single EXE. Sweet.Sponsor: At Rocket Mortgage® the work you do around here will be 100% impactful but won’t take all your free time, giving you the perfect work-life balance. Or as we call it, tech/life balance! Learn more.© 2021 Scott Hanselman. All rights reserved.     

Build real-time web apps with Azure Web PubSub—now generally available

Real-time application scenarios such as live data updates, chat for streaming videos, interactive whiteboards for remote education, and IoT dashboards are helping businesses become more agile and more responsive to customers. Today, we’re announcing the general availability of Azure Web PubSub, a fully managed WebSocket-based service that enables you to focus on building real-time web and mobile experiences. WebSocket is a standardized protocol that provides full-duplex communication.

Deploy OpenAPI enabled Azure Functions with .NET in Visual Studio

Justin Yoo joins Scott Hanselman to demonstrate an extension he developed for adding OpenAPI capabilities to Azure Functions apps. See how easy it is to get HTTP-triggered .NET functions with OpenAPI support and deploy an Azure Functions app with Azure API Management from Visual Studio.═══════════════Watch the episode to the end and then submit your answers to our five-question quiz about the info Scott and Justin covered. Eligible participants who answer all five questions correctly will be entered into a Sweepstakes with a chance to be one of ten lucky winners to win a box of Microsoft swag! The Azure Friday Quiz Sweepstakes ends on Dec 10, 2021.Take the quiz! Terms and conditions Privacy statement═══════════════[0:00:00]– Intro[0:03:15]– Create[0:09:20]– Publish[0:12:56]– Consume[0:22:48]– Wrap-upCreate serverless APIs in Visual Studio using Azure Functions and API Management integration (preview)Azure Functions OpenAPI ExtensionCreate a free account (Azure)

Looking at Azure yesterday, today, and tomorrow with Jason Zander

Jason Zander, executive vice president of the Azure Team joins Scott Hanselman to celebrate the 8th anniversary of Azure Friday. In this special crossover episode with Hanselminutes, they reflect on Azure's history and Jason's career at Microsoft during that timeframe.[0:00:00]– Introduction[0:01:13]– Jason's history at Microsoft[0:08:25]– Microsoft's evolution[0:10:44]– Cloud before the cloud [0:19:38]– Developers as execs[0:23:03]– Azure today[0:25:25]– Looking forward[0:30:33]– Wrap-upHanselminutes Podcast 63 - Scott Guthrie and Jason Zander on SilverlightNew Team, New Challenges (Jason Zander's blog)Getting Started with Windows Azure, the SDK, and Visual StudioMicrosoft QuantumCreate a free account (Azure)

Announcing NuGet 6.0 – Source Mapping, Package Vulnerabilities, Faster Solution Load, Oh My!

NuGet 6.0 – Source Mapping, Package Vulnerabilities, Faster Solution Load, Oh My!NuGet 6.0 is included in Visual Studio 2022 and .NET 6.0 out of the box. You can also download NuGet 6.0 for Windows, macOS, and Linux as a standalone executable.The post Announcing NuGet 6.0 – Source Mapping, Package Vulnerabilities, Faster Solution Load, Oh My! appeared first on The NuGet Blog.

Using, and creating, custom project templates in Visual Studio and the dotnet CLI

Creating project templates is a great way to make it easy for users to get started from a common starting point. In the past it was difficult to create, and maintain, project templates for .NET. Now it's very easy to get started with your own custom project templates. You can create a project template that can be used in the command line with dotnet new, Visual Studio 2019 and Visual Studio for Mac. Come to this talk to see how easy it is to create your very own project templates. We will cover creating single project templates as well as solution templates that contain several projects.