[support] Spants - NodeRed, MQTT, Dashing, couchDB


Recommended Posts

This is where I will be hosting some dockers that I find useful, built on a Phusion or Linuxserver base.

Add to your templates if you wish.

 

https://github.com/spants/unraidtemplates/

*** Also added template support for the official NodeRed docker image - loads the latest version!!!. You can extra nodes through the Palette menu option. Therefore I will retire my unofficial version. Make a copy of your appdata directory and rename any 'flow' files to 'flows' ***

 

 

 

NodeRed

======

This is THE Internet of Things package!. See http://www.nodered.org and http://flows.nodered.org for more info. I use this to link with my TADO heating system, Ciseco wireless sensors and Open weathermap linked with EmonCMS to produce heating graphs.

 

It uses building blocks to manipulate data from devices/databases/twitter/http/mqtt etc etc - very powerful!

 

MQTT  *** Revert to Mosquitto 1.4.8 and Alpine Linux 3.3 27th Jan 2020 - due to timeout bug found ***

====

Please see Skylord123's excellent tutorial on setting this up  https://skylar.tech/installing-mqtt-under-docker/

 

Setup for port 1883 and websockets on Port 9001. Supports usernames/passwords and certificates.

 

To add authenticated users to MQTT, create a file named passwords.txt and save in the config directory. On restart, these will be encrypted and added to the top of the passwords.mqtt file.

 

You might need to run NEWPERMS to edit the config file.

 

Dashing  *** Updated 08-Dec-2015, added dev tools ***

======================================

From dashing.io =

Dashing is a Sinatra based framework that lets you build beautiful dashboards.

 

Key features:

 

Use premade widgets, or fully create your own with scss, html, and coffeescript.

Widgets harness the power of data bindings to keep things DRY and simple. Powered by batman.js.

Use the API to push data to your dashboards, or make use of a simple ruby DSL for fetching data.

Drag & Drop interface for re-arranging your widgets.

Host your dashboards on Heroku in less than 30 seconds.

This project was created at Shopify for displaying custom dashboards on TVs around the office.

 

Sample dashboards installed at IPaddress:3030/sample  and IPaddress:3030/sampletv

 

couchDB

=======

unRaid template for the (semi)official Apache couchDB docker https://github.com/apache/couchdb-docker

Edited by spants
update mqtt
  • Like 1
Link to comment
  • 1 month later...
  • 1 month later...

Glad its working!. I did a similar thing with my Tado heating system.

Why not use emoncms as the back end for the energy data?. Actually that may be a great docker to build......

 

@Dallas.toth, which nodes would you like?

 

Link to comment

There is also a emoncms  connector...,

 

I saw it is rather simple to add the nodes, but would they "survive" a docker rebuild?

 

On a different question, once I started writing to the file the disk obviously does not spin down anymore. Do you just write to your cache drive?

 

Thanks

Link to comment
  • 2 months later...
  • 3 weeks later...

Thanks for updating Node-Red, but why remove the EmonCMS node?  I had to add it back in manually to keep all my energy posting flows working.

 

Also, if you plan on updating MQTT you should jump up the latest version of Mosquitto as the current version in your container is very old.  The statements below will add the new repository and install the current 1.4.3 version.

 

RUN add-apt-repository ppa:mosquitto-dev/mosquitto-ppa -y

RUN apt-get update

RUN apt-get install -y mosquitto mosquitto-clients

Link to comment

good catch on emoncms, I use it myself but missed it off the list.

I will add it now. ***** now added *****

 

Thanks for the mosquitto hints. I have something in beta but will look at your notes.

I need to add websockets support/ passwords and options for certificates

 

Tony

Link to comment

Be aware that Openweather map and Forecast.io nodes do not seem to work correctly on the latest NodeRed....

 

I use the following code in Node Red to get the current temperature instead: (copy and then Import)

 

