nocanc fails with just mqtt subcriber details

Started by jimh

jimh

Hi,

While testing mqtt operation on nocanc version 0.1.11-linux-arm on the same raspberry pi hosting nocand the following behaviour was observed:

  • with the following configuration:

auth-token = "test"
event-server = "10.1.1.65:4242"

[mqtt]
mqtt-server="mqtt://uuu:ppp@userver"
client-id="nocan1"

[[mqtt.subscribers]]
channel="led2"
topic="jimh/data"

If you start nocanc this is displayed:

pi@sannoxiot3:~ $ ./nocanc mqtt -log-level "DEBUGXX" -log-terminal "color" &
[1] 21444
pi@sannoxiot3:~ $ 2018/12/16 13:32:26 DEBUG Connected to NoCAN event server '10.1.1.65:4242'
2018/12/16 13:32:26 DEBUG Mapping MQTT topic 'jimh/data' to NoCAN channel 'led2' for subscription'
2018/12/16 13:32:26 DEBUG+ Sending CONNECT: "\x10 \x00\x04MQTT\x04\xc0\x00<\x00\x06nocan1\x00\x05rpiot\x00\x05rpiot"
2018/12/16 13:32:26 DEBUG+ Got CONNACK(0x20), length 2, body "\x01\x00"
2018/12/16 13:32:26 INFO Connected successfully to rpiot@userver:1883
2018/12/16 13:32:26 DEBUG+ Sending SUBSCRIBE: "\x82\x0e\x00\x01\x00\tjimh/data\x00"
2018/12/16 13:32:26 DEBUG++ Starting reader loop
2018/12/16 13:32:26 DEBUG++ Reached end of cmd_mqtt()

The issue here is nocanc terminates and stops running. If you add a publishers section as follows nocanc stays up and operates correctly.

auth-token = "test"
event-server = "10.1.1.65:4242"

[mqtt]
mqtt-server="mqtt://uuu:ppp@userver"
client-id="nocan1"

[[mqtt.subscribers]]
channel="led2"
topic="jimh/data"

[[mqtt.publishers]]
channel="led2"
topic="jimh/info"

Log shows this:

pi@sannoxiot3:~ $ 2018/12/16 13:36:36 DEBUG Connected to NoCAN event server '10.1.1.65:4242'
2018/12/16 13:36:36 DEBUG Mapping MQTT topic 'jimh/data' to NoCAN channel 'led2' for subscription'
2018/12/16 13:36:36 DEBUG+ Sending CONNECT: "\x10 \x00\x04MQTT\x04\xc0\x00<\x00\x06nocan1\x00\x05rpiot\x00\x05rpiot"
2018/12/16 13:36:36 DEBUG+ Got CONNACK(0x20), length 2, body "\x01\x00"
2018/12/16 13:36:36 INFO Connected successfully to rpiot@userver:1883
2018/12/16 13:36:36 DEBUG++ Starting reader loop
2018/12/16 13:36:36 DEBUG+ Sending SUBSCRIBE: "\x82\x0e\x00\x01\x00\tjimh/data\x00"
2018/12/16 13:36:36 DEBUG Mapping NoCAN channel 'led2' to MQTT topic 'jimh/info' for publication
2018/12/16 13:36:36 DEBUG+ Got SUBACK(0x90), length 3, body "\x00\x01\x00"
2018/12/16 13:36:36 DEBUG+ Got PUBLISH(0x31), length 13, body "\x00\tjimh/data11"
2018/12/16 13:36:36 DEBUG Subscribed to MQTT topic jimh/data
2018/12/16 13:36:36 DEBUG Dispatched 2 byte message for NoCAN channel 'led2': "11"
2018/12/16 13:36:36 DEBUG+ Sending PUBLISH: "2\x0f\x00\tjimh/info\x00\x0211"
2018/12/16 13:36:36 DEBUG+ Got PUBACK(0x40), length 2, body "\x00\x02"
2018/12/16 13:36:36 INFO Published 2 bytes from channel 'led2' to topic 'jimh/info'
2018/12/16 13:36:36 DEBUG Published value is "11"

Now nocanc stays up and correctly processes messages to and from mqtt. If the configuration file only holds publisher data it also stays up.

A subscriber only configuration should be valid.

Regards,
Jim

Alain

Hi,
Thanks for the detailed report, it's very helpful.
I can confirm this is a bug. We'll issue a fix this week.
Regards,
Alain – Omzlo

jimh

Hi Alain,

Thanks for the quick feedback. I will await the fix and will test again.

Regards,
Jim

jimh

Hi Alain,

Downloaded and checked the operation of the 0.1.12 nocanc and the 0.1.11 nocand and the reported problem is now fixed. On with further developing. Thanks for the quick turn around.

All the best for the season.

Best regards,
Jim