Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
Created April 28, 2022 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dexterlabora/181ae1a7607be57eb15b3b490c500b19 to your computer and use it in GitHub Desktop.
Save dexterlabora/181ae1a7607be57eb15b3b490c500b19 to your computer and use it in GitHub Desktop.
DEV --- The is just a TEST schema for Meraki MQTT data.
asyncapi: '2.3.0'
info:
title: Meraki MQTT API
version: '1.0.0'
description: |
The Meraki MQTT service enables real-time telemetry from your network devices.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
contact:
name: support
url: 'https://create.meraki.io'
email: 'meraki@meraki.com'
# tags:
# - meraki
servers:
production:
url: test.mosquitto.org:{port}
protocol: mqtt
description: Test broker
variables:
port:
description: Secure connection (TLS) is available through port 8883.
default: '1883'
enum:
- '1883'
- '8883'
security:
- apiKey: []
- supportedOauthFlows:
- streetlights:on
- streetlights:off
- streetlights:dim
- openIdConnectWellKnown: []
defaultContentType: application/json
channels:
meraki/v1/mt/{networkId}/ble/{deviceMac}/humidity:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor current humidity reading
operationId: receiveSensorHumidity
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtHumidityMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/temperature:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor current humidity reading
operationId: receiveSensorTemperature
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtTemperatureMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/batteryPercentage:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor current humidity reading
operationId: receiveSensorBatteryPercentage
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtBatteryPercentageMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/tamperDetection:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor current humidity reading
operationId: receiveSensorBatteryPercentag
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtTamperDetectionMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/buttonReleased:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor button state
operationId: receiveSensorButtonReleased
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtButtonReleasedMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/cableConnected:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor cable state
operationId: receiveSensorCableConnected
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtCableConnectedMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/waterDetection:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor cable state
operationId: receiveSensorWaterDetection
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtWaterDetectionMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/usbPowered:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about the sensor cable state
operationId: receiveSensorUsbPowered
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtUsbPoweredMessage'
meraki/v1/mt/{networkId}/ble/{deviceMac}/gateway/{gatewayMac}/rssi:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
gatewayMac:
$ref: '#/components/parameters/deviceMac'
publish:
summary: Information about the sensor gateway RSSI
operationId: receiveSensorGatewayRssi
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mtGatewayRssiMessage'
meraki/v1/mr/{networkId}/{deviceMac}/wifi/{clientMac}/rssi:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about client relative signal strength.
operationId: receiveWirelessNetworkDeviceWiFiClientRssi
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/mrClientRssiMessage'
meraki/v1/mr/{networkId}/{deviceMac}/ble/{clientMac}/rssi:
description: The topic on which measured values may be produced and consumed.
parameters:
networkId:
$ref: '#/components/parameters/networkId'
deviceMac:
$ref: '#/components/parameters/deviceMac'
clientMac:
$ref: '#/components/parameters/clientMac'
publish:
summary: Information about client BLE relative signal strength.
operationId: receiveWirelessNetworkDeviceBleClientRssi
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
name: wirelessClientRssiMeasured
title: BLE Client RSSI and BLE deatils
summary: Inform about client bluetooth RSSI to the access point
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mrBleClientRssiPayload"
smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured:
description: The topic on which measured values may be produced and consumed.
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
publish:
summary: Inform about environmental lighting conditions of a particular streetlight.
operationId: receiveLightMeasurement
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/lightMeasured'
smartylighting/streetlights/1/0/action/{streetlightId}/turn/on:
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
subscribe:
operationId: turnOn
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/turnOnOff'
smartylighting/streetlights/1/0/action/{streetlightId}/turn/off:
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
subscribe:
operationId: turnOff
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/turnOnOff'
smartylighting/streetlights/1/0/action/{streetlightId}/dim:
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
subscribe:
operationId: dimLight
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/dimLight'
components:
messages:
mtHumidityMessage:
name: mtHumidityMessage
title: MT Sensor Humidity
summary: Information about the current humidity readings
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtHumidityPayload"
mtTemperatureMessage:
name: mtTemperatureMessage
title: MT Sensor Humidy
summary: Information about the current temperature readings
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtTemperaturePayload"
mtBatteryPercentageMessage:
name: mtBatteryPercentageMessage
title: MT Sensor Battery
summary: Information about the current battery readings
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtBatteryPercentagePayload"
mtTamperDetectionMessage:
name: mtTamperDetectionMessage
title: MT Sensor Tamper Detection
summary: Information about the current tamper protection
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtTamperDetectionPayload"
mtButtonReleasedMessage:
name: mtButtonReleasedMessage
title: MT Sensor Button Released
summary: Information about the current button state
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtButtonReleasedPayload"
mtCableConnectedMessage:
name: mtCableConnectedMessage
title: MT Sensor Button Released
summary: Information about the sensor cable connection
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtCableConnectedPayload"
mtWaterDetectionMessage:
name: mtWaterDetectionMessage
title: MT Sensor Water Detection
summary: Information about the sensor water detection
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtWaterDetectionPayload"
mtUsbPoweredMessage:
name: mtUsbPoweredMessage
title: MT Sensor USB power state
summary: Information about the sensor USB power
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtUsbPoweredPayload"
mtGatewayRssiMessage:
name: mtGatewayRssiMessage
title: MT Sensor Gateway RSSI
summary: Information about the sensor's RSSI to its BLE gateway
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mtGatewayRssiPayload"
mrClientRssiMessage:
name: wirelessClientRssiMeasured
title: RSSI measured
summary: Inform about client RSSI to the access point
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/mrClientRssiPayload"
lightMeasured:
name: lightMeasured
title: Light measured
summary: Inform about environmental lighting conditions of a particular streetlight.
contentType: application/json
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/lightMeasuredPayload"
turnOnOff:
name: turnOnOff
title: Turn on/off
summary: Command a particular streetlight to turn the lights on or off.
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/turnOnOffPayload"
dimLight:
name: dimLight
title: Dim light
summary: Command a particular streetlight to dim the lights.
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/dimLightPayload"
schemas:
mtHumidityPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
humidity:
type: number
description: The current humidity percentage read by the sensor
mtTemperaturePayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
fahrenheit:
type: number
description: The current temperature read by the sensor in Fahrenheit
celcius:
type: number
description: The current temperature read by the sensor in Celcius
mtTamperDetectionPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
tamperDetection:
type: boolean
description: The state of the tamper detection sensor
mtButtonReleasedPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
id:
type: integer
minumum: 0
description: The ID of the button event
action:
type: string
description: The type of button press, either longPress or shortPress
pressDuration:
type: number
description: The length of time the sensor button was pressed
units:
type: string
description: The unit of measurement
sequenceNumber:
type: number
description: Tracks the number of button presses
mtCableConnectedPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
cableConnected:
type: boolean
minumum: false
description: The state of the cable connection
mtWaterDetectionPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
batteryPercentage:
type: integer
minumum: 0
description: The state of the water sensor
mtBatteryPercentagePayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
batteryPercentage:
type: number
minumum: 0
description: The state of the sensor battery
mtUsbPoweredPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
usbPowered:
type: boolean
minumum: false
description: The state of the sensor's external USB power
mtGatewayRssiPayload:
type: object
properties:
ts:
$ref: "#/components/schemas/ts"
rssi:
type: number
minimum: -99
description: The relative signal strength from the sensor to the BLE gateway
units:
type: string
description: The unit of measurement for the RSSI, normally in dBm
mrClientRssiPayload:
type: object
properties:
rssi:
type: integer
minimum: 0
description: Signal strength measured in RSSI
mrMac:
$ref: "#/components/schemas/mac"
clientType:
type: string
description: A client's connection status to the wireless network
enum:
- visible
- connected
radio:
type: string
description: The radio interface type
enum:
- ble
- wifi
timestamp:
$ref: "#/components/schemas/timestamp"
mrBleClientRssiPayload:
type: object
properties:
rssi:
type: integer
minimum: 0
description: Signal strength measured in RSSI
mrMac:
$ref: "#/components/schemas/mac"
clientType:
type: string
description: A client's connection status to the wireless network
enum:
- visible
- connected
radio:
type: string
description: The radio interface type
enum:
- ble
- wifi
timestamp:
$ref: "#/components/schemas/timestamp"
signalPower:
type: number
description: The signal power
minimum: -99
minor:
type: number
description: The Bluetooth minor identifier
mimimum: 0
major:
type: number
description: The Bluetooth major identifier
mimimum: 0
uuid:
type: string
description: The Bluetooth UUID
wirelessClientRssiMeasured:
type: object
properties:
rssi:
type: integer
minimum: 0
description: Signal strength measured in RSSI
mrMac:
$ref: "#/components/schemas/mac"
clientType:
type: string
description: A client's connection status to the wireless network
enum:
- visible
- connected
radio:
type: string
description: The radio interface type
enum:
- ble
- wifi
timestamp:
$ref: "#/components/schemas/timestamp"
lightMeasuredPayload:
type: object
properties:
lumens:
type: integer
minimum: 0
description: Light intensity measured in lumens.
sentAt:
$ref: "#/components/schemas/sentAt"
turnOnOffPayload:
type: object
properties:
command:
type: string
enum:
- on
- off
description: Whether to turn on or off the light.
sentAt:
$ref: "#/components/schemas/sentAt"
dimLightPayload:
type: object
properties:
percentage:
type: integer
description: Percentage to which the light should be dimmed to.
minimum: 0
maximum: 100
sentAt:
$ref: "#/components/schemas/sentAt"
sentAt:
type: string
format: date-time
description: Date and time when the message was sent.
timestamp:
type: string
format: date-time
description: Date and time when the message was sent.
ts:
type: string
format: date-time
description: Date and time when the message was sent.
mac:
type: string
description: The MAC address
securitySchemes:
apiKey:
type: apiKey
in: user
description: Provide your API key as the user and leave the password empty.
supportedOauthFlows:
type: oauth2
description: Flows to support OAuth 2.0
flows:
implicit:
authorizationUrl: 'https://authserver.example/auth'
scopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
password:
tokenUrl: 'https://authserver.example/token'
scopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
clientCredentials:
tokenUrl: 'https://authserver.example/token'
scopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
authorizationCode:
authorizationUrl: 'https://authserver.example/auth'
tokenUrl: 'https://authserver.example/token'
refreshUrl: 'https://authserver.example/refresh'
scopes:
'streetlights:on': Ability to switch lights on
'streetlights:off': Ability to switch lights off
'streetlights:dim': Ability to dim the lights
openIdConnectWellKnown:
type: openIdConnect
openIdConnectUrl: 'https://authserver.example/.well-known'
parameters:
streetlightId:
description: The ID of the streetlight.
schema:
type: string
networkId:
description: The ID of the Meraki network.
schema:
type: string
deviceMac:
description: The MAC address of the Meraki device (i.e. access point, sensor).
schema:
type: string
clientMac:
description: The MAC address of the network client (i.e. laptop, phone, PC).
schema:
type: string
messageTraits:
commonHeaders:
headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100
operationTraits:
mqtt:
bindings:
mqtt:
qos: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment