Это видео недоступно.
Сожалеем об этом.
Installing And Running Home Assistant In A Docker Container, What You Need To Know! (How-To)
HTML-код
- Опубликовано: 6 апр 2022
- #HomeAssistant #Docker #BinaryTechLabs
This video is a continuation of my previous Home Assistant install videos, and in this video, we will be installing Home Assistant in a container.
If you want to try Home Assistant on a Raspberry Pi or any other single board computer but don't want to invest in the hardware or it's not available, why not try it in a container? If you're not sure what a container is, this video will walk you through the steps of containerising Home Assistant so you can experience it before you buy something.
💖 ABOUT OUR CHANNEL
Welcome to Binary Tech Labs, where we provide tutorials and reviews on Home Assistant, IoT devices, Raspberry Pi and other Single Board Computers, as well as other topics.
Check out our channel here:
/ @binarytechlabs
Don’t forget to subscribe!
💻 SOFTWARE
Install guides for Docker - docs.docker.co...
Install guides for Docker-Compose - docs.docker.co...
Portainer Install - docs.portainer...
🔗 GitHub Links
Docker Install Repo - github.com/Bin...
FOLLOW US ON SOCIAL
Get updates or reach out to Get updates on our Social Media Profiles!
Twitter: @BinaryTechLabs
Instagram: @BinaryTechLabs
This is an absolutely stunning piece of work ... I have totally avoided running Home Assistant in a docker container for exactly this reason - I will be trying this later today with a test setup. Thank you!
Thank you for your generous words and you are most welcome
Finally, a decent plus on-the-ground level video that talks about how to do it properly. Amazing content and reasoning. Neither any BS nor any cosmetic effects.
Appreciate your video. Very under rated channel, again who cares this early. Earned my sub. Respectfully Sir, "Super Thanks" again.
Thanks very much for the compliment and kind words!
Great video, consise and helpful . Suscessfully installed on a 4/64GB tvbox running armbian. subscribed !
Thanks for the support and love
very helpful video not only for home assistant but also about Portainer, thanks!
Thank you very much!
A very good video! You have helped me a lot to undestand how to work without addon function. Thanks a lot for the time and the skills you share with us!
Best regards from France 🇫🇷
I am glad that I can help and it's awesome to hear that it's with people from all over the world
Awesome, thanks so much for taking the time to post. Subscribed and liked.
Thanks for the support. Glad to hear this helped you! ❤️
Superb. Nice, Easy and on the spot.
Thanks, it means a lot
Fantastic group of videos you have created. I just happened on your channel today. I am a raspberry pi Fan and now a subscriber of your channel as well. Looking forward to understanding home assistant and the docker environment better. Thx
Thanks for subscribing and the compliment!
Really excllent tutorial!!!
Thanks for the support and your comment, it means a lot!
Damn.. this exactly what i have been looking for.
Well I'm glad you found it then!
great video, thx
Thanks for the love. Really appreciate it.
Thanks Very Much for this Video.
You're welcome, thanks for your support.
Thanks for video, it's really helpful. I just got sonoff zigbee device, Do you know how do you map device to container?
Just add this to your compose yaml file:
devices:
- /dev/:/dev/
You will have to find the device name, in Ubuntu I use this command :
ls -l /dev/serial/by-id
And I find my device name is
/ttyUSB0
So mine is
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
What are the advantages of virtualizing vs local hardware install ?
With docker, the biggest advantage is resources, your host isn't dedicated to one thing. If you want to test a new version, simply spin it up to test it against your config, to make sure it works. It's easier to get going for beginners or if you want to test it.
Question in into the round on this video.
Not sure if I missed it I the video or didnt see, virbis this a supervised install ? I wanted to install the supervisor Home Assistant on my raspberry pi in docker so I can use the addon as well.
I like your style very calm am knowledge good job.
Unfortunately this is not a supervisor install, but ty for the compliment
How do I use influxDB 2.7 with Home Assistant?
I should make a video for this, as I won't be able to explain through comments.
But everything you need is here:
www.home-assistant.io/integrations/influxdb/
Hi, thanks for your video, great job. But what about the backups?
With software on the computer that you are running docker on, you can backup the directory or directories that you mapped to the container, also called your persistent data, then you can remove or reinstall your container at will
@@BinaryTechLabs yeah, that is also sprang to my mind. But mentioned it in the video, so I've waited for some other miracle:) Also checked your video about Duplicati, very useful, gonna stick to this way of backing up my containers.
Thanks for your feedback and thanks
hello
Thanks for the video. very Helpful
The solution to imbed portainer (e.g) in the menu in the left column does nost work if you HA is using https.
Is there a work around for that.
I may not use it for portainer but it's mandatory for vscode (at least for me).
Thanks for your help
Thanks, I'm glad I can help. The does not work with https as it states as a warning in the documentation.
However, there usually is some work arounds. I have not attempted this but I came across a blog article about it, so depending on your use case and comfort level you can try this and see if it works for you. Not sure if it is still valid as this one was from 2019.
dew-itwebservices.com.au/setting-home-assistant-up-for-secure-access-over-the-internet/
It would seem that docker compose is no longer available for Windows. Not sure whether there is an alternative.
Thanks for the comment, you can still use docker compose through docker desktop for Windows. Just follow the link below for how to install it on Windows.
docs.docker.com/compose/install/
Hi, this is an excellent video. Could you make a video about Headscale, Tailscale with Homeassistant?
Thanks for the suggestions, I will definitely add them to the list
@@BinaryTechLabs thank for reply :)
In the meantime you can look at the video I did on remote access using cloudflare, it's similar to tailscale, no open ports
@@BinaryTechLabs Yes, but I want to have my own Server :D, but I am weak at Linux. I want to test Headscale
I get it, me personally, I run a proxmox lxc container instance of home assistant as my production instance and use cloudflare, but I will do the tailscale video as it's always good to have options
hey, great video, I'm having a problem. I can pair devices with zigbee2mqtt. But I cant see them as entities in home assistant. do you know what is missing me?
There could be a few things that can cause this. This form should be a good starting point for you.
community.home-assistant.io/t/zigbee2mqtt-device-not-shown-in-devices-or-entities-in-home-assistant/415649/9
Great tutorial. I have HA running in docker as well. Is there any way you would cover installing and using Rhaspy in this environment? I have been working on it for a while and am getting errors when Rhasspy sends and intent to HA. I get an unauthorized message in the logs from HA. Even though I have created an access token.
Thanks again for all you do!
Joe
I've actually been researching this very thing, as it peaked my curiosity in November's release party I believe. So it's in the que, just can't say how long
@@BinaryTechLabs it actually looks like my rhasspy server is working as intended. The speech to text works and the intent handler does in fact try to send the data to my HA server. I get an error in the HA server that the request was unauthorized. I do have api and intent in the HA config. I tried doing a simple curl request and had the same problem. So my issue lies with my HA server somehow. I am by way using the token generated from my user profile on HA. I think I will exec into the HA container and try the curl test again.
Now some differences between you install and mine. I am using the docker text from the install portion of HA docs. Your using the docker hub version. Only difference is where I pull the image but I think it is probably the same. My HA is set to run on the host network so no ports are mapped. I cannot remember if yours runs in the stack network created from compose or the host network. Other than that, I think ours are similar. I know it is later sown the pipe, but can you test your api with curl and let me know if your instance let's you connect? If you would like to collaborate off YT, my email is xavier at gtec dot com.
Regards,
Joe
I'll try to look at it tonight and if the image isn't being pulled from the same place (home assistant that is) there could be any number of differences in how the container's were built. I'm using the network created by compose and not the host network
Hey bud, I got it all working in my docker instance of Home Assistant. I'll update my compose yaml, but if you do reach out through email I can help you further. Btw I did send you an email
super nice guide, did you try also InfluxDB and Grafana in container? I succeeded with Grafana but no way for influxdb
Thank you for your love. Yes I am running both in containers.
version: '3'
services:
influxdb:
image: influxdb:2.6-alpine
env_file:
- influxv2.env
volumes:
# Mount for influxdb data directory and configuration
- influxdbv2:/var/lib/influxdb2:rw
ports:
- "8086:8086"
telegraf:
image: telegraf:1.25-alpine
depends_on:
- influxdb
volumes:
# Mount for telegraf config
- ./telegraf/mytelegraf.conf:/etc/telegraf/telegraf.conf:ro
env_file:
- influxv2.env
volumes:
influxdbv2:
@@BinaryTechLabs thank you. I did not explain properly: HA guys still use version 1.x of influxdb together with telegraf and kapacitor. So Grafana is using that sql language as well. Now, from your info above (and what I also tried) you use 2.x. This is using totally different sql language, right? So Grafana is not compatible (between 1.x and 2.x). Or at least I am not able to somehow set it up properly so that I can easily use Grafana with InfluxDB version 2.x.
I am not sure if you got my point ;)
Yes I use version 2, it works fine with grafana, but it's a little harder to select as you have to use flux queries, but I find going into influxdb and making it that way, I can then copy it out and use in grafana.
Hope that helps
www.home-assistant.io/integrations/influxdb/
@@BinaryTechLabs this I know, the problem is query language in v2
Very helpful video, one point I have problems with changing the path to "/opt" can you please help me with that specially Pi-Hole. Thank you
Your running PiHole in docker and have installed it in the /opt directory? And your trying to give PiHole permissions for the directory?
@@BinaryTechLabs thanks for replying, running Docker on VM; found the problem is libvirt-dnsmasq using port 53 and 67 still no solution yet to overcome that
Yea, sorry I'm not completely sure of the problem and with how I can help
Looks like I figured out what was happening with the authorization. I would double click the token to highlight it and copy. Seems that it wasn't getting the whole token. After actually getting the complete token, HA authorized Rhasspy to connect. So in the end it was a PEBCAK. Thanks again for all your help. Still don't know why my posts idnt show up in the thread below.
Again, I want to thank you for the great in-depth tutorials. They have been a wonderful help.
Regards,
Joe Hildreth
I am very happy to hear that! Don't worry about the mistake, I've made quite a few palm to face moments.
The home assistant OS runs natively in docker.... As in its literally a docker installed over linux kernal running a container.... I dont understand why they dont just have have a container for download with full capability excluding the "managed OS" as thats just what ever OS ur using and ur managing it separately.... Isn't that partially the point of Docker to be able to transfer containers...?
Yes, HAOS uses docker as a container engine and its addon modules like supervisor are containers, the base OS linux is "buildroot" which is meant to be an embedded system. It's just the direction that the Devs went.
What's your use case for docker? You can use it and still end up having a very similar product or have you considered a virtual machine for home assistant?
@@BinaryTechLabs I wanted to use it on my rpi server. I am using Home Assistant to connect, control and somewhat automate my "smart devices." They generally require add-ons to run. I wish to keep them segmented on a separate network from my main network while keeping "cloud" completely out of the picture. Further I wish to utilize the supervisor. I dont want to run it on my desktop for security, privacy and stability reasons. The reason I do not install HAOS directly on the pi is because its an 8gb rpi 4 running Kali and I have it doing other things as well for the same reasons as mentioned before. Like for example if I wanted to update my DNS service from HAOS I would just update it from my router. Oh and thanks for the reply.
You can use "supervised", that might accomplish what you want or grab a cheap laptop to install HAOS on.
Good luck
Docker OS has a serious limitation: it only recognizes USB drives. Great if you’re using their hardware or a similar ‘thin client’ machine. Horrible if you’re trying to install it on bare metal such as an old server with internal drives. That’s why I’m here watching how to use the Docker Container version.
Yea the docker container version has increased its abilities lately making it a real contender to a stand alone RPI or thin client
Great video. Do you know if it is possible for the Zigbee2MQTT container to communicate when the Zigbee hub is plugged into a different physical device (a rpi for instance). My server is too far away from the rest of the house to effectively communicate with the zigbee network - I am trying to explore alternative solutions.
Thanks, and yes as long as it is on the same network the two can talk to each other
@@BinaryTechLabs If the USB device was locally connected - I think I would just have to add these 2 lines in my Docker compose file:
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
How does that change when the USB device is connected on another machine.
Sorry if this is a dumb question, I am hoping you could just point me to the concepts I need to research, I think I am close, but I am not a power User on Linux and I have not wrapped my head around this problem yet.
Ok, I understand now, sorry. Can you clarify what zigbee hub you are using on your raspberry pi
@@BinaryTechLabs Sure- I am using the Nortek HUSBZB (originally planning to use ZHA - but If I can make Zigbee2MQTT, that is fine too). It is one of the listed supported devices for ZHA (identifier = 10C4:8A2A). It's the only USB device in the system but as it also has a zwave controller, it shows as being on "/dev/ttyUSB0" and "/dev/ttyUSB1"
Yea, you won't be able to connect that hub somewhere else and expose it to your container. But it is zigbee, so put it in the system using home assistant and if you drop a couple zigbee routers around you can expand your zigbee mesh network and cover further distances.
This is a great site for reference and compatibility
zigbee.blakadder.com/
Is it possible to add tailscale to Home Assistsnt container version?
Yes it is, just like the other "add-ons" you can find the docker-compose setup for tailscale
You need to ad more details about the folders and how to do that, because all noobs like me dont know how to deal with that in Linux...
Thank you for that opportunity and feedback. I will definitely add that into future updates. What specifically were you struggling with?
@@BinaryTechLabs Well, I was trying to install Home assistant, mqtt and zigbee2mqtt on a dietpi installation. Where docker and mqtt was installed along the DietpiOS. I managed to get Homeassistant running, but adding the others and making it function with the Mqtt installed by the installer, turned out to be to much with ZERO Linux experience and trying to make the containers talk to each other was just to hard without a reasent guide on setting this stuff up. After working pretty much 2 days straight I had to giveup and install Home Assistant OS instead. This is also pretty hard and not as easy as I was expecting, but I'm all ready further along then I was with the dietpi installation. I was watching your video to try to understand how linux is working about file structure and so on, but was missing stuff like how to navigate around in the folders how to view folders and so on. All the basics, understanding the structure without being able to use the knowledge is only painfull. 🙂
Thanks for sharing this, I'll try to add some more information on navigation and file structure for future videos
Hi there
Thank you very much for the repo and video.
I have a question though on how to successfully register ESPHome devices in Home Assistant in this setup.
I managed to get the ESPHome devices recognised after adding the ESPHOME_DASHBOARD_USE_PING=true as environment var but still can't get to disccover the ESPHome devices in HA..
Any clue to what I am missing?
Cheers
Hey there, thank you. Now have you tried adding the esphome devices from the integrations page, found from configuration - > integrations
@@BinaryTechLabs yep
Fails regardless of the name or IP provided for the ESPHome server. From memory, the error message returned complains about API although I do have an online device with homeassistant integration enabled I.
e. an API section in it's config.
Maybe I am miss understanding your question. Can you explain in detail what your trying to do, please.
@@BinaryTechLabs Sure
So context first, I am setting this up on my Windows Device (win 11 WSL2) before migrating this to another host.
So I have the docker-compose running with as mentioned the follwoing added for the esphome container:
environment:
- ESPHOME_DASHBOARD_USE_PING=true
The rest is as per your video. So in ESPHome I managed to get an online device and then try to hook ESPHome to HomeAssistant.
So In integrations, I try to add ESPHome to get the native API integration (hopefully) by trying to set the IP address of the ESPHome container and port.
And then now I realise that I need to set the ip of my ESP and not of ESPHome itself.
So in a nutshell I thank you very much :D
😁 well I'm glad to hear that you got it working, and I even learned from you about the ping=True thing.
Thanks for the video, I followed through and I seem to be able to make everything work apart from usb port mapping/location.
I tried the modification of compose file as suggested somewhere:
devices:
- /dev/ttyACM0:/dev/ttyACM0
I can find the ID of port, but not the port name itself btw.
In your demo this issue was not mentioned. What wrong?
What OS are you running for docker?
@@BinaryTechLabs Ubuntu 22.04
Ok you have tried to open terminal and type: ls /dev/tty*
I'm new to HASS and Docker. I had a previous set up with all images in a docker-compose.yaml file including Portainer itself and so as a result I saw that Portainer had a limited functionality over the other containers so I went with the stack method. Since I'm using the community edition of Portainer, I believe I won't be able to automatically pull new images and update containers and I will have to do this manually in Portainer. Question is, is this still doable using docker compose pull and up?
Yes
@@BinaryTechLabs thank you. Loved this video
Thanks for the love. ❤️
I followed the instructions, but with a deploy = error, where can I find the error log?
I have it exactly according to the instructions, but I don't have containers
What is the exact error message?
@@BinaryTechLabs
deployment error
failed to deploy a stack.
this
i do you need to create those directories? for example, when I wrote the road
/home/pi/dockconf/homeassistant
thanx
Yes, those directories need to be created
And typically it will give more on the error. If it's a stack, comment out the additional images and uncomment them one by one, stopping and redeploying them to see which is causing the problem.
@@BinaryTechLabs no, it only gives one message, that's why I asked if there is another log somewhere
I'm going to create directories