Skip to content

Instantly share code, notes, and snippets.

@bahamas10
Last active April 4, 2024 08:01
Show Gist options
  • Save bahamas10/dfac91f6a33c8e75d4b778cd1db89d87 to your computer and use it in GitHub Desktop.
Save bahamas10/dfac91f6a33c8e75d4b778cd1db89d87 to your computer and use it in GitHub Desktop.
Home Assistant on SmartOS LX Zone
{
"alias": "hass",
"brand": "lx",
"autoboot": true,
"quota": 20,
"delegate_dataset": true,
"kernel_version": "4.3.0",
"image_uuid": "7b5981c4-1889-11e7-b4c5-3f3bdfc9b88b",
"max_physical_memory": 1024,
"nics": [
{
"nic_tag": "admin",
"ip": "10.0.1.42",
"netmask": "255.255.255.0",
"gateway": "10.0.1.1",
"primary": true
}
],
"resolvers": [
"10.0.1.2",
"10.0.1.3"
]
}
# add device to zone
https://docs.oracle.com/cd/E19044-01/sol.containers/817-1592/z.conf.start-73/index.html
zonecfg -u <uuid>
> add device
> set match=/dev/cua/0
> end
> exit
# fix zwave thing
./simple--wave.d
test with:
echo -e -n "\x01\x08\x00\xF2\x51\x01\x00\x05\x01\x51" > /dev/cua/0
# bootstrap zone
apt-get update
apt-get upgrade -y
>>> idk if all of this is necessary
apt-get install -y build-essential
apt-get install -y git
apt-get install -y libyaml-0-2
apt-get install -y pkg-config
apt-get install -y libudev-dev
# install python3.6
add-apt-repository ppa:deadsnake/ppa
apt-get update
apt-get install -y python3-pip
apt-get install -y python3.6
apt-get install -y python3.6-venv
apt-get install -y python3.6-dev
# create user
# i don't think dialout is necessary cuz zone owns the device 0666
useradd -rm homeassistant -G dialout
# put data in right place
ln -s "/zones/$(zonename)/data" /data
# install hass
mkdir /data/homeassistant # where the source lives
mkdir /data/.homeassistant # where the config will live
ln -s /data/.homeassistant /home/homeassistant/.homeassistant
cd /data/homeassistant
sudo -Hsu homeassistant
python3.6 -m venv .
. bin/activate
python3.6 -m pip install --upgrade pip
python3.6 -m pip install wheel
python3.6 -m pip install homeassistant
# run hass
(in that dir as that user with the venv setup)
hass
(ctrl-d twice to get back to root)
#!/usr/sbin/dtrace -qs
usbsacm_ds_set_port_params:entry {
this->acmp = (usbsacm_state_t *)arg0;
this->acm_port = (usbsacm_port_t *)&this->acmp->acm_ports[arg1];
print(this->acm_port);
printf("acm_cap = %d\n", this->acm_port->acm_cap);
printf("run the following in mdb -kw if cap != 2: 0x%p/W 2\n",
&this->acm_port->acm_cap);
}
@sjorge
Copy link

sjorge commented Feb 7, 2019

[root@carbon ~]# ./simple-zwave.d
dtrace: failed to compile script ./simple-zwave.d: line 4: syntax error near ")"
[root@carbon ~]# cat simple-zwave.d
#!/usr/sbin/dtrace -qs

usbsacm_ds_set_port_params:entry {
   this->acmp = (usbsacm_state_t *)arg0;
   this->acm_port = (usbsacm_port_t *)&this->acmp->acm_ports[arg1];

   print(this->acm_port);
   printf("acm_cap = %d\n", this->acm_port->acm_cap);
   printf("run the following in mdb -kw if cap != 2: 0x%p/W 2\n",
       &this->acm_port->acm_cap);
}

I get an error on this though, I am running a debug kernel however.

@sjorge
Copy link

sjorge commented Feb 8, 2019

I get an error on this though, I am running a debug kernel however.

Same on a fresh non-DEBUG build

2019-02-08T20:09:42.117782+00:00 carbon usba: [ID 912658 kern.info] USB 2.0 interface (usbif658,200.config1.0) operating at full speed (USB 1.x) on USB 2.0 external hub: modem@0, usbsacm0 at bus address 3
2019-02-08T20:09:42.117825+00:00 carbon genunix: [ID 936769 kern.info] usbsacm0 is /pci@0,0/pci15d9,626@1d/hub@1/communications@1/modem@0

Would idicate the driver is attached right? ::prtusb does not seem to indicate there is though ?

@liv3010m
Copy link

Hi guys, I know this thread is quite old, and in some way I'm hijacking it but wanted to ask for help if you don't mind since documentation is quite sparse about this.
Did you get it to work?

Because I'm trying to pass thru a deCONZ ConBee II USB dongle from the global zone to an LX zone but the application on the LX zone didn't "see" it.

