Skip to content

Instantly share code, notes, and snippets.

@ProfAndreaPollini
Created December 7, 2018 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ProfAndreaPollini/745aff99fd8443d332d801be6698479d to your computer and use it in GitHub Desktop.
Save ProfAndreaPollini/745aff99fd8443d332d801be6698479d to your computer and use it in GitHub Desktop.
ESP32 MONGOOSE OS - GOOGLE CLOUD PLATFORMCONFIGURATION

After create the project with id :

  • CREATE DATA TOPIC gcloud beta pubsub topics create iot-data

  • create subscription gcloud beta pubsub subscriptions create --topic iot-data iot-subscription

  • CREATE REGISTRY

cloud beta iot registries create --region europe-west1 --event-notification-config=topic=projects//topics/device-events

  • configure mongoose

mos gcp-iot-setup --gcp-project --gcp-region europe-west1 --gcp-registry

load('api_config.js');
load('api_gpio.js');
load('api_mqtt.js');
let topic = '/devices/' + Cfg.get('device.id') + '/config';
MQTT.sub(topic, function(conn, topic, msg) {
print('Topic:', topic, 'message:', msg);
}, null);
# config_schema:
# - ["debug.level", 3]
libs:
# Used by the mos tool to catch mos binaries incompatible with this file format
manifest_version: 2017-09-29
config_schema:
- ["mqtt.server", "iot.eclipse.org:1883"]
- ["mqtt.enable", true]
- ["rpc.mqtt.enable", false] # Disable remote control over MQTT
libs:
# common mgos libs
- origin: https://github.com/mongoose-os-libs/http-server
- origin: https://github.com/mongoose-os-libs/rpc-loopback
- origin: https://github.com/mongoose-os-libs/rpc-mqtt
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/js-demo-bundle
# libs necessary for the current app
- origin: https://github.com/mongoose-os-libs/gcp
- origin: https://github.com/mongoose-os-libs/mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment