Skip to content

Commit 034a17f

Browse files
committed
Releasing version 1.0.3
Significant upgrades 1. Overlapping MQTT wildcard subscription enabled 2. Change location of config files for docker implementation 3. Providing docker images for Alpine and RPI platform
1 parent 3b7fb1b commit 034a17f

8 files changed

+292
-114
lines changed

.dockerignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
node_modules
2+
bin
3+
config
4+
devicetypes
5+
helpers
6+
smartapps
7+
windows service
8+
test
9+
.jscsrc
10+
.git
11+
.gitignore
12+
*.log
13+
Dockerfile*
14+
docker-compose*
15+
*.md
16+
LICENSE
17+
.vscode

DOCKER.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Docker Setup
2+
# On Windows - using Docker Desktop
3+
4+
Windows Defender Firewall with Advanced Security, the following rule needs to be created:
5+
6+
Type: Inbound
7+
Program: C:\Program Files\Docker\Docker\resources\com.docker.backend.exe
8+
Allow all connections
9+
10+
Volume mapping
11+
```-
12+
make sure the directory that you are going to map to /mbs/config in docker has the appropriate config.yml and devices.yml
13+
For e.g. for "d:/data/docker/volumes/mbs:/mbs/config" the files need to be in d:/data/docker/volumes/mbs
14+
```
15+
for alpine distro
16+
```
17+
docker pull mbs-alpine sgupta99/mqtt-bridge-smartthings:1.0.3-alpine
18+
docker run -p:8080:8080 -v d:/data/docker/volumes/mbs:/mbs/config -e TZ=America/Chicago --name mbs-alpine sgupta99/mqtt-bridge-smartthings:1.0.3-alpine
19+
```
20+
for raspberry pi distro
21+
```
22+
docker pull mbs-alpine sgupta99/mqtt-bridge-smartthings:1.0.3-rpi
23+
docker run -p:8080:8080 -v d:/data/docker/volumes/mbs:/mbs/config -e TZ=America/Chicago --name mbs-rpi sgupta99/mqtt-bridge-smartthings:1.0.3-rpi
24+
```
25+
The RPI distro is about 768MB and Alpine is about 136MB - so if running on windows I would go for the alpine distro
26+
# Some helpful commands for widows users not familiar with docker
27+
```
28+
docker image ls
29+
docker image rm -f <image-id>
30+
docker container ls -a
31+
docker container stop <container-name>
32+
docker container start -i <container-name> (starts in interactive mode
33+
docker container rm <container-name>
34+
Examples
35+
docker stop mbs-alpine
36+
docker start -i mbs-alpine
37+
```
38+
Container names in the above examples are mbs-alpine and mbs-rpi for example
39+
40+
41+
# On linux platforms - (I have not tested then but should work)
42+
43+
make sure linux firewall rules are set appropriately
44+
45+
Volume mapping -
46+
```
47+
make sure the directory that you are going to map to /mbs/config in docker has the appropriate config.yml and devices.yml
48+
For e.g. for "/home/pi/docker/volumes/mbs:/mbs/config" the files need to be in /home/pi/docker/volumes/mbs
49+
```
50+
for alpine distro
51+
```
52+
docker pull mbs-alpine sgupta99/mqtt-bridge-smartthings:1.0.3-alpine
53+
docker run -p:8080:8080 \
54+
-v /home/pi/docker/volumes/mbs:/mbs/config \
55+
-e TZ=America/Chicago \
56+
--name mbs-alpine \
57+
sgupta99/mqtt-bridge-smartthings:1.0.3-alpine
58+
```
59+
for raspberry pi distro
60+
```
61+
docker pull mbs-alpine sgupta99/mqtt-bridge-smartthings:1.0.3-rpi
62+
docker run -p:8080:8080 \
63+
-v /home/pi/docker/volumes/mbs:/mbs/config \
64+
-e TZ=America/Chicago \
65+
--name mbs-rpi
66+
sgupta99/mqtt-bridge-smartthings:1.0.3-rpi
67+
```
68+
The RPI distro is about 768MB and Alpine is about 136MB - so I would still go for the alpine distro

Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:alpine
2+
MAINTAINER Sandeep Gupta <[email protected]>
3+
4+
# Create our application direcory
5+
RUN mkdir -p /usr/src/app
6+
WORKDIR /usr/src/app
7+
8+
# Expose Configuration Volume
9+
VOLUME /mbs/config
10+
11+
# Copy and install dependencies
12+
COPY package.json /usr/src/app/
13+
COPY *.yml /mbs/config/
14+
RUN npm install --production
15+
16+
# Copy everything else
17+
COPY . /usr/src/app
18+
19+
# Set config directory
20+
ENV CONFIG_DIR=/mbs/config
21+
22+
# Expose the web service port
23+
EXPOSE 8080
24+
25+
# Run the service
26+
CMD [ "npm", "start" ]

Dockerfile-rpi

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM arm32v7/node:10
2+
MAINTAINER Sandeep Gupta <[email protected]>
3+
4+
# Create our application direcory
5+
RUN mkdir -p /usr/src/app
6+
WORKDIR /usr/src/app
7+
8+
# Expose Configuration Volume
9+
VOLUME /mbs/config
10+
11+
# Copy and install dependencies
12+
COPY package.json /usr/src/app/
13+
COPY *.yml /mbs/config/
14+
RUN npm install --production
15+
16+
# Copy everything else
17+
COPY . /usr/src/app
18+
19+
# Set config directory
20+
ENV CONFIG_DIR=/mbs/config
21+
22+
# Expose the web service port
23+
EXPOSE 8080
24+
25+
# Run the service
26+
CMD [ "npm", "start" ]
27+

