{"id":4,"date":"2021-01-16T18:52:02","date_gmt":"2021-01-16T18:52:02","guid":{"rendered":"https:\/\/blog.jantle.de\/?p=4"},"modified":"2021-01-17T15:38:35","modified_gmt":"2021-01-17T15:38:35","slug":"esphome-haendisch-installieren","status":"publish","type":"post","link":"https:\/\/blog.jantle.de\/?p=4","title":{"rendered":"ESPhome h\u00e4ndisch installieren"},"content":{"rendered":"\n<p>Voraussetzung ist eine Python3 Installation<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5<\/pre>\n\n\n\n<p>ESPhome wird als neuer Nutzer mit eigenem Homeverzeichnis installiert:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">sudo useradd -rm esphome<\/pre>\n\n\n\n<p>W\u00e4hrend die Konfigurationsdateien sp\u00e4ter im home landen, wird die ESPhome Installation selber in einem virtuellen Python-Environment im Verzeichnis <code>\/srv\/esphome\/<\/code> installiert.<\/p>\n\n\n\n<p>Dazu ersteinmal das Verzeichnis erstellen und die Rechte dem neuen Nutzer <code>esphome<\/code> zuweisen.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">cd \/srv\nsudo mkdir esphome\nsudo chown esphome:esphome esphome<\/pre>\n\n\n\n<p>Die Installation wird dann in dem virtuellen Python Environment als Nutzer <code>esphome<\/code> durchgef\u00fchrt. Wir wechseln also den Nutzer, gehen in das Installationsverzeichnis, installieren die virtuelle Umgebung und wechseln dann in diese hinein.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">sudo -u esphome -H -s\ncd \/srv\/esphome\npython3 -m venv .\nsource bin\/activate<\/pre>\n\n\n\n<p>noch schnell ein notwendiges Python-Paket installieren mit<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">python3 -m pip install wheel<\/pre>\n\n\n\n<p>und im Anschluss <\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">pip3 install esphome<\/pre>\n\n\n\n<p>et voil\u00e0!   &#8230; naja, fast. Prinzipiell kann ESPHome jetzt direkt \u00fcber die commandline verwendet und gestartet werden. Aber wenn wir schonmal dabei sind, dann richtig. <br>Erstmal wechseln mit <code>exit<\/code> wieder zur\u00fcck zu unserem eigenen Account. <br>Damit ESPHome mit jedem Neustart des Rechners automatisch aktiviert wird, erstellen wir das System-Startscript <code>\/etc\/systemd\/system\/esphome.service<\/code>  mit folgendem Inhalt:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">[Unit]\nDescription=ESPHome Dashboard\nAfter=homeassistant.service\nRequires=homeassistant.service\n\n[Service]\nType=simple\nUser=esphome\nEnvironment=\"PATH=\/srv\/esphome\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\"\nWorkingDirectory=\/srv\/esphome\/\nExecStart=\/srv\/esphome\/bin\/esphome \/home\/esphome\/config\/ dashboard --password GEHEIMESPASSWORT\nRestart=on-failure\nRestartSec=5s\n\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\n<p>Dieses script wird nun noch aktiviert und direkt gestartet:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">sudo systemctl --system daemon-reload\nsudo systemctl enable esphome\nsudo systemctl start esphome<\/pre>\n\n\n\n<p>ESPHome ist jetzt aktiv und lauscht mit dem Dashboard auf port 6052.\nhttp:\/\/mei.ne.ip:6052\/<\/p>\n\n\n\n<p>Um sp\u00e4ter ESPHome zu aktualisieren<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">sudo -u esphome -H -s\ncd \/srv\/esphome\nsource bin\/activate\npip install -U esphome<\/pre>\n\n\n\n<p>M\u00f6chte man die neuesten Funktionen nutzen, kann es Sinn machen, auch mal die Beta-Version auszuprobieren:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wp-block-code\">sudo -u esphome -H -s\ncd \/srv\/esphome\nsource bin\/activate\npip install --pre -U esphome<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Voraussetzung ist eine Python3 Installation sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 ESPhome wird als neuer Nutzer mit eigenem Homeverzeichnis installiert: sudo useradd -rm esphome W\u00e4hrend die Konfigurationsdateien sp\u00e4ter im home landen, wird die ESPhome Installation selber in einem virtuellen Python-Environment im Verzeichnis \/srv\/esphome\/ installiert. Dazu ersteinmal [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4,3,2],"class_list":["post-4","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-esphome","tag-home-assistant","tag-smart-home"],"_links":{"self":[{"href":"https:\/\/blog.jantle.de\/index.php?rest_route=\/wp\/v2\/posts\/4","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jantle.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jantle.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jantle.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jantle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4"}],"version-history":[{"count":10,"href":"https:\/\/blog.jantle.de\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions"}],"predecessor-version":[{"id":39,"href":"https:\/\/blog.jantle.de\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions\/39"}],"wp:attachment":[{"href":"https:\/\/blog.jantle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jantle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jantle.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}