{"id":4187,"date":"2023-05-23T07:14:06","date_gmt":"2023-05-23T05:14:06","guid":{"rendered":"https:\/\/www.sigalou-domotique.fr\/?p=4187"},"modified":"2025-09-04T10:12:10","modified_gmt":"2025-09-04T08:12:10","slug":"je-domotise-mon-portail","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail","title":{"rendered":"I domotise my portal with an ESP Wifi"},"content":{"rendered":"<h3><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4236\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/portail-1.gif\" alt=\"\" width=\"381\" height=\"187\" \/><\/h3>\r\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<label for=\"ez-toc-cssicon-toggle-item-6aea57f40b7f8\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6aea57f40b7f8\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Mes_objectifs\" >My objectives\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Contexte\" >Background<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Presentation_de_la_carte_de_commande\" >Presentation of the order card<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Comment_ouvrirfermer_le_portail\" >How to open\/close the portal?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Comment_savoir_si_le_portail_est_ouvert_ou_ferme\" >How do I know if the portal is open or closed?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Quel_equipement_domotique\" >What home automation equipment?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Preparation_du_Sonoff_Basic\" >Preparing the Sonoff Basic<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Modifier_le_Sonoff_Basic_pour_que_la_sortie_soit_un_contact_sec\" >Modify the Sonoff Basic so that the output is a dry contact<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Relier_les_equipements\" >Connect equipment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Flasher_le_Sonoff_Basic_et_lui_installer_ESP_Home\" >Flash the Sonoff Basic and install ESP Home<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Integrer_le_Sonoff_Basic_dans_Home_Assistant\" >Integrate Sonoff Basic into Home Assistant<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Recuperer_les_informations_sur_esphomeio\" >Recover information on esphome.io<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Installation_du_code_sur_le_Sonoff\" >Installing the code on the Sonoff<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Resultat_de_lintegration\" >Outcome of integration<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Configuration_des_Entites_sur_HA\" >Configuring Entities on HA<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Configuration_du_capteur_Portail\" >Configuring the Portal Sensor<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Configuration_du_controle_Commande_du_Portail\" >Configuring the Control Portal Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Configuration_du_Cover_Portail\" >Configuring the Cover Portal<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Creation_dune_carte_bouton\" >Creating a button card<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Lier_HA_et_Alexa_pour_commander_a_la_voix\" >Link HA and Alexa to command by voice<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Bonus_Ping_pour_verifier_que_lequipement_est_en_ligne\" >Bonus: Ping to check that the equipment is online<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/www.sigalou-domotique.fr\/en\/je-domotise-mon-portail\/#Une_question_une_remarque_un_complement\" >A question ? a remark ? a supplement ?<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Mes_objectifs\"><\/span>My objectives\u00a0<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<ul>\r\n<li>Have a button on the dashboard to activate the portal (Order=On + pause + Off)<\/li>\r\n<li>Have the real state of the portal returned (open\/closed)<\/li>\r\n<li>Link HA and Alexa to be able to say \"Alexa opens the portal\" for example<\/li>\r\n<\/ul>\r\n<p><!--more--><\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Contexte\"><\/span>Background<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>I have a beating Came portal, Map ZL180.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4188\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180.png\" alt=\"\" width=\"428\" height=\"335\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180.png 428w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-300x235.png 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/ZL180_F.pdf\" target=\"_blank\" rel=\"noopener\">Notice<\/a><\/li>\r\n<\/ul>\r\n<h3><span class=\"ez-toc-section\" id=\"Presentation_de_la_carte_de_commande\"><\/span>Presentation of the order card<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Everything will happen at the terminals of the control card at the bottom right, here is the identification of the terminals<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4193\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-2.png\" alt=\"\" width=\"246\" height=\"66\" \/><\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Comment_ouvrirfermer_le_portail\"><\/span>How to open\/close the portal?<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>It is a dry contact that can be symbolised by this sequence that will open (or close) the portal:<\/p>\r\n<ul>\r\n<li>ON on Terminal 2 \u2013 Terminal 7<\/li>\r\n<li>pause 500ms<\/li>\r\n<li>OFF on Terminal 2 \u2013 Terminal 7<\/li>\r\n<\/ul>\r\n<p>These elements are documented on page 8 of the notice:<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4194\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-3.png\" alt=\"\" width=\"1174\" height=\"278\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-3.png 1174w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-3-600x142.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-3-300x71.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-3-1024x242.png 1024w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-3-768x182.png 768w\" sizes=\"auto, (max-width: 1174px) 100vw, 1174px\" \/><\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Comment_savoir_si_le_portail_est_ouvert_ou_ferme\"><\/span>How do I know if the portal is open or closed?<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>I did not find an accessible dry contact giving this information, I used an \u2018open gate\u2019 signalling device which under potential 24v between terminals 5 and 10 , this information is documented on page 6 of the notice:<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4199\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-4.png\" alt=\"\" width=\"991\" height=\"198\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-4.png 991w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-4-600x120.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-4-300x60.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-4-768x153.png 768w\" sizes=\"auto, (max-width: 991px) 100vw, 991px\" \/><\/p>\r\n<p>Preferring to work with dry on\/off contacts with no potential, i.e. open or closed circuits, I transformed this information 0\/24v into on\/off.<\/p>\r\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4201\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-6.png\" alt=\"\" width=\"723\" height=\"198\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-6.png 723w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-6-600x164.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-6-300x82.png 300w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><\/p>\r\n<p>To realize this assembly, nothing more simple, 4 cables and a 24V relay. I already had a relay, so I used this one, it is an IEC255 that looks like this:<br \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-4203\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-7.png\" alt=\"\" width=\"114\" height=\"163\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-7.png 283w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-7-210x300.png 210w\" sizes=\"auto, (max-width: 114px) 100vw, 114px\" \/><\/p>\r\n<p>I have enough room in the Came\u2019s platinum case to place this relay on the top right.<\/p>\r\n<p>Here is the wiring with the support:<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-4204\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-8.png\" alt=\"\" width=\"751\" height=\"395\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-8.png 931w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-8-600x316.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-8-300x158.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-8-768x404.png 768w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Quel_equipement_domotique\"><\/span>What home automation equipment?<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>At this stage, it is necessary to choose which home automation equipment will send the open\/closed portal information to Home Assistant and which equipment is capable of controlling a dry contact that will trigger the opening. Ideally, the same equipment to do both.<\/p>\r\n<p>I did several tests, initially with a door\/window detector to send the open\/closed portal, in Zigbee but I think that the proximity of the transfo was a concern, I do not know, it was not convincing. Then this equipment did not allow to order a relay.<\/p>\r\n<p>I would have really preferred to use Zigbee because for me Wi-Fi is not a home automation protocol.<\/p>\r\n<p>Finally, here is my very simple choice: A <a href=\"https:\/\/s.click.aliexpress.com\/e\/_DCeh1El\" target=\"_blank\" rel=\"noopener\">Sonoff Basic<\/a>\u00a0<\/p>\r\n<p><a href=\"https:\/\/s.click.aliexpress.com\/e\/_DCeh1El\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4207 aligncenter\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/sonoffbasic.png\" alt=\"\" width=\"278\" height=\"160\" \/><\/a><\/p>\r\n<p>This equipment, which was worth less than \u20ac4 not long ago, costs between \u20ac5 and \u20ac6 at the time I write this on <a href=\"https:\/\/s.click.aliexpress.com\/e\/_DCeh1El\" target=\"_blank\" rel=\"noopener\">AliExpress<\/a> and within 14 \u20ac on <a href=\"https:\/\/amzn.to\/45GCAGb\" target=\"_blank\" rel=\"noopener\">Amazon<\/a>.<\/p>\r\n<p>Be careful, I had to tinker a little, weld but for this price, it is worth it (and the cost).<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Preparation_du_Sonoff_Basic\"><\/span>Preparing the Sonoff Basic<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<h4><span class=\"ez-toc-section\" id=\"Modifier_le_Sonoff_Basic_pour_que_la_sortie_soit_un_contact_sec\"><\/span>Modify the Sonoff Basic so that the output is a dry contact<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The Sonoff Basic, R2 in my case is a device that switches a relay when it is sent an On or Off command on GPIO12.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-250\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/08\/esp1.jpg\" alt=\"esp1\" width=\"396\" height=\"114\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/08\/esp1.jpg 396w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/08\/esp1-300x86.jpg 300w\" sizes=\"auto, (max-width: 396px) 100vw, 396px\" \/><\/p>\r\n<p>The concern in this configuration is that I send the input potential so 220V on the output, between the output terminals, so we have either 0v or 220v. This is not what I need, I just need to close a circuit (short circuit) between the output terminals. I therefore need this type of scheme:<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-249\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/08\/esp2.jpg\" alt=\"esp2\" width=\"396\" height=\"114\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/08\/esp2.jpg 396w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/08\/esp2-300x86.jpg 300w\" sizes=\"auto, (max-width: 396px) 100vw, 396px\" \/><\/p>\r\n<p>To make this change, I made this retex:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/en\/contact-sec-ou-relais-avec-un-sonoff-basic\/\" target=\"_blank\" rel=\"noopener\">A dry contact (or relay) connected wifi for -4\u20ac compatible Jeedom<\/a><\/li>\r\n<\/ul>\r\n<h3><span class=\"ez-toc-section\" id=\"Relier_les_equipements\"><\/span>Connect equipment<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>(this can be done after the software configuration, it is your choice)<\/p>\r\n<p>Here is the complete diagram\u00a0<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4213\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-9.png\" alt=\"\" width=\"1004\" height=\"906\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-9.png 1004w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-9-600x541.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-9-300x271.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-9-768x693.png 768w\" sizes=\"auto, (max-width: 1004px) 100vw, 1004px\" \/><\/p>\r\n<p>I did not forget to supply 220v to the Sonoff on the bottom terminal block and I put the relay on its black support.<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Flasher_le_Sonoff_Basic_et_lui_installer_ESP_Home\"><\/span>Flash the Sonoff Basic and install ESP Home<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/en\/flasher-sonoff-basic-r2-avec-esphome\/\" target=\"_blank\" rel=\"noopener\">Flashing an ESP Sonoff with ESPHome<\/a><\/li>\r\n<\/ul>\r\n<h3><span class=\"ez-toc-section\" id=\"Integrer_le_Sonoff_Basic_dans_Home_Assistant\"><\/span>Integrate Sonoff Basic into Home Assistant<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Once flashed in ESP Home, the new equipment is recognized in Home Assistant in the integrations<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4141\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp25.png\" alt=\"\" width=\"214\" height=\"135\" \/><\/p>\r\n<p>I can start configuring entities.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4149\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp26.png\" alt=\"\" width=\"619\" height=\"306\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp26.png 619w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp26-600x297.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp26-300x148.png 300w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"Recuperer_les_informations_sur_esphomeio\"><\/span>Recover information on esphome.io<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>It is always better to retrieve the information from the source, otherwise, many sites, tutorials or forums can give the necessary configuration elements.<\/p>\r\n<p>For my Sonoff Basic, I'm going on\u00a0<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/esphome.io\/devices\/sonoff_basic.html?highlight=sonoff\" target=\"_blank\" rel=\"noopener\">https:\/\/esphome.io\/devices\/sonoff_basic.html?highlight=sonoff<\/a><\/li>\r\n<\/ul>\r\n<p>Obviously, I am not the doc, I change the led to be able to order it and I configure Rx and Tx to have two more inputs:<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">esphome: name: esphome-web-a8d117 friendly_name: Portal esp8266: board: esp8285 # Enable logging logger: # Enable Home Assistant API API: encryption: key: \"xx\" ota: binary_sensor: - platform: gpio pin: number: GPIO0 mode: input: true pullup: true inverted: true name: \"Bouton\" - platform: gpio pin: number: GPIO1 mode: input: true pullup: true inverted: true name: \"Tx\" - platform: gpio pin: number: GPIO3 mode: input: true pullup: true inverted: true name: \"Rx\" switch: - platform: gpio name: \"Relay\" pin: GPIO12 id: relay on _turn _on: - delay: 0.5s - switch.turn _off: relay - platform: gpio name: \"Led\" pin: GPIO13 id: led wifi: ssid: xxx password: xxx # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: xxx password: xxx captive _portal:\r\n    <\/pre>\r\n<p>I keep the above code as a reference for other equipment but finally for my portal domotisation, I further simplify the code by deleting everything that is not useful for the project:<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">esphome: name: esphome-web-a8d117 friendly_name: Portal esp8266: board: esp8285 # Enable logging logger: # Enable Home Assistant API API: encryption: key: \"xx\/xx=\" ota: binary_sensor: - platform: gpio pin: number: GPIO1 mode: input: true pullup: true inverted: true name: \"Tx\" switch: - platform: gpio name: \"Relay\" pin: GPIO12 id: relay on _turn _on: - delay: 0.5s - switch.turn _off: wifi relay: ssid: xx password: xx # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: esp_portail password: xx<\/pre>\r\n<h4><span class=\"ez-toc-section\" id=\"Installation_du_code_sur_le_Sonoff\"><\/span>Installing the code on the Sonoff<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>Then I save and then install.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4152\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp27.png\" alt=\"\" width=\"150\" height=\"67\" \/><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4154\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp28.png\" alt=\"\" width=\"444\" height=\"366\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp28.png 444w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp28-300x247.png 300w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/p>\r\n<p>Once the installation is done, the module relaunches, you have to be a little patient.<\/p>\r\n<p>Note: I had some problems because the !secret variables were not configured at home, I put it in plain language and it worked. The secret variables are configured at the top right of the ESP Home interface.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4265\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-17.png\" alt=\"\" width=\"238\" height=\"96\" \/><\/p>\r\n<pre>  <span class=\"nt\">ssid<\/span><span class=\"p\">:<\/span> <span class=\"kt\">!secret<\/span> <span class=\"l l-Scalar l-Scalar-Plain\">wifi_ssid<\/span>\r\n  <span class=\"nt\">password<\/span><span class=\"p\">:<\/span> <span class=\"kt\">!secret<\/span> <span class=\"l l-Scalar l-Scalar-Plain\">wifi_password<br \/><br \/><\/span><\/pre>\r\n<h4><span class=\"ez-toc-section\" id=\"Resultat_de_lintegration\"><\/span>Outcome of integration<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>As everything went well, I find myself with several entities on his newly created ESP.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4214\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-10.png\" alt=\"\" width=\"211\" height=\"132\" \/><\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Configuration_des_Entites_sur_HA\"><\/span>Configuring Entities on HA<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<h4><span class=\"ez-toc-section\" id=\"Configuration_du_capteur_Portail\"><\/span>Configuring the Portal Sensor<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>I use the Tx input (GPIO01) to detect the dry contact of the portal.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4172\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp29.png\" alt=\"\" width=\"250\" height=\"158\" \/><br \/><span style=\"color: initial; font-size: revert;\">I rename this sensor to \"Portal\" and I assign it \"Open\" to have the states Open \/ Closed<\/span><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4175\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp30.png\" alt=\"\" width=\"449\" height=\"258\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp30.png 449w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp30-300x172.png 300w\" sizes=\"auto, (max-width: 449px) 100vw, 449px\" \/><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4176\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp31.png\" alt=\"\" width=\"252\" height=\"90\" \/><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4177\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp32.png\" alt=\"\" width=\"254\" height=\"39\" \/><\/p>\r\n<p>I change his ID, which will be: binary_sensor.portal_open_ferme<\/p>\r\n<p>I disable the other two sensors (Bouton and Rx) that are not useful to me.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"Configuration_du_controle_Commande_du_Portail\"><\/span>Configuring the Control Portal Command<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4228\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-11.png\" alt=\"\" width=\"245\" height=\"92\" \/><\/p>\r\n<p>This is the relay switch that I renamed Portal Command with id: switch.portal _relais<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4229\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-12.png\" alt=\"\" width=\"445\" height=\"250\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-12.png 445w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-12-300x169.png 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"Configuration_du_Cover_Portail\"><\/span>Configuring the Cover Portal<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>It is necessary to have a cover to allow two things:<\/p>\r\n<ul>\r\n<li>To have the state rising from the sensor <em>Portal<\/em> (binary_sensor.portal_open_close) this while the orders are to be passed to the control <em>Ordering the Portal<\/em> (switch.portal _relais)<\/li>\r\n<li>To manage the turn_off which will actually be a turn_on<\/li>\r\n<\/ul>\r\n<p>The code of the cover placed in <a href=\"https:\/\/github.com\/sigalou\/home-assistant-config-fr\/blob\/main\/covers.yaml\" target=\"_blank\" rel=\"noopener\">covers.yaml<\/a> is as follows:<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">- platform: template covers: portal: device_class: window friendly_name: Single _id \"Portal\": cover.portal value _template: \"{{ is_state('binary_sensor.portal _open_ferme', 'on') }}\" open_cover: Service: switch.turn_on target: entity_id: switch.portal_relais close_cover: Service: switch.turn_on target: entity_id: switch.portal _relais icon_template: &gt;- {% if is_state('binary_sensor.portal_ouvert_ferme', 'on') %mdi:gate-open {% else %mdi:gate {% endif %}<\/pre>\r\n<p>Note that in this code, I manage the icon to be used. The colour will be managed in the button card when the button is displayed.<\/p>\r\n<p>I used the _class device: window because it is the closest to a portal (open or closed) but the other classes make a 4-digit code mandatory in voice command which I do not want if I want to ask Alexa to open the portal.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"Creation_dune_carte_bouton\"><\/span>Creating a button card<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4236\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/portail-1.gif\" alt=\"\" width=\"381\" height=\"187\" \/><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4232\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-13.png\" alt=\"\" width=\"744\" height=\"247\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-13.png 744w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-13-600x199.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-13-300x100.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">Type: custom:button-card show_name: false tap_action: Action: toggle entity: cover.portal state: -value: close color: gray - value: open color: red<\/pre>\r\n<h3><span class=\"ez-toc-section\" id=\"Lier_HA_et_Alexa_pour_commander_a_la_voix\"><\/span>Link HA and Alexa to command by voice<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Saying \"Alexa opens the portal\" is still the grail of it all.<\/p>\r\n<p>I still have to make the connection.<\/p>\r\n<p>For this I go to Settings\/ Voice Assistants<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4242\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-14.png\" alt=\"\" width=\"504\" height=\"73\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-14.png 504w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-14-300x43.png 300w\" sizes=\"auto, (max-width: 504px) 100vw, 504px\" \/><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4243\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-15.png\" alt=\"\" width=\"629\" height=\"284\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-15.png 629w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-15-600x271.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-15-300x135.png 300w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/p>\r\n<p>At the bottom left, I click on <em>x exposed entity(ies)<\/em><\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4244\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/zl180-16.png\" alt=\"\" width=\"172\" height=\"40\" \/><\/p>\r\n<p>and I live looking for my <em><strong>cover.portal<\/strong><\/em><\/p>\r\n<p>That\u2019s all!<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Bonus_Ping_pour_verifier_que_lequipement_est_en_ligne\"><\/span>Bonus: Ping to check that the equipment is online<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4249\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/icone.png\" alt=\"\" width=\"221\" height=\"115\" \/><\/p>\r\n<p>I have complete confidence in Wi-Fi equipment (unlike Zigbee) and I reassure myself by checking its connectivity from time to time.<\/p>\r\n<p>For that, nothing is simpler, a small ping every 5 minutes via a binary _sensor that gives me the information on my Dashboard, I place this config in my file <a href=\"https:\/\/github.com\/sigalou\/home-assistant-config-fr\/blob\/main\/binary_sensors.yaml\" target=\"_blank\" rel=\"noopener\">binary_sensor.yaml<\/a><\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">- platform: ping host: !secret ip_portail name: ping_portal<br \/><br \/><\/pre>\r\n<p>Of course, you have to configure !secret or replace it with raw IP.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4181\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp35.png\" alt=\"\" width=\"778\" height=\"158\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp35.png 778w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp35-600x122.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp35-300x61.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/05\/esp35-768x156.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/p>\r\n<p>The customisation of the icon is discussed on another retex:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/en\/signaler-un-defaut-sur-le-dashboard\/\" target=\"_blank\" rel=\"noopener\">Visually report a defect on the dashboard<\/a><\/li>\r\n<\/ul>\r\n<h3><span class=\"ez-toc-section\" id=\"Une_question_une_remarque_un_complement\"><\/span>A question ? a remark ? a supplement ?<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Use <a href=\"https:\/\/forum.hacf.fr\/t\/retex-je-domotise-mon-portail\/\" target=\"_blank\" rel=\"noopener\">this discussion<\/a> to evoke this retex:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/forum.hacf.fr\/t\/retex-je-domotise-mon-portail\/\" target=\"_blank\" rel=\"noopener\">https:\/\/forum.hacf.fr\/t\/retex-je-domotise-mon-portail\/<\/a><\/li>\r\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>My objectives Have a button on the dashboard that allows you to activate the portal (Order=On + pause + Off) Have the actual status of the portal return (open \/ closed) Link HA and Alexa to be able to say \u2018Alexa opens the portal\u2019 for example<\/p>","protected":false},"author":1,"featured_media":4236,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,53],"tags":[69],"class_list":["post-4187","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domotique","category-home-assistant","tag-portail"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/4187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/comments?post=4187"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/4187\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/media\/4236"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/media?parent=4187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/categories?post=4187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/tags?post=4187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}