{"id":4411,"date":"2023-05-30T12:45:22","date_gmt":"2023-05-30T10:45:22","guid":{"rendered":"https:\/\/www.sigalou-domotique.fr\/?p=4411"},"modified":"2026-04-26T11:48:55","modified_gmt":"2026-04-26T09:48:55","slug":"je-voudrais-savoir-si-nous-sommes-le-jour-ou-la-nuit","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/de\/je-voudrais-savoir-si-nous-sommes-le-jour-ou-la-nuit","title":{"rendered":"Ich w\u00fcrde gerne wissen, ob wir Tag oder Nacht sind"},"content":{"rendered":"<h3>Ziel<\/h3>\r\n<p>Mein urspr\u00fcngliches Ziel war es, die Au\u00dfenbeleuchtung einzuschalten, wenn sich das Portal \u00f6ffnet, aber <strong>nur<\/strong> Nachts!<!--more--><\/p>\r\n<h3>Pr\u00fcfungen<\/h3>\r\n<p>Ich habe mehrere Integrationen getestet:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/sun\/\" target=\"_blank\" rel=\"noopener\">Sun<\/a><\/li>\r\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/workday\/\" target=\"_blank\" rel=\"noopener\">WorkDay<\/a> Wor\u00fcber ich im Retex spreche <a href=\"https:\/\/www.sigalou-domotique.fr\/de\/ecole-demain\/\" target=\"_blank\" rel=\"noopener\">Schule morgen?<\/a><\/li>\r\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/tod\/\" target=\"_blank\" rel=\"noopener\">Times of the Day<\/a><\/li>\r\n<\/ul>\r\n<h3>Ich erstelle einen binary_sensor <strong>Es ist Nacht<\/strong><\/h3>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4418\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit.png\" alt=\"\" width=\"1051\" height=\"104\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit.png 1051w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit-600x59.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit-300x30.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit-1024x101.png 1024w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit-768x76.png 768w\" sizes=\"auto, (max-width: 1051px) 100vw, 1051px\" \/><\/p>\r\n<p>Offensichtlich nimmt dieser binary_sensor zwei Werte an:<\/p>\r\n<ul>\r\n<li>Es gilt: Wenn es dunkel ist<\/li>\r\n<li>off: Wenn es Tag ist<\/li>\r\n<\/ul>\r\n<p>Die Puristen (die Schwierigkeiten suchen) k\u00f6nnen sich selbst eine Freude machen und sich einen zweiten binary_sensor f\u00fcr das \"es ist Tag\" schaffen. \ud83d\ude09<\/p>\r\n<p>Einfacher Code dieses binary_sensor, der in binary_sensor.yaml zu erstellen ist, wenn man bedenkt, dass er in configuration.yaml deklariert wurde:<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">- platform: tod name: \"Es ist Nacht\" einzigartige_id: binary_sensor.nuit after: sunset after_offset: \"-00:10\" before: sunrise before_offset: \"+00:10\"<\/pre>\r\n<p>after_offset und before_offset bei 10min, das ist nicht aus Gr\u00fcnden der Perfektion, sondern um mich an die Syntax dieses Parameters zu erinnern, wenn ich ihn in Zukunft anpassen m\u00f6chte.<\/p>\r\n<ul>\r\n<li>Danke @\u1f36\u10f0\u10db#6938 zu helfen.<\/li>\r\n<\/ul>\r\n<h3>Verwenden dieses binary_sensors in einer Bedingung<\/h3>\r\n<p>Mein Ziel ist es, die Au\u00dfenbeleuchtung nur dann einzuschalten, wenn sich das Tor \u00f6ffnet, wenn es dunkel ist, daher wird folgende Bedingung hinzugef\u00fcgt:<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4423\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit2.png\" alt=\"\" width=\"1083\" height=\"125\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit2.png 1083w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit2-600x69.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit2-300x35.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit2-1024x118.png 1024w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ilfaitnuit2-768x89.png 768w\" sizes=\"auto, (max-width: 1083px) 100vw, 1083px\" \/><\/p>\r\n<p>Ich setze die Bedingung nicht auf das Schlie\u00dfen, denn wenn es zwischen dem \u00d6ffnen und dem Schlie\u00dfen Tag wird, bleiben die Lichter eingeschaltet.<\/p>","protected":false},"excerpt":{"rendered":"<p>Mein urspr\u00fcngliches Ziel war es, die Au\u00dfenbeleuchtung einzuschalten, wenn sich das Tor \u00f6ffnet, aber nur nachts!<\/p>","protected":false},"author":1,"featured_media":4416,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,53,166],"tags":[81],"class_list":["post-4411","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domotique","category-home-assistant","category-retex","tag-developpement"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts\/4411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/comments?post=4411"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts\/4411\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/media\/4416"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/media?parent=4411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/categories?post=4411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/tags?post=4411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}