Skip to content

Commit

Permalink
Merge pull request #6 from kellerza/master
Browse files Browse the repository at this point in the history
Repo conversion try 1
  • Loading branch information
nardusleroux authored Jul 14, 2020
2 parents ebde6eb + acc1c75 commit fb1b060
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 74 deletions.
54 changes: 26 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 0 additions & 10 deletions build.json

This file was deleted.

60 changes: 30 additions & 30 deletions Dockerfile → qsusb/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
10 changes: 10 additions & 0 deletions qsusb/build.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
18 changes: 12 additions & 6 deletions config.json → qsusb/config.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
{
"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",
"armhf",
"armv7",
"i386"
],
"ports": {
"2020/tcp": 2020
},
"ports_description": {
"2020/tcp": "QS USB Web UI"
},
"hassio_role": "default",
"host_network": true,
"options": {
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions repository.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Qwikswitch QSUSB hub",
"url": "https://github.com/nardusleroux/hassio-qsusb",
}

0 comments on commit fb1b060

Please sign in to comment.