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


429 posts in this topic Last Reply

Recommended Posts

I'm still not able to connect the mqtt/mosquitto. I've got the docker running, installed MQTT.fx on another computer on the network that I use all the time to control the unraid server. MQTT docker is set to bridge, left the guid/puid values in variables to what they are when they come with the docker 99/100. I even tried to create a user/password in the password file. I have tried leaving the docker install 100% alone as far as conf. files etc... and then connecting and still nothing. I'm defining my broker as 192.168.1.150, port 1883, tried with and without user/pass. It simply says Mqttexception: Unable to connect to server

 

Here is the log file from MQTT.fx

 

org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:79) ~[org.eclipse.paho.client.mqttv3-1.0.2.jar:?]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:590) ~[org.eclipse.paho.client.mqttv3-1.0.2.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_66]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_66]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_66]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_66]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_66]
at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_66]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70) ~[org.eclipse.paho.client.mqttv3-1.0.2.jar:?]
... 2 more
2016-02-08 14:38:08,743  INFO --- ScriptsController              : Clear console.
2016-02-08 14:38:08,744 ERROR --- BrokerConnectService           : MqttException: Unable to connect to server
2016-02-08 14:39:00,964  INFO --- BrokerConnectorController      : onConnect
2016-02-08 14:39:00,967  INFO --- ScriptsController              : Clear console.
2016-02-08 14:39:00,969  INFO --- MqttFX ClientModel             : MqttClient with ID MQTT_FX_Client assigned.
2016-02-08 14:39:00,998 ERROR --- MqttFX ClientModel             : Error when connecting
org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:79) ~[org.eclipse.paho.client.mqttv3-1.0.2.jar:?]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:590) ~[org.eclipse.paho.client.mqttv3-1.0.2.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_66]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_66]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_66]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_66]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_66]
at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_66]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70) ~[org.eclipse.paho.client.mqttv3-1.0.2.jar:?]
... 2 more
2016-02-08 14:39:01,026  INFO --- ScriptsController              : Clear console.
2016-02-08 14:39:01,027 ERROR --- BrokerConnectService           : MqttException: Unable to connect to server

 

I'm obviously still missing something and I'm sure it is extremely simple.

 

 

I was able to get connected. I had the password file incorrect. So it seems that you must have a user/pass in order to connect. Thanks for the great docker!

Link to post
  • Replies 428
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Ya....just go into the Node-Red Docker template and change the repository as I said above and hit apply.......That's all I had to do. Love it

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/

Does anyone here know how to update node.js version in the Node-Red Docker Container?   docker exec -it NodeRed-OfficialDocker /bin/bash node -V The command above shows I'm on v

Posted Images

Are you guys that are using node red doing something like this: sensors --> mqtt/mosquitto --> node-red --> openhab

 

I'm quite curious as I'm doing most of this as a hobby and find it quite interesting. I've gotten a few individual things hooked up to open hab through mi-light and philips bulbs, but am wanting to expand to mqtt and find a good set of items to integrate with it and it seems node-red has a really good way of working with those items.

 

 

Link to post

thanks for trying the docker.

 

With MQTT, there is a file created called mosquitto.conf with line 20:

allow_anonymous false

Change this to true if you do not want passwords.I was sure that if the passwords.mqtt file was empty then it would allow anon access. Will check.

 

Re HA stuff

