diff --git a/README.md b/README.md index f64f786..7b82915 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,49 @@ # Hass.io Add-on: qsusb + Qwikswitch QSUSB hub support for Hass.io -### About -This add-on allows for support for the Qwikswitch (https://qwikswitch.co.za/) QSUSB modem device in Hass.io. +## About + +This add-on allows for support for the [Qwikswitch](https://qwikswitch.co.za/) QSUSB modem device in Hass.io. The add-on will communicate via USB port to QSUSB modem that communicates via RF to the Qwikswitch range of products (dimmers, relays). -The qwikswitch component (https://www.home-assistant.io/components/qwikswitch/) will provide support within Home-assistant. Tested on Hass.io version 0.75 and above on HassOS (1.9) on Raspberry Pi 2. +The [qwikswitch component](https://www.home-assistant.io/components/qwikswitch/) will provide support within Home-assistant. Tested on Hass.io version 0.75 and above on HassOS (1.9) on Raspberry Pi 2. -### Installation -1. Currently the addon should be added as local build. Follow step 1 and step 2 of `https://developers.home-assistant.io/docs/en/hassio_addon_tutorial.html` -2. Install the QSUSB add-on -3. Configure the Qwikswitch devices in the Config section. +## Installation +1. Currently the addon should be added as local build. Follow step 1 and step 2 of [Local add-on testing](https://developers.home-assistant.io/docs/add-ons/testing) +2. Install the QSUSB add-on +3. Configure the Qwikswitch devices in the Config section. -### Usage +## Usage Start the add-on. The Qwikswitch QS Mobile application will be hosted by default on port 2020 of Hassos. It is not necessary to use the QS Mobile application since Qwikswitch devices are defined already in the config section. -Add the Qwikswitch section as per the Qwikswitch component (https://www.home-assistant.io/components/qwikswitch/) +Add the Qwikswitch section as per the [Qwikswitch component](https://www.home-assistant.io/components/qwikswitch/) -### Configuration +## Configuration The port can be changed from the default value of 2020. Add the devices in the config section of Hass.io add-on. Example Configuration: -```json -{ - "devices": [ - { - "string": "@129b70/rel/Study lamp" - }, - { - "string": "@16aa30/rel/Kitchen lamp" - } - ] -} + +```yaml +port: '2020' +devices: + - string: '@129b70/rel/Study lamp' + - string: '@16aa30/rel/Kitchen lamp' ``` + Each device string is divided into 3 parts separated with a forward-slash (/), the first part is the QS device ID/device type/name of device. The following device types are applicable: - - rel - Relay - - dim - Dimmer - - art - SwitchArt - - tmp - Temperature Sensor - - hum - Humidity Sensor - - gey - Geyser - - bli - Motor/Controller +- rel - Relay +- dim - Dimmer +- art - SwitchArt +- tmp - Temperature Sensor +- hum - Humidity Sensor +- gey - Geyser +- bli - Motor/Controller The entries above will be written to the devices file that are used by the QSUSB software to make devices persistent across upgrades and restarts. diff --git a/build.json b/build.json deleted file mode 100644 index 691f0c3..0000000 --- a/build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "build_from": { - "aarch64": "hassioaddons/ubuntu-base-aarch64:3.0.0", - "amd64": "hassioaddons/ubuntu-base-amd64:3.0.0", - "armhf": "hassioaddons/ubuntu-base-armhf:3.0.0", - "armv7": "hassioaddons/ubuntu-base-armv7:3.0.0", - "i386": "hassioaddons/ubuntu-base-i386:3.0.0" - }, - "args": {} -} \ No newline at end of file diff --git a/Dockerfile b/qsusb/Dockerfile similarity index 70% rename from Dockerfile rename to qsusb/Dockerfile index 097f707..8699b3e 100644 --- a/Dockerfile +++ b/qsusb/Dockerfile @@ -1,58 +1,58 @@ -ARG BUILD_FROM=hassioaddons/ubuntu-base:3.0.0 +ARG BUILD_FROM=hassioaddons/ubuntu-base:5.2.1 # hadolint ignore=DL3006 FROM ${BUILD_FROM} # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] -# Setup base -ARG BUILD_ARCH=amd64 +# Setup base system +RUN \ + apt-get update \ + \ + && apt-get install -y --no-install-recommends \ + jq libusb-1.0 wget unzip \ + \ + && rm -fr \ + /tmp/* \ + /var/{cache,log}/* \ + /var/lib/apt/lists/* + +# Copy run.sh script which is used to run qsusb WORKDIR /qsusb +COPY run.sh . -# Install requirements for add-on +# Install qsusb RUN \ FILE="qsusb_pi_V1.91.zip" \ - && if [ "${BUILD_ARCH}" = "armhf" ] \ - || [ "${BUILD_ARCH}" = "armv7" ] \ - || [ "${BUILD_ARCH}" = "aarch64" ]; then \ - FILE="qsusb_pi_V1.91.zip"; \ - fi \ && if [ "${BUILD_ARCH}" = "i386" ] \ || [ "${BUILD_ARCH}" = "amd64" ]; then \ FILE="QSUSB_linux.zip"; \ fi \ - && apt-get update \ - \ - && apt-get install -y --no-install-recommends \ - libusb-1.0 \ - unzip \ - wget \ - jq \ \ && wget https://cdn.shopify.com/s/files/1/1883/0535/files/${FILE} \ \ - && unzip ${FILE} - -# Copy run.sh script which is used to run qsusb -COPY run.sh / + && unzip ${FILE} \ + \ + && rm ${FILE} # Copy v1.65 of the www directory. Qwikswitch was contacted to request them to upgrade the Pi and Linux zip files -# with the same version of the www directory as found in the Windows version. Due to delays on their side, we are +# with the same version of the www directory as found in the Windows version. Due to delays on their side, we are # budling and deploying this with the add-on. This will be removed once they have updated their zip files. # The latest version of the www pages allows relays to be put into link mode via the web interface. -COPY www.zip / - +COPY www.zip . RUN \ - chmod a+x /run.sh \ + chmod a+x run.sh \ \ - && rm -rf /qsusb/QSUSB/www \ + && rm -rf QSUSB/www \ \ - && unzip /www.zip -d /qsusb/QSUSB/ + && unzip www.zip -d QSUSB/ \ + \ + && rm www.zip -CMD [ "/run.sh" ] +CMD [ "run.sh" ] -# Build arugments -ARG BUILD_ARCH +# Build arguments +ARG BUILD_ARCH=amd64 ARG BUILD_DATE ARG BUILD_REF ARG BUILD_VERSION @@ -73,4 +73,4 @@ LABEL \ #org.label-schema.usage="" \ org.label-schema.vcs-ref=${BUILD_REF} \ #org.label-schema.vcs-url="" \ - org.label-schema.vendor="QwikSwitch" + org.label-schema.vendor="QwikSwitch" \ No newline at end of file diff --git a/qsusb/build.json b/qsusb/build.json new file mode 100644 index 0000000..b7d5e7b --- /dev/null +++ b/qsusb/build.json @@ -0,0 +1,10 @@ +{ + "build_from": { + "aarch64": "hassioaddons/ubuntu-base-aarch64:5.2.1", + "amd64": "hassioaddons/ubuntu-base-amd64:5.2.1", + "armhf": "hassioaddons/ubuntu-base-armhf:5.2.1", + "armv7": "hassioaddons/ubuntu-base-armv7:5.2.1", + "i386": "hassioaddons/ubuntu-base-i386:5.2.1" + }, + "args": {} +} \ No newline at end of file diff --git a/config.json b/qsusb/config.json similarity index 69% rename from config.json rename to qsusb/config.json index 28a1d49..459dcd6 100644 --- a/config.json +++ b/qsusb/config.json @@ -1,15 +1,15 @@ { "name": "QwikSwitch USB Hub", - "slug": "qsusb", + "slug": "qsusb", "description": "Add-on for the QwikSwitch USB Hub", - "version": "0.9", - "startup": "before", - "boot": "auto", - "url": "http://www.qwikswitch.co.za", + "version": "0.91", + "startup": "before", + "boot": "auto", + "url": "https://github.com/nardusleroux/hassio-qsusb", "webui": "http://[HOST]:[PORT:2020]", "devices": [ "/dev/bus/usb:/dev/bus/usb:rwm" - ], + ], "arch": [ "aarch64", "amd64", @@ -17,6 +17,12 @@ "armv7", "i386" ], + "ports": { + "2020/tcp": 2020 + }, + "ports_description": { + "2020/tcp": "QS USB Web UI" + }, "hassio_role": "default", "host_network": true, "options": { diff --git a/icon.png b/qsusb/icon.png similarity index 100% rename from icon.png rename to qsusb/icon.png diff --git a/logo.png b/qsusb/logo.png similarity index 100% rename from logo.png rename to qsusb/logo.png diff --git a/run.sh b/qsusb/run.sh similarity index 100% rename from run.sh rename to qsusb/run.sh diff --git a/www.zip b/qsusb/www.zip similarity index 100% rename from www.zip rename to qsusb/www.zip diff --git a/repository.json b/repository.json new file mode 100644 index 0000000..8a713df --- /dev/null +++ b/repository.json @@ -0,0 +1,4 @@ +{ + "name": "Qwikswitch QSUSB hub", + "url": "https://github.com/nardusleroux/hassio-qsusb", +} \ No newline at end of file