Dockerfile.alpine

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:alpine
2+
MAINTAINER Sandeep Gupta <[email protected]>
3+
4+
# Create our application direcory
5+
RUN mkdir -p /usr/src/app
6+
WORKDIR /usr/src/app
7+
8+
# Expose Configuration Volume
9+
VOLUME /mbs/config
10+
11+
# Copy and install dependencies
12+
COPY package.json /usr/src/app/
13+
COPY *.yml /mbs/config/
14+
RUN npm install --production
15+
16+
# Copy everything else
17+
COPY . /usr/src/app
18+
19+
# Set config directory
20+
ENV CONFIG_DIR=/mbs/config
21+
22+
# Expose the web service port
23+
EXPOSE 8080
24+
25+
# Run the service
26+
CMD [ "npm", "start" ]

README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The new server should be fully backward compatible. If you have been using the o
1818
1. An external devices YAML config file has been introduced. It allows to define any custom mapping between and smartthings [device][attribute][command] and MQTT [topic][payload] and vice-versa.
1919
2. A device can subscribe and publish to any number of topics
2020
3. MQTT wildcards can be used in subscribe topics
21-
4. Within smartthings. smartapp and device handlers have a generic processMQTT method to process subscription messages. Smartthings attribute 'events' are use to pubish messages to MQTT broker
21+
4. Within smartthings. smartapp and device handlers have a generic processMQTT method to process subscription messages. Smartthings attribute 'events' are use to publish messages to MQTT broker
2222
5. The logging and configurations have beem significantly streamlined. 'Log' and 'Data' directories store logs and state information
2323
6. All dependencies have been updated to the latest versions.
2424
7. The use case tested was for primarily Tasmota devices. I have a lite and full version of the SmartApp and sample tasmota Device Type Handlers. Use the 'lite' version if you are primary interested in configuring devices using the external device config file and primarily using Tasmota device handlers provided with this package.
@@ -42,7 +42,7 @@ The MBS-SmartApp controls the mappings between the Devices and the Server config
4242

4343
# Configuration
4444

45-
The bridge has two yaml files for configuration:
45+
The bridge has two yaml files for configuration. The config files need to be stored in the config directory. You can specify a CONFIG_DIR environment variable to specify where the config directory or it will default to locating the config directory in the same folder where mbs-server. This is a change form vesions 1.02 and earlier where confif files were not in a separate sub-directory
4646

4747
[config.yml](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/config.yml)
4848
==========
@@ -137,6 +137,8 @@ Living Room Light:
137137

138138
# Installation
139139

140+
since version 1.0.3 I have uploaded docker images for alpine linux distro and raspberry pi distro to docker hub. Please see detailed instructions for Docker installation in [DOCKER.md](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/DOCKER.md)
141+
140142
## NPM
141143

142144
To install the module, just use `npm`:
@@ -164,11 +166,12 @@ If you are interested in running it on windows as a server the windows service d
164166
165167
2. Install the [MBS-Bridge Device Handler](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/devicetypes/gupta/mbs-bridge.src/mbs-bridge.groovy) in the [Device Handler IDE][ide-dt] using "Create via code"
166168
3. Add the "MQTT Bridge" device in the [My Devices IDE][ide-mydev]. Enter MQTT Bridge (or whatever) for the name. Select "MBS Bridge" for the type.
167-
4. Configure the "MQTT Bridge" in the [My Devices IDE][ide-mydev] with the IP Address, Port, and MAC Address of the machine running the mbs-server container
168-
4. Install the [MBS SmartApp Lite](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/smartapps/gupta/mbs-smartapp.src/mbs-smartapp-lite.groovy) or [MBS SmartApp Full](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/smartapps/gupta/mbs-smartapp.src/mbs-smartapp-full.groovy)on the [Smart App IDE][ide-app] using "Create via code"
169-
5. If using a Tasmota device install the [Tasmota SwitchSensor] or any other Tamota device from the [Tasmota Device Type] folder.
170-
5. Configure the Smart App (via the Native App) with the devices you want to subscribe to and the bridge that you just installed
171-
6. Via the Native App, select your MQTT device and watch as device is populated with events from your devices
169+
4. Configure the "MQTT Bridge" in the [My Devices IDE][ide-mydev] with the IP Address, Port, and MAC Address of the machine running the mbs-server processm service or docker container
170+
5. If ST is receiving messages from the bridge but the bridge is not receiving any messages from ST then most liley IP Address, Port, and MAC Address configuration is not correct
171+
6. Install the [MBS SmartApp Lite](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/smartapps/gupta/mbs-smartapp.src/mbs-smartapp-lite.groovy) or [MBS SmartApp Full](https://github.com/sgupta999/mqtt-bridge-smartthings/blob/master/smartapps/gupta/mbs-smartapp.src/mbs-smartapp-full.groovy)on the [Smart App IDE][ide-app] using "Create via code"
172+
7. If using a Tasmota device install the [Tasmota SwitchSensor] or any other Tamota device from the [Tasmota Device Type] folder.
173+
8. Configure the Smart App (via the Native App) with the devices you want to subscribe to and the bridge that you just installed
174+
9. Via the Native App, select your MQTT device and watch as device is populated with events from your devices
172175
173176
174177

0 commit comments

Comments
 (0)