MQTT and YUN

Hey folks,
This is my first post and I need some hints with MQTT.
The example sketch for publishing MQTT messages uses EthernetClient libraries.
I'd like to use WiFi connection. I tried to change it with WiFi client, but I realised it referes to WiFi Shield and it doesn't work.

Any suggestion? Does it make sense to "porting" the MQTT client library to Yun?
Another option cbould be to install the MQTT Client on Linino.
Is that a more viable solution?

Thank you
Francesco

A similar issue stumped me for a while when I was moving some Uno+Ethernet shield sketches to the Yun.

The modifications are minimal...use YunClient in place of EthernetClient. See: Wired Ethernet connection - Arduino Yún - Arduino Forum for more info.

1 Like

It worked :slight_smile: and with very few changes !

Thank you very much for the promptly reply.
Francesco

Hi Francesco,
not sure if you are still using MQTT, but I've been using it, along with Mosquitto, with some good results. Have a look at Program in the sketch side vs program in the linino side... - Arduino Yún - Arduino Forum

Cheers,
Con

Hi Con,
thank you for pointing out the discussion thread, I will comment on that.
Briefly my approach was different because I've used RasperryPI as host running the MQTT server (mosquito).
So every arduino yun is mainly a senosr node or data context source that publishes events.
I played with my son by using a light sensor on Yun that sends a message about environment changes, a python script on Raspi subscribed to the same topic takes a snapshot with the PiCamera when a person is shadowing the sensor.

Cheers,
Francesco