The strange thing is that after adding the "cua" device and issuing an vmadm get I get this:
...
"device": null,
"disks": [
{
"path": "/dev/cua/0",
"missing": true
}
...

Thanks in advance!

@liv3010m
Copy link

liv3010m commented Mar 16, 2020

OK, talked too soon!
Besides the firmware flasher app not seeing it, the main app does:

# deCONZ --dbg-info=1 --dbg-aps=1 --dbg-zcl=1 --dbg-zdp=1 --http-port=80 --dev=/dev/cua/0
QXcbConnection: Failed to initialize XRandr
Qt: XKEYBOARD extension not present on the X server.
Fontconfig warning: ignoring UTF-8: not a valid region tag
22:27:17:592 HTTP Server listen on address 0.0.0.0, port: 80, root: /usr/share/deCONZ/webapp/
22:27:17:593 CTRL. 3.11.022:27:17:615 COM: --dev: /dev/cua/0 (RaspBee)
22:27:17:615 ZCLDB init file /root/.local/share/dresden-elektronik/deCONZ/zcldb.txt
22:27:17:691 parent process -bash
22:27:17:691 gw run mode: normal
...

It was detected as another device (RaspBee) instead of Conbee II, but thereafter I created a symbolic link to the name that it should expect (ttyACM0) and it was detected correctly.

# deCONZ --dbg-info=1 --dbg-aps=1 --dbg-zcl=1 --dbg-zdp=1 --http-port=80 --dev=/dev/ttyACM0
QXcbConnection: Failed to initialize XRandr
Qt: XKEYBOARD extension not present on the X server.
Fontconfig warning: ignoring UTF-8: not a valid region tag
23:35:09:812 HTTP Server listen on address 0.0.0.0, port: 80, root: /usr/share/deCONZ/webapp/
23:35:09:814 CTRL. 3.11.023:35:09:832 COM: --dev: /dev/ttyACM0 (ConBee II)
...

:)
Olivia

@blackwood821
Copy link

blackwood821 commented May 17, 2020

This worked great with the Aeotec Z-Stick Gen5 (https://www.amazon.com/gp/product/B00X0AWA6E/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1) for Z-Wave only but I just swapped that stick out for the HUSBZB-1 USB (https://www.amazon.com/gp/product/B01GJ826F8/ref=ppx_yo_dt_b_asin_title_o08_s00?ie=UTF8&psc=1) since it supports both Z-Wave and Zigbee which I need. On the Z-Wave stick it was /dev/cua/0 as shown in this post but the new stick is supposed to show up as two different serial ports but I don't see any /dev/ttyUSB* serial ports:

[root@headnode (neptune) ~]# find /dev/cua* /dev/tty* -mtime -1 -ls
2621383827    1 drwxr-xr-x   3 root     root          512 May 17 20:59 /dev/cua
2621383793    1 lrwxrwxrwx   1 root     root           43 May 17 20:59 /dev/cua/a -> ../../devices/pci@0,0/isa@1f/asy@1,3f8:a,cu
2621383861    1 lrwxrwxrwx   1 root     root           40 May 17 20:59 /dev/cua0 -> ../devices/pci@0,0/isa@1f/asy@1,3f8:a,cu
2621383997    1 lrwxrwxrwx   1 root     root           37 May 17 20:59 /dev/tty00 -> ../devices/pci@0,0/isa@1f/asy@1,3f8:a
2621384031    1 lrwxrwxrwx   1 root     root           37 May 17 20:59 /dev/ttya -> ../devices/pci@0,0/isa@1f/asy@1,3f8:a
2621383895    1 lrwxrwxrwx   1 root     root           40 May 17 20:59 /dev/ttyd0 -> ../devices/pci@0,0/isa@1f/asy@1,3f8:a,cu

When I run simple-zwave.d I get this error:

[root@headnode (neptune) /opt]# ./simple-zwave.d 
dtrace: failed to compile script ./simple-zwave.d: line 4: syntax error near ")"

Here is a link to the details about the USB stick: https://www.nortekcontrol.com/pdf/manuals/husbzb-1-instructions.pdf

Any help is much appreciated. Thanks.

@blackwood821
Copy link

blackwood821 commented May 17, 2020

I noticed that /dev/usb/device0 is present when the USB is in but when I pass that device through to the LX Ubuntu zone ZHA in Home Assistant doesn't recognize it. It should be presented as two different serial ports so I wouldn't expect /dev/usb/device0 to work anyway.

@blackwood821
Copy link

I see this in dmesg:

2020-05-17T22:57:09.759385+00:00 headnode usba: [ID 349649 kern.info] usba:#011no driver found for interface 1 (nodename: 'interface') of Silicon Labs HubZ Smart Home Controller 81300CC8

Anyone know where I can get the driver for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment