I have installed HomeAssistant on my NUC, the mini PC has four USB Ports and I want to send Modbus Protocol through them, but I don’t know how to set them up to work properly. Does anyone know how to set them up to make them work please? Any help would be appreciated!
It looks like your adaptor is plugged into ttyUSB0
. So that is what you would use in your configuration.
Thank you very much for your reply. Yes, you are correct, when I plugged the usb–>modbus module into my adapter, the ttyUSB0 option came up. The picture below shows my settings, but so far it doesn’t work. Can you please guide me on what to do? Thanks again!
Another question, if I use ttyUSB0 to transfer data, how do I set up the input and output inside Node-Red, I’m a newbie and would appreciate your help, thank you!
The serial platform is a sensor platform, i.e. receive only.
You need to configure this for modbus: https://www.home-assistant.io/integrations/modbus/#configuring-serial-connection
I don’t use Node Red so can’t help there sorry.
Ok, you’ve got me on the right track, I’m going to try a few more times, thank you again!
TOM, sorry, I need to ask you again, how can I bind or fix the ttyUSB0, ttyUSB1, ttyUSB2 and ttyUSB3 ports? Any one of the four USB ports I plug in will be recognised as ttyUSB0. I don’t have any more devices to test with at the moment.
The first device seen by the kernel will be /dev/ttyUSB0, no matter where you plug it in.
Are you planning to use other USB devices?
nickrout, thank you very much for your reply. Yes, I would like to be able to use all four ports for controlling some AV devices. When I first plug in the four devices, the system should recognise them in the order of ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3. However, suppose I unplug the four devices and then re-plug the ports in a different order than before, does this mean that the control ports for the devices will all have to be modified again? This should not be very convenient. So I thought I could just start by fixing the order of the four ports? Of course, the above is just hypothetical as I don’t have that many devices to test at the moment, which I will have tomorrow. Thanks again for the reply!
You are right, if you plug them in a different order, they will get different device names. Plus if they are plugged in at bootup they will probably get random device names.
The solution is to look in /dev/serial/by-id directory and use the unique name for your device. See here (although this relates to serial zigbee devices, the principle is the same) Zigbee Home Automation - Home Assistant. You have sto scroll down a bit so I’ll reproduce it here
Most devices need at the very least the serial device path, like
/dev/ttyUSB0
, but it is recommended to use device path from/dev/serial/by-id
folder, e.g.,/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_C0F003D3-if01-port0
A list of available device paths can be found in Supervisor > System > Host System > dot menu > Hardware .
nickrout, thank you very much for your help, you have taught me a lot. I am new to homeassistant, I have just come across it not long ago and my English is not very good. This forum is very friendly and the prompt help I received from everyone with a question let me know immediately what the problem was.