{"id":261,"date":"2019-09-15T09:36:14","date_gmt":"2019-09-15T09:36:14","guid":{"rendered":"http:\/\/jeedom.sigalou-domotique.fr\/fixer-les-ports-usb-d-un-raspberry"},"modified":"2024-04-21T13:18:38","modified_gmt":"2024-04-21T11:18:38","slug":"fixer-les-ports-usb-d-un-raspberry","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/en\/fixer-les-ports-usb-d-un-raspberry","title":{"rendered":"Attach USB ports to a Raspberry"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-260\" src=\"http:\/\/jeedom.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/usbinterro.png\" alt=\"usbinterro\" width=\"120\" height=\"166\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/usbinterro.png 490w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/usbinterro-217x300.png 217w\" sizes=\"auto, (max-width: 120px) 100vw, 120px\" \/><\/p>\n<h3>1st part, suitable for a standard Raspbian Os distribution<\/h3>\n<p>On the same Jeedom, I have two devices that use USB ports:<\/p>\n<ul>\n<li>A CM11 that controls my X10 equipment (yes, I still have one)<\/li>\n<li>A key zWave stick Aeon Labs<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p>One is on \/dev\/ttyUSB0 and the other is on \/dev\/ttyUSB1<\/p>\n<p>For some unknown reason, sometimes the Raspberry reverses the ports and this causes concern. I have been looking at how to freeze these ports.<\/p>\n<p>To avoid the 0 not recommended in the name of the USB, I chose to use <strong>USB11 (for CM11)<\/strong> and <strong>USB12<\/strong>.<\/p>\n<p>We're doing one:<\/p>\n<p><code><\/code>sudo lsusb -v | more<\/p>\n<p>Copy lines:<\/p>\n<ul>\n<li>idVendor<\/li>\n<li>idProduct<\/li>\n<\/ul>\n<p>I therefore have:<\/p>\n<ul>\n<li>idVendor 0x10c4 Cygnal Integrated Products, Inc.<\/li>\n<li>idProduct 0xea60 CP210x UART Bridge \/ myAVR mySmartUSB light<\/li>\n<\/ul>\n<p>(or for the Gen5 )<\/p>\n<ul>\n<li>idVendor 0x0658 Sigma Designs, Inc.<\/li>\n<li>idProduct 0x0200 Aeotec Z-Stick Gen5 (ZW090) \u2013 UZB<\/li>\n<\/ul>\n<p>and<\/p>\n<ul>\n<li>idVendor 0x067b Prolific Technology, Inc.<\/li>\n<li>idProduct 0x2303 PL2303 Serial Port<\/li>\n<\/ul>\n<p>The Raspberry will be asked to apply a naming rule using the file <strong>\/etc\/udev\/rules.d\/99-usb-serial.rules<\/strong><\/p>\n<p><code>sudo nano \/etc\/udev\/rules.d\/99-usb-serial.rules<\/code><\/p>\n<p>And we add:<\/p>\n<p>SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"067b\", ATTRS{idProduct}==\"2303\u2033, SYMLINK+=\"ttyUSB11\u2033<\/p>\n<p>SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"10c4\u2033, ATTRS{idProduct}==\"ea60\u2033, SYMLINK+=\"ttyUSB12\u2033<\/p>\n<p>or for the Gen5<\/p>\n<p>SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0658\u2033, ATTRS{idProduct}==\"0200\u2033, SYMLINK+=\"ttyUSB12\u2033<\/p>\n<p>A Ctrl+W and a Ctrl+X and on <strong>reboot<\/strong><\/p>\n<p><strong>We find ourselves with the duplicate equipment, it does not matter, so we choose \/dev\/ttyUSB12 in the ZWAVE plugin config and \/dev\/ttyUSB11 in the Heyu config (<code>vi \/root\/.heyu\/x10config<\/code>)<\/strong><\/p>\n<p><strong>Resources:<\/strong><\/p>\n<ul>\n<li><strong><a href=\"https:\/\/www.domoticz.com\/wiki\/PersistentUSBDevices\">https:\/\/www.domoticz.com\/wiki\/PersistentUSBDevices<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/easydomoticz.com\/mon-premier-peripherique-z-wave-2\/\">https:\/\/easydomoticz.com\/mon-premier-peripherique-z-wave-2\/<\/a><\/strong><\/li>\n<\/ul>\n\n\n<h3>\u00a0<\/h3>\n<h3>2nd part, version adapted to HAOS and therefore to Home Assistant<\/h3>\n<p><em>Updated on 30\/09\/2023<\/em><\/p>\n<p>Indeed, the explanation in Part 1 does not work on HAOS.<\/p>\n<p>It is therefore not necessary to seek to freeze the ports \/dev\/ttyUSB0 and \/dev\/ttyUSB1 but rather to address in the integrations to the right port (or shortcut).<\/p>\n<p>I have two equipments that have ports that are inverted:<\/p>\n<ul>\n<li>A Din module that brings me back to Linky's Teleinfo<\/li>\n<li>A USB\/RS485 flash drive that allows me to read RS485 port information in Modbus<\/li>\n<\/ul>\n<p>Thanks to the order<strong> ls \/dev\/serial\/by-id\/<\/strong><br \/>I get the list of my ports (we don\u2019t care what ttyUSBx they are on)<\/p>\n<p>In my case, it gives:<\/p>\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/698fcff9527412b1fa8e14d346f35ab15990391e.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5124\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/698fcff9527412b1fa8e14d346f35ab15990391e.png\" alt=\"\" width=\"987\" height=\"57\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/698fcff9527412b1fa8e14d346f35ab15990391e.png 987w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/698fcff9527412b1fa8e14d346f35ab15990391e-600x35.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/698fcff9527412b1fa8e14d346f35ab15990391e-300x17.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/698fcff9527412b1fa8e14d346f35ab15990391e-768x44.png 768w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/a><br \/>If out of curiosity, I want to know the affected ports, I can use the command <strong>ls \/dev\/serial\/by-id\/ -l<\/strong><br \/><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5125\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d.png\" alt=\"\" width=\"1073\" height=\"71\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d.png 1073w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-600x40.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-300x20.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-1024x68.png 1024w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-768x51.png 768w\" sizes=\"auto, (max-width: 1073px) 100vw, 1073px\" \/><\/a><br \/>It is ttyUSB0 and ttyUSB1 that change with the tide or the wind.<\/p>\n<p>On the Linky plugin (ICT link), I will therefore use this port name:<br \/>\/dev\/serial\/by-id\/usb-Cartelectronic _Interface_USB_1_TIC_DA1A8UN0-if00-port0<\/p>\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/f0d4be301916acc52e3832f538c85cee085a2c76.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5126\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/f0d4be301916acc52e3832f538c85cee085a2c76.png\" alt=\"\" width=\"563\" height=\"165\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/f0d4be301916acc52e3832f538c85cee085a2c76.png 563w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/f0d4be301916acc52e3832f538c85cee085a2c76-300x88.png 300w\" sizes=\"auto, (max-width: 563px) 100vw, 563px\" \/><\/a><\/p>\n<p>On the Modbus link (configured in yaml), I therefore use:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">name: modbus _hub type: serial #port: \/dev\/ttyUSB1 port: \/dev\/serial\/by-id\/usb-1a86_USB2.0-Ser_-if00-port0<\/pre>\n<ul>\n<li>Elements explained on <a href=\"https:\/\/forum.hacf.fr\/t\/figer-dev-ttyusb0-et-dev-ttyusb1\/28655\/2\" target=\"_blank\" rel=\"noopener\">the HA Forum<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Part 1, suitable for a standard Raspbian Os distribution On the same Jeedom, I have two devices that use USB ports: A CM11 that orders my X10 equipment (yes, I still have one) Aeon Labs zWave stick<\/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],"tags":[94],"class_list":["post-261","post","type-post","status-publish","format-standard","hentry","category-domotique","tag-raspberry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/261","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=261"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}