mc-Gateway > mc-Gateway

Programming the mc-Gateway

(1/3) > >>

millennial:
I know it is not possible to program the mc-Gateway, but I have a couple of problems that could cheaply, elegantly, and easily be solved if we could program the mc-Gateway, even in an extremely limited manner. I say the problem could be solved cheaply and elegantly because an alternative solution to the following problems would be to host an MQTT server on a Raspberry Pi and bridge some of (and perhaps compute and re-package) the messages to Losant.

Losant has a payload limit, and other services may also have similar types of message limits. If we could tell the mc-Gateway not to send the beacon topics over MQTT, this would allow us to keep the beacon interval high (10 seconds) and avoid accruing payloads on Losant. A general whitelist/blacklist configuration for MQTT topics on the mc-Gateway could solve this problem.

Another problem, specific to Losant, is that if we use beacons for sensor readings (ideal for saving precious battery life) we need to use the Losant workflow to receive the MQTT event and then set device state based on a computation to retrieve the user data in the beacon bytes. The act of receiving MQTT in a workflow, and then using the workflow to set device state, both count towards the Losant payload limit. If we could define beacon user data mapping, perform simple calculations, and send results out on a renamed MQTT topic (in the case of Losant, a "set state" topic pattern), we could cut payloads in half on Losant. Yes, this problem can be solved by using MQTT directly on the modules, but this compromises battery life.

Nick_W:
Or you could use my beacon_decode.py program, as this is exactly what it does.

millennial:
If I could run a Python program on the mc-Gateway, I would gladly use beacon_decode.py  ;)

Nick_W:
But you could run it on almost anything else, like a Pi. Do you not have anything running an MQTT broker?

Best solution would be to have small computer (say a Pi) running an MQTT broker locally, plus other programs (like beacon_decode and my logging program). This receives all the data/beacons etc, then you push from there to your cloud service/Losant/whatever. Then you are in control of exactly what is sent and when. And you can watch it all in real time to see what is happening.

You can run python on almost anything, a Pi zero ($5), or the PC you are using to program your modules.

Best bet is a RPi 3, with built in WiFi, plug it in, and leave it running 24/7 with mosquito MQTT broker running and whatever python programs you like. With SD card, you can set this up for $50 or less (if you don't need WiFi, and can use the built in Ethernet, you can use a Pi2 or cheaper).

Seriously, a Pi zero works, size of 3 modules, with a $10 wifi dongle and SD card, you can set up a whole server for about the cost of 1 module.

I doubt MCThings will implement programming of a $95 gateway, when you can set up a general purpose server for $20.

Just saying...

millennial:
I could easily set up a Pi with Mosquitto, but that is one extra piece to the puzzle. Sure it doesn't matter if I use a Pi in my home, but people would prefer an IoT product that has 1 less piece. Also, selling 1,000-10,000 counts of a product to separate sites would mean $5,000-$50,000 of Pi Zero's, which is expensive and 1 more piece of depreciating capital to maintain.

A whitelist/blacklist configuration for the mc-Gateway that tells it what MQTT topics to actually send out to the internet would be a good feature. Though, full-fleged programming would be nice on the mc-Gateway.

Navigation

[0] Message Index

[#] Next page

Go to full version