Home Assistant Supervised (previously known as Hass.io) on Synology DSM as native package (not supported or working atm)

I think there is other errors…

This should work:

#!/bin/bash

fix_usb_devices () {
    RULES_FILE="/lib/udev/rules.d/59-usb-serial.rules"

    for tty_path in $(find /sys/bus/usb/devices/usb*/ -name tty); do
        tty_iface_path=`dirname $tty_path`
        serial_device_path=`dirname $tty_iface_path`
        prefix=usb
        if test -f "$serial_device_path/idVendor"; then
            bInterfaceNumber=`cat $tty_iface_path/bInterfaceNumber`
        else
            bInterfaceNumber=`cat $serial_device_path/bInterfaceNumber`
            # We need to go up 1 level to get information
            serial_device_path=`dirname $serial_device_path`
            manufacturer=`cat $serial_device_path/manufacturer`
        fi
        idVendor=`cat $serial_device_path/idVendor`
        product=`cat $serial_device_path/product`
        idProduct=`cat $serial_device_path/idProduct`
        serial=`cat $serial_device_path/serial`

        if  [ ! -z "$manufacturer" ]; then
                symLink="${prefix}-${manufacturer}\_${product}\_${serial}-if${bInterfaceNumber}-port0"
                echo $SUBSYSTEM
        else 
                symLink="${prefix}-${idVendor}\_${product}\_${serial}-if${bInterfaceNumber}"
        fi
        line="SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"${idVendor}\", ATTRS{idProduct}==\"${idProduct}\", SYMLINK+=\"serial/by-id/${symLink}\""
        echo $line
        
        grep -s $symLink $RULES_FILE >/dev/null || \
            echo ${line} >> $RULES_FILE
    done

    udevadm control --reload
}

fix_usb_devices

symLink is not the same if the manufacturer is set.

Is it possible @fredrike to also print out a message when people will install the package ?
They need to use /dev/serial/by-id/XXXXXXX and not /dev/XXXX in there configuration.yaml file.

/dev/XXXX has changed with all the test that I have done which is normal. /dev/serial/by-id/… will never changed as it is linked to the hardware device.

1 Like

Yes I could show a dialog after the location…

Edit:

Perhaps will it be better to create a text file in the config directory with the identified devices…

I agree.

I was wondering when someone is installing a new USB device after the sync package is installed. Maybe you should provide also (with the package) a script to create the udev rules file, no ?

The idea is to run our script at package start so adding new USB devices requires a restart of the hassio package using the Synology package manager. Will add a note for this in the package description.

But please confirm that the current script works.

Sounds perfect

I have done a couple tests:

  • restart of the script does not affect the previous.
  • remove a line and restart the script. The new line is added.
  • a diff with my previous show the same result.

But you have to change udevadm control --reload-rules by udevadm control --reload-rules && udevadm trigger. Without the trigger, /dev/serial/by-id was not updated. Now it is perfect :wink:

Shame on me… I have forgotten that I have also modified some line as well in your script.
Here is the part that I have modified (removed some \ in the symLink variable).

        if  [ ! -z "$manufacturer" ]; then
                symLink="${prefix}-${manufacturer}_${product}_${serial}-if${bInterfaceNumber}-port0"
                echo $SUBSYSTEM
        else
                symLink="${prefix}-${idVendor}_${product}_${serial}-if${bInterfaceNumber}"

Sorry

I have a new version that supposedly takes care of the USB issues.

It is being tested by @laurentdb and I expect that we could publish the new version during the weekend.

4 Likes

Great work!! If you need another tester, let me know!

Maybe I’ve missed that, but where do new versions being released. Does the package center get an notification or do you publish in this thread as in the initial post?

BTW, awesome work :slight_smile:

Thanks!

There is only one version that is public. I have a development version but there are some issues with upgrading and uninstall /new install so I will wait with publishing it so it doesn’t break things for you.

I will announce the new version once it is done. But home-assistant and hassio have their own updates so the updated Synology package will mostly fix the USB-devices that have been discussed the last week.

2 Likes

Cool, thanks. Will wait for your fix before I mess up my current config with Docker and other items. Will need some time to cleanup old stuff and prepare for the newest version of HASS

I have a prerelease that I need some help with testing.

Be aware that if you are already running the previous version there might be issues with getting the new version to start and upgrading (that is why I need some brave testers). To be on the safe side make a copy of your entire hass.io folder before attempting to upgrade. If upgrade does not work uninstall and reinstall the new package (the data in your hass.io folder should be protected).

The new version have support for a more persistent config file (the file where the storage location is) and probably more important support for USB-devices rules.

note, this is a testing release, if you have a stable running version that is life supporting I highly discourage you to touch this upgrade

1 Like

I get this error once installed

Unable to load the panel source: /api/hassio/app/entrypoint.js.

I have rebooted the NAS and restarted the docker containers without luck

I noticed others report this problem but never saw a fix

Try restarting the package sometimes it helps. The entrypoint.js issue is a bit magical…

Thank you so much for creating this package! I’m still having USB device errors with this version when I try to start addons though:

19-08-07 02:16:37 ERROR (SyncWorker_19) [hassio.docker] Can't start addon_a0d7b954_vscode: 404 Client Error: Not Found ("linux runtime spec devices: error gathering device information while adding custom device "/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_90F00094-if00-port0": lstat /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_90F00094-if00-port0: no such file or directory")

Here’s what my usb_devices.txt file looks like:

/dev/serial/by-id/usb-Silicon Labs_HubZ Smart Home Controller_90F00094-if00-port0
/dev/serial/by-id/usb-Silicon Labs_HubZ Smart Home Controller_90F00094-if01-port0

I’ve restarted the package a couple times to no avail. Any clue what the issue might be? I wonder if it has something to do with the fact that the error message has underscores in the device name, but the txt file does not?

I’m completely new to docker in general so forgive me if this is obvious. I have HASS.IO running on a PI and thought I could free up that PI by running this on my Synology since it’s sitting there running anyway.

I added Docker to my Synology tonight for this package, to add the spk I click on the image tab, and click the add button at the top. Navigate to where I have the file downloaded and select the file. Once I do that I receive the following error:

I’m running a DS1512+ with DSM 6.2.2-24922 Update 2, docker freshly installed so I assume the latest.

Any suggestions for a noob? Even if it’s just some better keywords then Synology docker hassio to google.

you need to run the spk file in the native synology package centre (manula install) (NOT DOCKER) it will then create the docker containers for you automatically

1 Like

Thank you, been a very long time since I’ve had to touch the Synology. Worked perfectly, HASS.IO is initializing now.

1 Like

The installation of the * .spk file worked great. Hass.io 0.97.0 works without problems so far. However, if I click on “Hass.io” in the sidebar, the menu will not open. So an installation of plugins etc. is not possible.
Is this not currently planned or is something wrong with me?

Hello, I have the exact same problem. Hassio panel not loading.

Edit: I was able to get everything working out upgrading to the 20190805 package :grinning:, but right now I can’t seem to start the Nginx proxy manager add-on.

Huge thanks to @fredrike! :heart: