{"id":224,"date":"2019-04-13T12:11:42","date_gmt":"2019-04-13T12:11:42","guid":{"rendered":"http:\/\/jeedom.sigalou-domotique.fr\/activer-port-bluetooth-au-demarrage-de-jeedom"},"modified":"2024-04-21T13:18:13","modified_gmt":"2024-04-21T11:18:13","slug":"activer-port-bluetooth-au-demarrage-de-jeedom","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/en\/activer-port-bluetooth-au-demarrage-de-jeedom","title":{"rendered":"Enable Bluetooth port when starting Jeedom"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-220\" src=\"http:\/\/jeedom.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/souciblea.png\" alt=\"worryblea\" width=\"586\" height=\"190\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/souciblea.png 586w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/souciblea-300x97.png 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<p>If like me, you are having trouble launching the BLEA plugin when you restart your Raspberry, it may be <strong>a problem with the initialisation of the HCI0 port.<\/strong><!--more--><\/p>\n<p>You will tell me, we could configure this in Raspbian but I prefer to integrate it when starting Jeedom, it is thus saved and a reformatting of Raspbian Lite + a restoration of the Jeedom backup will be enough for everything to work again, without manipulating the Raspberry OS files.<\/p>\n<p>To do this, I will create a php script that launches the following commands:<\/p>\n<ul>\n<li>sudo systemctl enable hciuart<\/li>\n<li>sudo systemctl start hciuart<\/li>\n<li>sudo hciconfig hcio down<\/li>\n<li>sudo hciconfig hcio up<\/li>\n<\/ul>\n<p>This script, I will launch it at startup thanks to a scenario.<\/p>\n<h2>Creating the script file<\/h2>\n<p>Use the plugon <strong>script<\/strong>, create an action command <strong>script<\/strong> bearing as name <em><strong>Init Bluetooth<\/strong><\/em> and in the field <strong>query<\/strong>, put:<\/p>\n<p><strong>\/var\/www\/html\/plugins\/script\/core\/resources\/init-bluetooth.php<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-221\" src=\"http:\/\/jeedom.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scriptblea.png\" alt=\"scriptblea\" width=\"752\" height=\"184\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scriptblea.png 752w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scriptblea-600x147.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scriptblea-300x73.png 300w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/p>\n<p>In this file init-bluetooth.php, put your script:<\/p>\n<p><code>#!\/usr\/bin\/php<\/code><br \/>\n<code>&lt;!--?php$Hostname=\"localhost\";<\/code><br \/>\n<code>$Username=\"pi\";<\/code><br \/>\n<code>$Password=\"raspberry\"; <\/code><\/p>\n<p><code>$ssh = ssh2_connect($Hostname, 22);<\/code><br \/>\n<code>ssh2_auth _password($ssh, $Username, $Password);<\/code><br \/>\n<code>$stream = ssh2_exec($ssh, \"sudo systemctl enable hciuart\");<\/code><br \/>\n<code>$stream = ssh2_exec($ssh, \"sudo systemctl start hciuart\");<\/code><br \/>\n<code>$stream = ssh2_exec($ssh, \"sudo hciconfig hcio down\");<\/code><br \/>\n<code>$stream = ssh2_exec($ssh, \"sudo hciconfig hcio up\");<\/code><br \/>\n<code>?&gt;<\/code><\/p>\n<p>Of course, correct the login and password of your connection to the ssh.<\/p>\n<h2>Creating the scenario to launch at startup<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-222\" src=\"http:\/\/jeedom.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage.png\" alt=\"start-up scenario\" width=\"969\" height=\"169\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage.png 969w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage-600x105.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage-300x52.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage-768x134.png 768w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/><\/p>\n<p>Everything is on the image, note that for the scenario to run at startup, you have to use <strong>Provoked<\/strong> and as a trigger: <strong>#start#<\/strong><\/p>\n<p>This scenario includes only one command, the launch of the script created previously:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-223\" src=\"http:\/\/jeedom.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage2.png\" alt=\"start-up scenario2\" width=\"731\" height=\"120\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage2.png 731w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage2-600x98.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/04\/scenariodemarrage2-300x49.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<h3><\/h3>\n<h3><\/h3>\n<h3>And that\u2019s it, it\u2019s over. A good thing settled!!<\/h3>","protected":false},"excerpt":{"rendered":"<p>Si comme moi, vous rencontrez des difficult\u00e9s pour lancer le plugin BLEA au red\u00e9marrage de votre Raspberry, il se peut que ce soit un probl\u00e8me d&rsquo;initialisation du port HCI0.<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,23],"tags":[],"class_list":["post-224","post","type-post","status-publish","format-standard","hentry","category-domotique","category-jeedom-2"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/224","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=224"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/224\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/media?parent=224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/categories?post=224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/tags?post=224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}