Page 1 of 1

(SOLVED) Raspberry pi MQTT problems

Posted: Wed Nov 15, 2017 7:26 pm
by rsluiman
Hi,

I've been having the OTGW running for over a few months and wanted to try something more with it.
I've got a raspberry pi and downloaded the otmonitor specific for the pi.
The problem i'm now facing is that when i enable mqtt the checkbox won't get enabled. to solve this i tried the web interface.
After enabling mqtt in the web interface i get the folowing error from otmonitor:

Code: Select all

invalid command name "mqttmessage"
invalid command name "mqttmessage"
    while executing
"mqttmessage $src"
    (procedure "otmessage" line 5)
    invoked from within
"otmessage [clock microseconds] $line [expr {$type & 7}] $id $data"
    (procedure "process" line 12)
    invoked from within
"process [append data $line]"
    (procedure "receive" line 6)
    invoked from within
"receive"
this is probably a problem in the source code but i got no experience with tcl code but i can program in other languages so if you guys can point me in the right direction i might be able to solve this myself

Re: Raspberry pi MQTT problems

Posted: Thu Nov 16, 2017 10:45 am
by mike7
Please show mqtt settings from .otmonitorrc, I'll try to help

PS. mqtt definitely working in otmonitor

Re: Raspberry pi MQTT problems

Posted: Thu Nov 16, 2017 11:04 am
by rsluiman
the mqtt settings in the settings file

Code: Select all

mqtt {
  devicetype central_heating
  deviceid otmonitor
  retransmit 10
  format json2
  port 1883
  qos 1
  keepalive 120
  username admin
  password YWRtaW4=
  enable false
  messages false
  client raspberryPiHub-otmon
  broker 192.168.0.110
}

Re: Raspberry pi MQTT problems

Posted: Thu Nov 16, 2017 8:56 pm
by mike7
looks good, the only difference from my setup:
I don't use authentication

Code: Select all

  username {}
  password {}
  enable true
you can try to enable mqtt directly in the settings file

Re: Raspberry pi MQTT problems

Posted: Thu Nov 16, 2017 9:09 pm
by rsluiman
I'm getting the same result as enabling trhough the web interface

Re: Raspberry pi MQTT problems

Posted: Fri Nov 17, 2017 6:44 am
by mike7
strange, looks like otmonitor doesn't read or reads wrong settings file

could you try to use -f command line switch like

Code: Select all

./tclkit.ahf otmonitor.vfs/main.tcl -f /home/pi/.otmonitorrc --daemon --system -w 8080
I'm using source version, you can change command for single file version

Re: Raspberry pi MQTT problems

Posted: Fri Nov 17, 2017 5:39 pm
by rsluiman
What makes you think it doesn't read the config? everytime i start otmonitor it reads and writes the config correctly the problem here is i think in the source code

Re: Raspberry pi MQTT problems

Posted: Sat Nov 18, 2017 6:24 am
by mike7
I found

Code: Select all

enable false
in your settings file, if it is enabled and doesn't work try to connect without authentication.

Re: Raspberry pi MQTT problems

Posted: Sat Nov 18, 2017 1:58 pm
by rsluiman
I've been digging through some tcl tutorials as well as the source code. you need libmposquitto installed on the pi for it to work. after installing this it works

Re: (SOLVED) Raspberry pi MQTT problems

Posted: Sun Nov 19, 2017 10:54 pm
by mike7
Could you please explain what you did?
I'm using Arch Linux and mosquitto is not installed (I'm using mosquitto in container).
As I understand otmonitor is using mqtt module from lib/tcl8/8.6/mqtt-1.0.tm