I use my Node-Red and MQTT dockers together. I try to get as much as possible into mqtt directly (various ESP8266 devices) if I can. If not, I use Node-Red to transform the other devices (Hive thermostats - Tado Thermostats & Ciseco sensors https://www.wirelessthings.net/things/sensors) into MQTT messages. That way, I can try various HA applications at the same time: Domoticz, Emoncms, Home-Assistant, OpenRemoteCommander etc without problems.

Link to post

Thanks! I've been having a lot of fun with node-red. It has been great and very easy to keep track of things. It's easy to get lost in openhab between all the different things ones needs to create if you don't do it very often.

 

Has anyone tried mi-light in node-red? I gotten the flow from here: http://flows.nodered.org/flow/b2cb3bdc5a81ac881d4b I'm having a tough time getting it to work. I've correctly passed the mqtt topics through and it parses them, however the second function simply returns 0000 when outputting to debug. I do have the milights being controlled through openhab, but would like to be able to start with all functionality in mqtt/nodered, if possible. I hope you don't mind me conversing about the dockers like this in here. If you do, please let me know and I can start a thread.

 

Maybe one of you guys would know why 0000 is being returned. Command: "on" and value "6" is being passed as shown by the debugger. I can replace the hex string with something else and it will show up for that particular case.

 

var commandCode = [];
switch ( msg.payload.command ) {
case "on":
	commandCode = [[0x42,0x45,0x47,0x49,0x4B][msg.payload.value],0x00]; 
	break;
case "off":
	commandCode = [[0x41,0x46,0x48,0x4A,0x4C][msg.payload.value],0x00];
	break;
case "hue": //0-255
	var hex = msg.payload.value.toString(16);
	hex = (hex.length < 2) ? '0x0'+hex : '0x'+hex;
	commandCode = [0x40,hex];
	break;
case "whiteMode":
	commandCode = [[0xC2,0xC5,0xC7,0xC9,0xCB][msg.payload.value],0x00];
	break;
case "brightness": //1-100 => 2 to 27
	var hex = Math.max(2,(Math.ceil((msg.payload.value-1)/99*25))+2).toString(16);
	hex = (hex.length < 2) ? '0x0'+hex : '0x'+hex;
	commandCode= [0x4E,hex];
	break;
case "discoMode":
	commandCode = [0x4D,0x00];
	break;
case "discoSpeedUp":
	commandCode = [0x44,0x00];
	break;
case "discoSpeedDown":
	commandCode = [0x43,0x00];
	break;
}
//commandCode[2]=0x55;
msg.payload = new Buffer(commandCode);
return msg;

 

any ideas? Is it converting it in the output window and actually passing the correct values to msg or is it simply not liking the input for var? That's about all I can think of since the values that are being passed are actually corresponding the the correct case.

Link to post
  • 2 weeks later...
  • 3 weeks later...

Hey spants,

 

Anyway you could add node-red-contrib-json ?

 

thx!

Edit: and contrib-splitter ? :D

 

Arent these already in it? I had jq installed for contrib-json and I have just added JSONSelect and JSONPath.... let me know if it works

Link to post
  • 3 weeks later...

Hi, I'm struggling to get the MQTT docker image up. I've set it up as follows. On setup /config/ to point /mnt/cache/docker/appdate/mqtt/config - only problem is when I browse to that directory I can't see the files for some reason, but when using midnight commander via SSH I can see and edit the files.

 

So I tried editing the config file to allow anonymous connections, but I still don't have any luck when connecting via MQTT Spy.

 

Any ideas?

 

*edit* this is what the log file in docker shows me - the message from MQTT spy is connection refused

 

-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------


-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------

(Reading database ... 13828 files and directories currently installed.)
Preparing to unpack .../mosquitto_1.4.8-0mosquitto1_amd64.deb ...
Unpacking mosquitto (1.4.8-0mosquitto1) over (1.4.3-0mosquitto1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mosquitto (1.4.8-0mosquitto1) ...

-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------

Apr 13 22:31:09 6f2cae203645 syslog-ng[161]: syslog-ng starting up; version='3.5.3'
Apr 13 22:31:21 6f2cae203645 syslog-ng[161]: syslog-ng shutting down; version='3.5.3'

-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------


-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------

Apr 13 22:31:31 6f2cae203645 syslog-ng[62]: syslog-ng starting up; version='3.5.3'

-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------


-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------

Apr 13 22:31:52 6f2cae203645 syslog-ng[66]: syslog-ng starting up; version='3.5.3'

-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------


-----------------------------------
GID/UID
-----------------------------------
User uid: 99
User gid: 100
-----------------------------------

Link to post

OK, so using the command to manually start MQTT, I now get the following:

 

(Reading database ... 13828 files and directories currently installed.)
Preparing to unpack .../mosquitto_1.4.8-0mosquitto1_amd64.deb ...
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking mosquitto (1.4.8-0mosquitto1) over (1.4.3-0mosquitto1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mosquitto (1.4.8-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...

-----------------------------------
GID/UID
-----------------------------------
User uid:    99
User gid:    100
-----------------------------------

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

Error found at /config/mosquitto.conf:32765.
Error: Unable to open configuration file.
Apr 14 19:40:30 2172ea95af13 syslog-ng[156]: syslog-ng starting up; version='3.5.3'
Error: Unable to open config file /config/mosquitto.conf

Error found at /config/mosquitto.conf:32765.
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

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

Error found at /config/mosquitto.conf:32765.
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

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:32765.
Error: Unable to open configuration file.
Error: Unable to open config file /config/mosquitto.conf

Error found at /config/mosquitto.conf:32766.
Error: Unable to open configuration file.
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:32764.
Error: Unable to open configuration file.
Error: Unable to open config file /config/mosquitto.conf

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

Error found at /config/mosquitto.conf:32766.
Error: Unable to open configuration file.
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:32766.
Error: Unable to open configuration file.
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:32764.
Error: Unable to open configuration file.

 

So it looks like a permissioning issue. My cache drive is owned by nobody:users, is this correct?

 

*edit*

 

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),281(docker)

 

Those are my uid's it seems I don't have the uid of 99?

 

*edit2*

I see a user above had a similar problem? I've been unable to get it working thus far.

Link to post

it works for me, can you choose another directory and use the template to start it.

If you start it manually, try: (change directory to suit)

 

docker run -t -i --net="bridge" -p 1883:1883/tcp -p 9001:9001 -v /mnt/cache/app_config/mqtt/:/config:rw -e PGID=100 -e PUID=99 spants/mqtt

 

 

Link to post

it works for me, can you choose another directory and use the template to start it.

If you start it manually, try: (change directory to suit)

 

docker run -t -i --net="bridge" -p 1883:1883/tcp -p 9001:9001 -v /mnt/cache/app_config/mqtt/:/config:rw -e PGID=100 -e PUID=99 spants/mqtt

 

Exactly the same thing!

 

root@NAS:~# docker run -t -i --net="bridge" -p 1883:1883/tcp -p 9001:9001 -v /mnt/cache/app_config/mqtt/:/config:rw -e PGID=100 -e PUID=99 spants/mqtt
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_add_user_abc.sh...

-----------------------------------
GID/UID
-----------------------------------
User uid:    99
User gid:    100
-----------------------------------

*** Running /etc/my_init.d/60_update_apps.sh...
(Reading database ... 13828 files and directories currently installed.)
Preparing to unpack .../mosquitto_1.4.8-0mosquitto1_amd64.deb ...
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking mosquitto (1.4.8-0mosquitto1) over (1.4.3-0mosquitto1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mosquitto (1.4.8-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...

-----------------------------------
GID/UID
-----------------------------------
User uid:    99
User gid:    100
-----------------------------------

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

Error found at /config/mosquitto.conf:32764.
Error: Unable to open configuration file.
Apr 15 05:39:08 33c998692a79 syslog-ng[161]: syslog-ng starting up; version='3.5.3'
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

Error found at /config/mosquitto.conf:32764.
Error: Unable to open configuration file.
^C*** Shutting down runit daemon (PID 152)...

Link to post

Maybe it is because my data is stored on the protected unraid volumes /mnt/user/docker/appdata and yours is stored on the unprotected cache drive?.

 

Why do you store your docker data there? - apart from it is faster :-)

Link to post

Could be, I store the docker there because I don't want my disks spinning up all the time (cache is an SSD). I'm not that familiar with the difference (other than one is protected and another is not), but all the other ones I run (sanzb, couchpotato, sonarr) all work fine. The weird thing is I'm almost certain it's a permission thing, because when I browse the cache samba share, I can see all the config file for all the other dockers, but the MQTT folder I can't - if I change the permissions it's fine, but the config file still can't be read.

 

Very strange.

Link to post

I agree - it looks like permissions. Have you tried stopping mqtt and doing a newperms on that mqtt data folder?

 

Are you using the linuxserver.io versions of those dockers? My mqtt is based on linuxserver/baseimage so it should behave the same way.

 

If you have your docker data share on one disk, only that one will spin up but your data is protected if you have a disk fault.

Link to post
I agree - it looks like permissions. Have you tried stopping mqtt and doing a newperms on that mqtt data folder?

 

Yes, it appears to reset them upon starting and then it results in the same errors.

 

Are you using the linuxserver.io versions of those dockers? My mqtt is based on linuxserver/baseimage so it should behave the same way.

 

Not sure, how do I check this? Not at home so I don't know exactly which ones I'm using.

 

If you have your docker data share on one disk, only that one will spin up but your data is protected if you have a disk fault.

 

Yeah, I was trying to avoid having the disk spinning the majority of the time because of the constant log file writes I would presume this would happen on one of the (non-SSD) array disks.

 

*edit* I'm using the following dockers:

 

binhex/arch-couchpotato:latest

binhex/arch-sonarr:latest

needo/deluge:latest

balloob/home-assistant:latest

sdesbure/arch-jackett:latest

gfjardim/nzbget:latest

linuxserver/smokeping:latest

aptalca/docker-zoneminder:latest

 

I think of that list, smokeping is the only one from linuxserver.io, but it's working fine (been running it for several months)

 

*edit2* just tried NZBhydra and it's working fine.

Link to post

OK, so it's definitely something to do with the cache drive, apologies I misread your earlier suggestion and tried it on a user defined share

 

docker run -t -i --net="bridge" -p 1883:1883/tcp -p 9001:9001 -v /mnt/user/Music/app_config/mqtt/:/config:rw -e PGID=100 -e PUID=99 spants/mqtt

 

*** Running /etc/my_init.d/60_update_apps.sh...
(Reading database ... 13828 files and directories currently installed.)
Preparing to unpack .../mosquitto_1.4.8-0mosquitto1_amd64.deb ...
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking mosquitto (1.4.8-0mosquitto1) over (1.4.3-0mosquitto1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mosquitto (1.4.8-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...

-----------------------------------
GID/UID
-----------------------------------
User uid:    99
User gid:    100
-----------------------------------

*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 153
1460749019: mosquitto version 1.4.8 (build date Sun, 14 Feb 2016 15:48:26 +0000) starting
1460749019: Config loaded from /config/mosquitto.conf.
1460749019: Opening websockets listen socket on port 9001.
1460749019: Opening ipv4 listen socket on port 1883.
1460749019: Opening ipv6 listen socket on port 1883.
1460749019: Warning: Address family not supported by protocol
Apr 15 19:36:59 19cd4dfdedb7 syslog-ng[162]: syslog-ng starting up; version='3.5.3'
1460749034: New connection from 192.168.1.52 on port 1883.
1460749034: Socket error on client <unknown>, disconnecting.
1460749034: New connection from 192.168.1.52 on port 1883.
1460749034: Socket error on client <unknown>, disconnecting.

Link to post

K, thanks for trying that. Personally I would create a docker appdata directory and store the files on the protected disks. I would hate to lose the configs for my 17 dockers!.

 

The downside is that one disk stays spinning... the wear and tear is not much (better than sleeping/restarting) but it uses a slight amount of energy.

 

I will try and nail this issue down a bit but I have a busy weekend coming up!.

I wonder if the linuxserver.io sonar/plex have this issue... will try

 

(btw - the client error that you have, does the client have an id and have you disabled anon in the config fiel if you are not using a password)

Link to post

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.