Smarthome can also play media
Smarthome is more than that
All the posts until now show how to automate stuff around the house. Get the roller blinds running, read in temperature sensors, turn on the lights etc. This is not all that a FLOSS Smarthome can do.
In my setup I can also stream music and videos from my NAS, watch Prime Video or Netflix, watch cable TV, record TV shows etc. In order to get this running we need a couple of more packages and services.
LibreELEC and Tvheadend
I have a cable modem which has 4 separate DVB-C tuners. In order to stream live TV and radio programs I use Tvheadend. Installation of the Tvheadend is pretty straight forward. If you are using Debian 10, you can get the packages from here. You can find a good explanation of how to configure Tvheadend to use DVB-C tuner here, sorry it's in German. But basically you just need to run the wizard, when first running Tvheadend.
Running Tvheadend gives as a good backend capable of streaming of live TV to multiple clients like e.g. PCs, smartphones etc. All you need is a program like VLC or and app like TVHClient and you are all set up. You also get timeshift and recording options.
One great client for TVheadend, as well as for streaming media from local sources or watching Netflix and Prime Video, is Kodi running on LibreELEC. All you need is at least Raspberry Pi 3B+ to install it on. I used the older version of Raspi as well, but they do not perform too well for video playback. One good explanation of how to install LibreELEC and get Netflix running is given here, sorry again in German. In order to get your local NAS data visible to Kodi, just use Samba to attach network shares. You can use the Kore app, to control Kodi from your smartphone.
Yes there is also a script!
Using LibreELEC to watch TV or video requires you to attach the Raspi with HDMI to your TV. When you do this, then your TV is also the audio sink.
But when you just want to listen to music or radio over Tvheadend, you do not want the TV running the whole time. So what we need is a separate audio output, like HiFiBerry or a cheap alternative.
I am using a HifiBerry which is attached to my Denon Amp. I use this script to automatically turn on the amp or the TV when audio or video is playing.
So as always, use and modify.