Port number(s) needed for School networks etc

? Port numbers needed for standard Pi Cayenne Dashboard and BYODevice projects ( MQTT out of a Pi serial Python Script )

I have the above typical setup working and pre tested and working configured based on Raspberry Pi 3 and Zero(w) with the latest updated standard Rasparian desktop image. The Pi forwards locally GPIO connected sensors and BYOD MQTT slow serial radio link data from remote ultra low power devices to various accounts and projects. This works nearly every time in all sorts of places I have set it up.

I had an issue the other day with running this at a junior school and wondered if it could be the NZ M.O.Education kid safety net software OR need for certain ports to be open. The Pi works the www and finds the dashboard okay. Just there that the BYOD devices are not ‘live’ The school system or because the link into the school is very long and probably limited. They may have closed down nearly all ports so just wanted a link to see what minimum ports / spec is needed.

Can you suggest some things for me to check like some Pi command line tests I could make to help trace the issue or test the link in such cases as this.

I did see some discussion w.r.t an Arduino project but a ‘tool box’ check list or diagnostic could be handy. Sorry if this is already spelt out elsewhere.


~ Andrew

you might need to check if port 1883 is opened. also, you can check the error in the terminal.

1 Like

Thanks, yes a simple case of turning on the port.
I will test next time at the school. Only in there every few weeks. 8 kids and one teacher up a 43km winding river valley road :slight_smile:
Last year I used to see the response / chatter or otherwise in the terminal but there is nothing these days when manually running my Serial_to_MQTT script from cmd line. I found this was handy for educational, learning points about how MQTT works etc. Could this feature have been standard with the earlier versions of Cayenne-MQTT-Python ?
Any way I can add a line or turn this on temporary for testing / teaching ?
Happy to poke about the test scripts if that would help.
Pretty much a novice but happy to chip away at ideas this end.
~ Andrew

which script are you referring to?

the current version show debug line when the script is running.

I have a script that slices and dices CSV serial data and then does a check sum and general packet shape check on the serial data blob before sending the data to an appropriate MQTT - Cayenne Channel.

When I used to run this from cmd to test a setup:
sudo python Serial_to_MQTT.py etc
I used to see the above kind of PUB line but this stopped working at some stage. I will go and check what may have changed in Cayenne-MQTT-Python. Unless there is some special trick to look for the debug. I can try to activate print messages as a work around or if this is needed

Thanks for any tips here. I am a complete novice on Pi / python side of things and just use what works :slight_smile:

~ Andrew

Main ideas in my hacked about ‘code’
rcv = port.readline() #read buffer until cr/lf
rcv = rcv.rstrip(“\r\n”)
node,channel,data,cs = rcv.split(“,”)
#Test >>> print("rcv.split Data = : " + node + " " + channel + " " + data + " " + cs)
if node == ':08 ’ and cs == ‘0’:

Then it posts to an appropriate Cayenne Channel number:
if channel == ‘A’:
data = float(data)/10
client.virtualWrite(1, data, “analog_sensor”, “null”)
This works very nicely and one day when my ideas and skills grow up a bit I hope to get it passing the “Type” and “Units” as well from a smarter CSV line blob

have you added import logging in your code?

Was mainly my old code blob…
#client = cayenne.client.CayenneMQTTClient()
#client.on_message = on_message

Now updated to Examples…
client = cayenne.client.CayenneMQTTClient()
client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID, loglevel=logging.INFO)

So Logging + … loglevel=logging.INFO) bit was missing.

Thanks for the help AND the examples :slight_smile:
~ Andrew

Just left with following minor issue that will prob be pretty obvious as I know very little. When trying to use IDLE 3
Traceback (most recent call last):
File “/home/pi/Serial_to_MQTT.py”, line 2, in
import cayenne.client, datetime, time, serial, logging
ImportError: No module named ‘cayenne’

My novice blob was hacked out in 2.7 Looks like 2.7 removed in latest Pi Rasparian Image. But Geany runs fine + correct messages
Thanks for all the help
~ Andrew

you may need to install the cayenne library for both python version:

git clone https://github.com/myDevicesIoT/Cayenne-MQTT-Python
cd Cayenne-MQTT-Python

sudo python2.7 setup.py install


sudo python3 setup.py install

1 Like

All good now. The school is ‘on line’ with some very old Pi set up as place holder for the student data IoT concept.
~ Andrew

1 Like

Great to hear that :slightly_smiling_face: