Custom MQTT Broker


#1

Hi, thanks for creating such an awesome product and look forward to seeing it progress in future :slight_smile:

I have followed the instructions for using a custom broker which i have running on another Raspberry Pi however, at first it says it has connected to that broker fine and in the broker it shows as connected but then I’m getting Hermes errors saynig it can’t connect to the broker at 127.0.0.1? I though when using a custom broker it disables Hermes?

Also, is there a way to allow for Username and Password for the MQTT server?

Thanks

Here is what it is showing in the log…

[08:44:57.128720] INFO :audio_server::audio: Use input device: “default”
[08:44:59.301740] INFO :hyper::http::response: Response::new “HTTP/1.1 201 Created”
[08:44:59.301909] INFO :reqwest::async_impl::response: Response: ‘201 Created’ for https://atomic.snips.ai/v1/billing
snips_stt --use-energy=false --num-mel-bins=40 --num-ceps=40 --low-freq=20 --high-freq=-400 --sample-frequency=16000
[08:44:59.476435] INFO :snips_asr: Loaded model from /usr/share/snips/asr
[08:44:59.477761] INFO :hermes::mqtt: Connecting to MQTT broker at address 127.0.0.1:1883
[08:44:59.553744] ERROR:snips_asr : Error(Hermes(Error(Rumqtt(Io(Error { repr: Os { code: 111, message: “Connection refused” } })), State { next_error: None })), State { next_error: None })
2017-08-14 08:44:59,564 INFO exited: snips-asr (exit status 1; not expected)
[08:44:59.710983] INFO :hermes::mqtt: Connecting to MQTT broker at address 192.168.1.37:1883
2017-08-14 08:44:59,721 INFO spawned: ‘snips-asr’ with pid 74
[08:44:59.737159] INFO :rumqtt::connection: $$$ Connected to broker
[08:44:59.808551] INFO :queries_hermes : Idle
2017-08-14 08:45:00,812 INFO success: snips-asr entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
snips_stt --use-energy=false --num-mel-bins=40 --num-ceps=40 --low-freq=20 --high-freq=-400 --sample-frequency=16000
[08:45:01.310686] INFO :snips_asr: Loaded model from /usr/share/snips/asr
[08:45:01.311247] INFO :hermes::mqtt: Connecting to MQTT broker at address 127.0.0.1:1883
[08:45:01.332956] ERROR:snips_asr : Error(Hermes(Error(Rumqtt(Io(Error { repr: Os { code: 111, message: “Connection refused” } })), State { next_error: None })), State { next_error: None })
2017-08-14 08:45:01,342 INFO exited: snips-asr (exit status 1; not expected)
2017-08-14 08:45:02,352 INFO spawned: ‘snips-asr’ with pid 91


#2

Same problem here, snips will crash when using custom mqtt:

[19:51:05.700812] INFO :audio_server::audio: Use input device: “default”
[19:51:05.964105] INFO :hyper::http::response: Response::new “HTTP/1.1 201 Created”
[19:51:05.964204] INFO :reqwest::async_impl::response: Response: ‘201 Created’ for https://atomic.snips.ai/v1/billing
[19:51:05.968660] INFO :hermes::mqtt: Connecting to MQTT broker at address IP:1883
[19:51:05.989671] INFO :rumqtt::connection: $$$ Connected to broker
snips_stt --use-energy=false --num-mel-bins=40 --num-ceps=40 --low-freq=20 --high-freq=-400 --sample-frequency=16000
[19:51:06.226493] INFO :snips_asr: Loaded model from /usr/share/snips/asr
[19:51:06.226748] INFO :hermes::mqtt: Connecting to MQTT broker at address 127.0.0.1:1883
[19:51:06.236201] ERROR:snips_asr : Error(Hermes(Error(Rumqtt(Io(Error { repr: Os { code: 111, message: “Connection refused” } })), State { next_error: None })), State { next_error: None })
2017-08-15 19:51:06,239 INFO exited: snips-asr (exit status 1; not expected)
[19:51:07.213656] INFO :queries_hermes : Idle
2017-08-15 19:51:07,214 INFO success: snips-tts entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-08-15 19:51:07,215 INFO success: snips-dialogue entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-08-15 19:51:07,216 INFO success: snips-hotword entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-08-15 19:51:07,217 INFO success: snips-audio-server entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-08-15 19:51:07,217 INFO success: snips-queries entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-08-15 19:51:08,228 INFO spawned: ‘snips-asr’ with pid 85
snips_stt --use-energy=false --num-mel-bins=40 --num-ceps=40 --low-freq=20 --high-freq=-400 --sample-frequency=16000
[19:51:08.919820] INFO :snips_asr: Loaded model from /usr/share/snips/asr
[19:51:08.920046] INFO :hermes::mqtt: Connecting to MQTT broker at address 127.0.0.1:1883
[19:51:08.929891] ERROR:snips_asr : Error(Hermes(Error(Rumqtt(Io(Error { repr: Os { code: 111, message: “Connection refused” } })), State { next_error: None })), State { next_error: None })
2017-08-15 19:51:08,933 INFO exited: snips-asr (exit status 1; not expected)
2017-08-15 19:51:10,946 INFO spawned: ‘snips-asr’ with pid 87
snips_stt --use-energy=false --num-mel-bins=40 --num-ceps=40 --low-freq=20 --high-freq=-400 --sample-frequency=16000
[19:51:11.688526] INFO :snips_asr: Loaded model from /usr/share/snips/asr
[19:51:11.688798] INFO :hermes::mqtt: Connecting to MQTT broker at address 127.0.0.1:1883
[19:51:11.698230] ERROR:snips_asr : Error(Hermes(Error(Rumqtt(Io(Error { repr: Os { code: 111, message: “Connection refused” } })), State { next_error: None })), State { next_error: None })
2017-08-15 19:51:11,701 INFO exited: snips-asr (exit status 1; not expected)
2017-08-15 19:51:14,712 INFO spawned: ‘snips-asr’ with pid 89
snips_stt --use-energy=false --num-mel-bins=40 --num-ceps=40 --low-freq=20 --high-freq=-400 --sample-frequency=16000
[19:51:15.403931] INFO :snips_asr: Loaded model from /usr/share/snips/asr
[19:51:15.404174] INFO :hermes::mqtt: Connecting to MQTT broker at address 127.0.0.1:1883
[19:51:15.414582] ERROR:snips_asr : Error(Hermes(Error(Rumqtt(Io(Error { repr: Os { code: 111, message: “Connection refused” } })), State { next_error: None })), State { next_error: None })
2017-08-15 19:51:15,417 INFO exited: snips-asr (exit status 1; not expected)
2017-08-15 19:51:16,420 INFO gave up: snips-asr entered FATAL state, too many start retries too quickly


#3

I’m glad I’m not the only one with this issue. Has anyone had this working successfully? I have seen various tutorials showing the same steps but none showing a working example. Also… does the Snips team read these forums?


#4

As workaround, I am using python code to read from Snips’s mqtt topics and publish to another mqtt.


#5

That’s a great idea! Do you mind sharing your code or giving a few pointers?

Thanks


#6

I used this iot_assistant and added second mqtt connection :

MQTT client to connect to the bus

mqtt_client = mqtt.Client()
mqtt_client2 = mqtt.Client(

if name == ‘main’:
mqtt_client2.loop_start()
mqtt_client.connect(‘localhost’, 9898)
mqtt_client2.connect(‘IP’, 1883)
mqtt_client.loop_forever()

For each function/topic add:

else:
mqtt_client2.publish(’/myhome/command’, ‘1’)
say(‘Say something’)


#7

Awesome!! Thanks again :slight_smile:


#8

@CMTech_NZ, if using a broker like mosquitto, I simply just bridged it to that of Snips, based on the topic I wanted. Once can bridge the entire bus anyway