spants

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

204 posts in this topic

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  *** Updated to Mosquitto 1.4.8 and Alpine Linux 3.3 1st May 2016 ***

====

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 official Apache couchDB docker

0

Share this post


Link to post
Share on other sites

Looks really interesting.  Have to sit down over a weekend and play with it some time

 

0

Share this post


Link to post
Share on other sites

Installing new nodes.

How do I install additional nodes into you Docker for NodeRed?

0

Share this post


Link to post
Share on other sites

I wish my brain could grasp what this does and what I can do with it...  ;)

0

Share this post


Link to post
Share on other sites

This is great.

It took me about 15min to install and connect to a "hidden" API on Efergy to read my real time energy consumption and write it to a file.

Just for fun I attached a web-service to dump the file back to a website.

 

I followed the video on the first post and this little blog:

http://blog.krisdaniels.be/efergy-engage-api/

 

Next challenge to store the data in a MariaDB.

efergy_flow.png.ed38167ff8c419620f0cc92a8802393e.png

0

Share this post


Link to post
Share on other sites

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?

 

0

Share this post


Link to post
Share on other sites

Thanks, emoncms looks interesting.

 

Since you are asking, some MySQL/MariaDB nodes would be great.

0

Share this post


Link to post
Share on other sites

And some MSSQL ones as well. Looking to connect to a MS SQL DB for some big data querying.

Thanks

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

Any update on being able to setup a username/password for MQTT?

0

Share this post


Link to post
Share on other sites

Any update on being able to setup a username/password for MQTT?

 

I'm also holding off for username/password. I'm not comfortable opening this up onto the internet without it. Thanks!!

0

Share this post


Link to post
Share on other sites

Sorry

- I had forgotten about adding MQTT passwords, I will add it shortly.

- I am also planning some updates to Node-Red nodes

 

Tony

0

Share this post


Link to post
Share on other sites

I have updated the Node-Red container - added lots more nodes, updated Node-Red and Node to the latest versions.

MQTT is next on my list. I would like to add username/password to the settings page - I'm reading up on that....

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

MQTT completely updated - latest Mosquitto version 1.4.3, password support and more.

 

0

Share this post


Link to post
Share on other sites

Typo in the XML file.  Issued a Pull Request on MQTT.xml

0

Share this post


Link to post
Share on other sites

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":[]}]

0

Share this post


Link to post
Share on other sites

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,

 

 

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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".

0

Share this post


Link to post
Share on other sites

If I run from bash chmod +x on the config directories it will work. But the permissions get reverted after I restart container.

 

# From /config
chmod +x . log data conf.d certs ca_certificates/

 

 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

Copyright © 2005-2017 Lime Technology, Inc. unRAID® is a registered trademark of Lime Technology, Inc.