{"id":5041,"date":"2023-09-23T10:16:09","date_gmt":"2023-09-23T08:16:09","guid":{"rendered":"https:\/\/www.sigalou-domotique.fr\/?p=5041"},"modified":"2026-01-02T17:00:50","modified_gmt":"2026-01-02T15:00:50","slug":"je-cree-un-switch-on-off-virtuel-persistant-home-assistant","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/de\/je-cree-un-switch-on-off-virtuel-persistant-home-assistant","title":{"rendered":"Ich erstelle einen virtuellen On\/Off-Switch (persistent)"},"content":{"rendered":"<p>Um meinen Automatisierungen oder Skripten mitteilen zu k\u00f6nnen, ob ich die automatische Bew\u00e4sserung zulasse oder nicht, wollte ich einen \u201evirtuellen\u201c Switch erstellen, der keine Verbindung zu einer Entit\u00e4t (also kein Template) aufweist und seinen Status bei der Wiederbelebung von Home Assistant (persistent) beibeh\u00e4lt.<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/switchvirtuel.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5042\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/switchvirtuel.gif\" alt=\"\" width=\"376\" height=\"34\" \/><\/a><!--more--><\/p>\r\n<h3>Ich erstelle einen Input_boolean<\/h3>\r\n<h4>Option 1: Nach Konfiguration.yaml<\/h4>\r\n<p>In meiner _yaml-Konfigurationsdatei werde ich meinen virtuellen Schalter hinzuf\u00fcgen<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">input_boolean: _automatische Bew\u00e4sserung: #input_boolean.bew\u00e4sserung_automatisch name: Zul\u00e4ssige Bew\u00e4sserung Icon: mdi:sprinkler-variant<\/pre>\r\n<h4>Option 2: \u00dcber die grafische Benutzeroberfl\u00e4che<\/h4>\r\n<p>Ich gehe zu Einstellungen \/ Ger\u00e4te und Dienste \/ Eing\u00e4nge \/ Eing\u00e4nge erstellen \/ Schalter\u00a0<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/arrosageautorise4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5051\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/arrosageautorise4.png\" alt=\"\" width=\"408\" height=\"255\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/arrosageautorise4.png 408w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/arrosageautorise4-300x188.png 300w\" sizes=\"auto, (max-width: 408px) 100vw, 408px\" \/><\/a><\/p>\r\n<h3>Ich werde sein Icon personalisieren<\/h3>\r\n<p>Dies geschieht in der Datei customize.yaml, die in der Datei configuration.yaml deklariert werden muss.<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/customize.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5129\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/customize.png\" alt=\"\" width=\"245\" height=\"123\" \/><\/a><\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/customize2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5130\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/customize2.png\" alt=\"\" width=\"465\" height=\"208\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/customize2.png 465w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/customize2-300x134.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/a><\/p>\r\n<p>In dieser Datei customize.yaml f\u00fcge ich diese Zeilen<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">input_boolean.Bew\u00e4sserung_automatisch: Templates: Icon: &gt; return (state === 'on')? 'mdi:sprinkler-variant' : 'mdi:water-off'; icon_color: &gt; return (state === 'on')? 'gr\u00fcn': 'rgb(54, 95, 140)';<\/pre>\r\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Um meinen Automatisierungen oder Skripten mitteilen zu k\u00f6nnen, ob ich die automatische Bew\u00e4sserung zulasse oder nicht, wollte ich einen \u201evirtuellen\u201c Switch erstellen, der keine Verbindung zu einer Entit\u00e4t (also kein Template) aufweist und seinen Status bei der Wiederbelebung von Home Assistant (persistent) beibeh\u00e4lt.<\/p>","protected":false},"author":1,"featured_media":5047,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,53,166],"tags":[81,62],"class_list":["post-5041","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domotique","category-home-assistant","category-retex","tag-developpement","tag-switch"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts\/5041","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=5041"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts\/5041\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/media\/5047"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/media?parent=5041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/categories?post=5041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/tags?post=5041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}