[{"id":"9e1f670b.61e098","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"8c7d3ed4.7382c","type":"function","name":"Outside Temp","func":"\nif (msg.payload == \"\" ) {\n\treturn null;\n\t}\n\nvar weather = JSON.parse(msg.payload); \n//msg1 = {topic:\"Buxted/sunrise\", payload:weather.sys.sunrise};\n//msg2 = {topic:\"Buxted/sunset\", payload:weather.sys.sunset};\nweathertemp = Math.round( weather.main.temp * 10 ) / 10;\nmsg = {topic:\"House/Temp/Outside\", payload:weathertemp};\nreturn msg;","outputs":"1","x":607.638916015625,"y":222.74993896484375,"z":"a4d9ce41.5b263","wires":[["bd4969.ff42b698"]]},{"id":"c950f21e.36af1","type":"http request","name":"Openweathermap","method":"GET","ret":"txt","url":"http://api.openweathermap.org/data/2.5/weather?q=London,uk&units=metric","x":378.4167175292969,"y":222.08331298828125,"z":"a4d9ce41.5b263","wires":[["8c7d3ed4.7382c"]]},{"id":"9116d09f.6ee93","type":"inject","name":"1 Min Timer","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"x":194.0000457763672,"y":221.77777099609375,"z":"a4d9ce41.5b263","wires":[["c950f21e.36af1"]]},{"id":"bd4969.ff42b698","type":"mqtt out","name":"","topic":"","qos":"1","retain":"true","broker":"9e1f670b.61e098","x":825,"y":223,"z":"a4d9ce41.5b263","wires":[]}]

Link to comment

I have the MQTT docker up and running and it is great! Thank you! I have installed the OwnTracks app on my iPhone and it is reporting back as my location changes. I see on the OwnTracks web site that they have a client that consumes MQTT location information and can store it in a database, reverse geocode it and then show it on a map.

 

Would it be possible to get an unraid Docker containing their o2s / Pista ?

http://owntracks.org/booklet/guide/clients/

https://github.com/owntracks/pista

 

hoping,

 

 

Link to comment
  • 2 weeks later...

I've been having some problems after the MQTT rewrite. I keep getting connection refused when I try to connect using mosquitto_sub on another machine.

 

If I overwrite the entry point of the docker with the command 'mosquitto', it runs just fine but passwords are not validated and everyone just has access.

 

Running the docker from the command line with TTY attached, I see these errors:

 

root@Hydra:/mnt/cache/app_config/mqtt# docker run -t -i --net="bridge" -e TZ="America/Los_Angeles" -p 1883:1883/tcp -v "/mnt/cache/app_config/mqtt/":"/config":rw spants/mqtt
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_add_user_abc.sh...
/etc/my_init.d/10_add_user_abc.sh: line 3: [: : integer expression expected
/etc/my_init.d/10_add_user_abc.sh: line 4: [: : integer expression expected

-----------------------------------
GID/UID
-----------------------------------
User uid:    911
User gid:    8378
-----------------------------------

*** Running /etc/my_init.d/60_update_apps.sh...
(Reading database ... 13828 files and directories currently installed.)
Preparing to unpack .../mosquitto_1.4.4-0mosquitto1_amd64.deb ...
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking mosquitto (1.4.4-0mosquitto1) over (1.4.3-0mosquitto1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mosquitto (1.4.4-0mosquitto1) ...
invoke-rc.d: policy-rc.d denied execution of start.
*** Running /etc/my_init.d/80_set_config.sh...
*** Running /etc/my_init.d/90_new_user.sh...
/etc/my_init.d/90_new_user.sh: line 3: [: : integer expression expected
/etc/my_init.d/90_new_user.sh: line 4: [: : integer expression expected

-----------------------------------
GID/UID
-----------------------------------
User uid:    911
User gid:    8378
-----------------------------------

*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 139
Error: Unable to open config file /config/mosquitto.conf

Error found at /config/mosquitto.conf:32764.
Error: Unable to open configuration file.
Sep 20 12:24:38 b38c5292ebd4 syslog-ng[145]: syslog-ng starting up; version='3.5.3'
Error: Unable to open config file /config/mosquitto.conf

Error found at /config/mosquitto.conf:32764.
Error: Unable to open configuration file.
Error: Unable to open config file /config/mosquitto.conf

Error found at /config/mosquitto.conf:32767.
Error: Unable to open configuration file.
Error: Unable to open config file /config/mosquitto.conf

Link to comment

If I run a bash shell inside the container and run 'mosquitto -c /config/mosquitto.conf' I get the following:

 

root@0058acdb3406:/config# mosquitto -c mosquitto.conf
1442777398: Error: Unable to open log file /config/log/mosquitto.log for writing.
1442777398: mosquitto version 1.4.3 (build date Wed, 19 Aug 2015 12:10:03 +0100) starting
1442777398: Config loaded from mosquitto.conf.
1442777398: Error: Unable to open pwfile "/config/passwords.mqtt".
1442777398: Error opening password file "/config/passwords.mqtt".

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.