Skip to content

Commit b04365d

Browse files
authored
Merge pull request #177 from sincze/main
Remote Documentation Updated
2 parents 17e2ad7 + e1872e3 commit b04365d

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

README.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ This integration has been tested with JA-80K /JA-82K central units, JA-81F keypa
3939
Tested sensors include wired/wireless PIRs & door sensors and wired/wireless fire alarms.
4040
4141
## Remote Support
42-
The JA-80T serial cable setup can work with remote serial devices using a device address of 'socket://[ipaddress:socket]' (e.g. socket://192.168.0.1:23) , see section at bottom of page for more details. This can be made to work even without a JA-80T serial cable (as these are hard to source)
42+
The JA-80T serial cable setup can work with remote serial devices using a device address of 'socket://[ipaddress:socket]' (e.g. socket://192.168.0.1:23) , see section at bottom of page for more details. This can be made to work even without a JA-80T serial cable (as these are hard to source).
43+
It does also work with a tool called usbipd, 'duplicating' the /dev/hidraw0 device from a server connected to the jablotron alarm to the homeassistant client machine.
4344
4445
## Examples & configuration
4546
@@ -290,6 +291,101 @@ Serial Port to be setup as `9600 baud, 8 bit, no partity, 1 stop bit`. Must be s
290291
Additional expected similar solutions could be constructed from USR-TCP232-306, USR-TCP232-304 connected directly to the control panel or
291292
USR-TCP232-302 conected to an existing JA-80T serial cable.
292293
294+
Another solution for remote usage could be via the use of a tool called ```usbip``` that needs to be installed on the server **(jablotron alarm side)** and the client **(homeassistant running this repo.)**
295+
296+
First using the following command ```dmesg | grep hid``` on the **server** to check if (in this case JA-82T) is visible:
297+
```
298+
[8740307.349070] hid-generic 0003:16D6:0007.0002: hiddev96,hidraw0: USB HID v1.11 Device [JABLOTRON ALARMS JA-82T PC Interface] on usb-0000:01:00.0-1.3/input0
299+
```
300+
Now we know the device we are looking for is hidraw0 and the ID **16D6:0007**, by the way the ID can also be optained if the command ```lsusb``` is executed
301+
```
302+
Bus 001 Device 013: ID 16d6:0007 JABLOCOM s.r.o. JA-82T PC Interface
303+
```
304+
305+
As stated installation of usbip needs to be done on the **Server** and **CLient**
306+
307+
Server:
308+
```
309+
sudo apt install usbip hwdata usbutils
310+
modprobe usbip_host
311+
echo 'usbip_host' >> /etc/modules
312+
313+
# Create a systemd service
314+
nano /lib/systemd/system/usbipd.service
315+
```
316+
317+
The file usbipd.service should contain.
318+
```
319+
[Unit]
320+
Description=usbip host daemon
321+
After=network.target
322+
323+
[Service]
324+
Type=forking
325+
ExecStart=/usr/sbin/usbipd -D
326+
ExecStartPost=/bin/sh -c "/usr/sbin/usbip bind --$(/usr/sbin/usbip list -p -l | grep '#usbid=16d6:0007#' | cut '-d#' -f1)"
327+
ExecStop=/bin/sh -c "/usr/sbin/usbip unbind --$(/usr/sbin/usbip list -p -l | grep '#usbid=16d6:0007#' | cut '-d#' -f1); killall usbipd"
328+
329+
[Install]
330+
WantedBy=multi-user.target
331+
332+
```
333+
Only change the #usbid=16d6:0007# if necessary.
334+
Save the file and execute:
335+
```
336+
# reload systemd, enable, then start the service
337+
sudo systemctl --system daemon-reload
338+
sudo systemctl enable usbipd.service
339+
sudo systemctl start usbipd.service
340+
```
341+
The server setup is now complete, move over to the client
342+
343+
Client:
344+
```
345+
sudo apt install usbip hwdata usbutils
346+
modprobe vhci-hcd
347+
echo 'vhci-hcd' >> /etc/modules
348+
349+
# Create a systemd service
350+
nano /lib/systemd/system/usbip.service
351+
```
352+
353+
Much like we did on the server, we’re going to need to modify the ExecStart and ExecStop lines below to search for the correct USB device ID that’s being presented by your USB/IP server. Likewise, change the IP 192.168.0.10 to match your server.
354+
```
355+
[Unit]
356+
Description=usbip client
357+
After=network.target
358+
359+
[Service]
360+
Type=oneshot
361+
RemainAfterExit=yes
362+
ExecStart=/bin/sh -c "/usr/sbin/usbip attach -r 192.168.0.10 -b $(/usr/sbin/usbip list -r 192.168.0.10 | grep '16d6:0007' | cut -d: -f1)"
363+
ExecStop=/bin/sh -c "/usr/sbin/usbip detach --port=$(/usr/sbin/usbip port | grep '<Port in Use>' | sed -E 's/^Port ([0-9][0-9]).*/\1/')"
364+
365+
[Install]
366+
WantedBy=multi-user.target
367+
```
368+
369+
Save that file, then run the following commands in your shell:
370+
371+
```
372+
# reload systemd, enable, then start the service
373+
sudo systemctl --system daemon-reload
374+
sudo systemctl enable usbip.service
375+
sudo systemctl start usbip.service
376+
```
377+
378+
You should now be able to access the USB device on the client as if the device was plugged in locally, ```(ls -l /dev/hidraw0)``` and you have an auto-starting systemd service to control things.)
379+
380+
Thanks to [derushadigital.com](https://derushadigital.com/other%20projects/2019/02/19/RPi-USBIP-ZWave.html)
381+
382+
For Docker users we need to add the following to the docker_compose file to enable homeassistant to use this device:
383+
384+
devices:
385+
- /dev/hidraw0
386+
387+
Restart your homeassistant docker and you are able to complete the repo configuration from within homeassistant using the virtual /dev/hidraw0.
388+
293389
## Troubleshooting
294390
295391
Additional logging can be enabled in configuration.yaml

0 commit comments

Comments
 (0)