|
|
(397 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
− | == Functionality ==
| + | [[File:AmtechM2mBridge.svg|40px]] M2MBridge is a software stack that implements M2M edge functionality leveraging AMTech IoT Protocol |
− | * Configurable edge intelligence
| + | # [[M2MBridge Functionality|Functionality]] |
− | * Bridges standard and proprietary protocols to AMTech IoT DAP.
| + | # [[Configuration example]] |
− | * Device-to-device or device-to-cloud communications.
| + | # [[M2MBridge network]] |
− | ** MQTT, LLRP, CoAP, STOMP, SmartM2M, LWM2M, PLC, Zigbee and others
| + | #: [[Aggregation]] |
− | * Allow remote and centralized control of IoT devices and gateways.
| + | #: [[Edge reasoners]] |
− | ** SNMP/MIB/TRAP, Reader Management and other
| + | #: [[Mesh network]] |
− | * Configurable auto-discover
| + | # [[Intelligence at the Edge]] |
− | * Implements common functionality and orchestrates the execution of the protocols
| + | #: [[WhatIsAPlugin|What is a plugin?]] |
− | * Network failure detection and recovery
| + | #: [[EPC (Electronic product code)]] |
− | * Get centralized configuration information at startup and real time modifications
| + | #: [[Smoothing observations]] |
− | * Access control policies to manage observation production and consumption
| + | # [[Observations production and consumption]] |
− | [[File:Example.jpg]] | + | # [[Cloud Configuration]] |
− | | + | #: [[Observation production config]] |
− | == Edge Configuration ==
| + | #: [[Validation]] |
− | *Edge/Device(s) site configuration bridgeConfig.json
| + | #: [[Sample configuration for beacons]] |
− | {
| + | # [[Automatic updates on bridge instance delete]] |
− | <span style="color:red">//text to label bridge instance</span>
| + | # [[Implementation notes]] |
− | "description": "AMTech M2M Bridge",
| + | # [[How to implement a new plugin]] |
− | "dap":{
| + | # [[Set up a new Raspberry PI]] |
− | <span style="color:red">//amtech IoT DAP ur</span>
| + | # [[Edge Configuration|M2MBridge Edge Configuration]] |
− | "dapUrl": "https://dap.amtech.mx",
| + | # [[M2MBridge updates]] |
− | <span style="color:red">//userid for the m2mBridge instance</span>
| + | # [[How to install & execute]] |
− | "userId": "xxxxxxx@amtech.mx",
| + | # [[HelloWorld plugin]] |
− | <span style="color:red">// tenant where bridge been configured</span>
| + | # Supported plugins |
− | "tenant" : "xxxxxxx",
| + | ## [[File:wi-fi.svg|35px]] [[File:tcp-ip.svg|35px]] [https://en.wikipedia.org/wiki/Ethernet Wifi or RJ45 Ethernet] |
− | <span style="color:red">//m2mBridge userId password</span>
| + | ##: [[File:SNMPDevice.svg|35px]] [[SNMPDevice]] |
− | "password" :"xxxxxxxx",
| + | ##: [[File:LLRPReader.svg|35px]] [[LLRPReader]] |
− | <span style="color:red">//topic to get crud (observationresourcecrud) and command observations</span> (See [[Sensor's network#Crud observation|CRUD observations]] [[Activities#Send command|Send command]] )
| + | ##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]] |
− | "crudCommandUrl" :"/xx/xx/"
| + | ##: [[File:thing-magic.svg|35px]] [[ThingMagicEPCReader]] |
− | },
| + | ##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]] |
− | <span style="color:red">//access control information add to send observations</span>
| + | ##: [[File:plc-icon.svg|35px]] [[OPCUADevice]] |
− | "guestSecurity":{
| + | ##: [[File:modbus.svg|45px]] [[ModbusDevice]] |
− | <span style="color:red">//add guest tenants to observations send from bridge</span>
| + | ##: [[File:wioGeneric.png|45px]] [[Wio Devices]] (troubleshooting inside) |
− | "guesttenants":["progressnext2016"],
| + | ##:: [[File:wioNode.svg.svg|35px]] [[wioNode]] |
− | <span style="color:red">//add guest users to observations send from bridge</span>
| + | ##:: [[File:wioLink.svg|35px]] [[wioLink]] |
− | "guestusers":[]
| + | ## [[File:bt.svg|35px]] [https://en.wikipedia.org/wiki/Bluetooth_Low_Energy BLE 4.0] |
− | },
| + | ##: [[File:BLEbeaconsScanner.svg|35px]] [[BLEbeaconsScanner]] |
− | <span style="color:red">//network failed configuration</span>
| + | ##: [[File:bleOBDScanner.svg|35px]] [[BLEODB2Scanner]] |
− | "networkFailed" :{
| + | ##: [[File:BLEPeripheralsScanner.svg|35px]] [[BLEPeripheralsScanner]] |
− | <span style="color:red">//re-connection delay after an instance of plug in failed </span>
| + | ##: [[File:BluvisioniBEEK.jpg|65px]] [[BLEBluvisionBeeksScanner]] |
− | "reconnectWait" : 60000
| + | ##: [[File:BLEGattCentral.svg|35px]] [[BLEGattCentral]] |
− | },
| + | ## [[File:i2c.svg|35px]] [https://en.wikipedia.org/wiki/I%C2%B2C I2C] |
− | <span style="color:red">//bridge startup configuration</span>
| + | ##: [[File:watersensor.svg|35px]] [[PCA9536I2CWaterDetectionWithBuzzer]] |
− | "pluginLoad" :{
| + | ##: [[File:TSL2561Light.svg|65px]] [[TSL2561I2CLight]] |
− | <span style="color:red">//send observations error when errors occurred at bridge layer</span>
| + | ##: [[File:soundvibration.svg|35px]] [[ADC121C021I2CSoundVibrationShock]] |
− | "sendM2mBridgeError" : true
| + | ##: [[File:ncd-i2c.png|65px]] [https://store.ncd.io/shop/?fwp_interface=i2c-interface NCD I2C devices] |
− | },
| + | ##: [[File:grove-log.png|65px]] [https://www.seeedstudio.com/category/Grove-c-1003%7C%7C24.html?p=0 Grove devices via I2C] |
− | <span style="color:red">//network failed configuration</span>
| + | ## [[File:usb-logo.svg|35px]] [https://en.wikipedia.org/wiki/USB USB 2.0] |
− | "logger" :{
| + | ##: [[File:thing-magic.svg|35px]] [[ThingMagicEPCReader]] |
− | <span style="color:red">//network failed configuration</span>
| + | ##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]] |
− | "colorize" : true, //colorize log console messages
| + | ##: [[File:Phidgets-Logo.png|65px]] [https://www.phidgets.com/?tier=0&catid=3&pcid=12 Phidgets USB sensors] |
− | <span style="color:red">//network failed configuration</span>
| + | <!--##:[[File:modbus.svg|45px]] [[ModbusDevice]]--> |
− | "level": "debug" //log level
| + | ## [[File:xbee-pro-900hp.svg|35px]] [https://www.digikey.com/catalog/en/partgroup/xbee-pro-900hp/33082?utm_adgroup=RF%20&%20RFID XBee-Pro 900HP] |
− | },
| + | ##: [[File:relay-home-automation.svg|35px]] [[NCDXbee900Relay]] |
− | <span style="color:red">//Address use to geo locate m2mBridge instance</span>
| + | ##: [[File:energy-monitor.svg|35px]] [[NCDXbee900EnergyMonitor]] |
− | "address" :{
| + | ##: [[File:ncd-i2c.png|65px]] [https://store.ncd.io/shop/?fwp_interface=900hp-s3b NCD devices supporting XBee-Pro 900HP communication] |
− | "country" : "usa",
| + | <!-- ## [[File:libelium.svg|45px]] [[waspmoteBLECentral]]--> |
− | "city": "Las Vegas",
| + | ##: [[File:libelium.svg|65px]] [http://www.libelium.com/libeliumworld/waspmote/ Libelium waspmote] |
− | "road": "Las Vegas Boulevard South",
| + | ##:: [[File:SmartEnvironment.jpg|65px]] [[Smart environment PRO]] |
− | "number":"3960"
| + | ##:: [[File:SmartAgriculture.png|65px]] [[Smart Agriculture]] |
− | },
| + | ##:: [[File:SmartWater.jpg|65px]] [[Smart Water]] |
− | <span style="color:red">//Id to uniquely identify a M2MBridge instance, in absence of this property a unique identifier gets created</span>
| + | ##:: [[File:SmartWaterIons.png|65px]] [[Smart Water Ions]] |
− | "bridgeId":"m2mBridgeProgressNext",
| + | ##:: [[File:SmartCities.jpg|65px]] [[Smart Cities]] |
− | <span style="color:red">//auto discover configuration</span>
| + | ##:: [[File:SmartParking.jpg|65px]] [[Smart Parking]] |
− | "autoDiscover":{
| + | ##:: [[File:SmartSecurity.jpg|65px]] [[Smart Security]] |
− | <span style="color:red">//create things type instances at startup time</span>
| + | ##:: [[File:Radiation.png|65px]] [[Radiation]] |
− | "execute" : false,
| + | ##:: [[File:AmbientControl.png|65px]] [[Ambient Control]] |
− | <span style="color:red">//Jsonld instances of the thing to be created </span>
| + | |
− | "instances":{
| + | |
− | <span style="color:red">//SNMPDeveice jsonld instance</span>
| + | |
− | "SNMPDevice":[
| + | |
− | {
| + | |
− | "setOIDs": "[{\"oid\":\".1.3.6.1.2.1.1.6.0\", \"type\":\"OctetString\", \"value\":\"Irvine California\"}]",
| + | |
− | "_lastmodified": 1450988442414,
| + | |
− | "guestusers": [],
| + | |
− | "@type": "/amtech/linkeddata/types/composite/entity/SNMPDevice",
| + | |
− | "_resourcestatus": "valid",
| + | |
− | "_name": "snmpClientM2mBridge",
| + | |
− | "getOIDs": "[{\"name\":\"memoryTotal\", \"oid\":\".1.3.6.1.4.1.2021.4.5.0\"}, {\"name\":\"memoryAvailable\", \"oid\":\".1.3.6.1.4.1.2021.4.6.0\"}]",
| + | |
− | "ipaddress": "localhost",
| + | |
− | "communityString": "private",
| + | |
− | "emaillist": "",
| + | |
− | "instanceobservationconfig": "{}",
| + | |
− | "creationDate": "2015-12-24T20:20:42.407Z",
| + | |
− | "readFrequency": "PT10M",
| + | |
− | "guesttenants": [
| + | |
− | "follower_m2mcreator@@amtech.mx"
| + | |
− | ],
| + | |
− | "description": "An SNMPDevice instance acting as SNMP manager/client proxying snmp commands (get/set/trups) to manager a ubuntu box hosting m2mbridge",
| + | |
− | "phonelist": "",
| + | |
− | "@id": "/amtech/things/entities/snmpClientM2mBridge",
| + | |
− | "snmpVersion": "2c",
| + | |
− | "_user": "m2mcreator@amtech.mx"
| + | |
− | }
| + | |
− | ], …
| + | |
− | }
| + | |
− | }
| + | |
− | | + | |
− | == Cloud Configuration ==
| + | |
− | * Create an "m2mBridge" actor (See [[Access control#Actors|Actors]])
| + | |
− | ** Add the things type polices the bridge needs access to
| + | |
− | ** Police must have user check; enabling instance access control by m2mBridge instance
| + | |
− | ** Include in the polices the thing types the bridge instantiates
| + | |
− | *Register a follower (See [[Access control#Actors|Roles]])
| + | |
− | ** Assign to follower actor "m2mBridge" access
| + | |
− | ** Uniquely identify each m2mBridge
| + | |
− | *Activity observation configuration (See [[Activities#Observation production configuration|Observation production configuration]])
| + | |
− | ** Add the Things types the bridge will use (See [[Activities#Thing types|Thing types]])
| + | |
− | *** Add the observations types from selected thing type the bridge will produce or consume (See [[Sensor's network#Observations and observation types|Observations and observation types]] [[Sensor's network#Crud observation|CRUD observations]])
| + | |
− | ** Configure the topic that m2mBridge will listen for crud and command observations has to matched with bridgeConfig.json property (See [[M2M Bridge#Edge Configuration|Edge Configuration]] [[Sensor's network#Topics|Topics]])
| + | |
− | <span style="color:red">//topic to get crud and command observations</span>
| + | |
− | "dap":{
| + | |
− | "crudCommandUrl" :"/xx/xx/"
| + | |
− | }
| + | |
− | *Things instance creation
| + | |
− | **Using amtech creator experience (See [[Activities#Thing types|Thing types]])
| + | |
− | **Configuring autoDiscover entry at bridgeConfig.json (See [[M2M Bridge#Edge Configuration|Edge Configuration]])
| + | |
− | | + | |
− | == Architecture ==
| + | |
− | *M2MBridge is an open source nodes stack developed by the AMTEch team; it discovers, loads nodes modules implementing "M2MBridge plugin interface" and creates thing types instances (See [[Activities#Thing types|Thing types]]) tacking into account the observation production configuration (See [[Activities#Observation production configuration|Observation production configuration]]) and M2MBridge credentials (See [[Access control#Actors|Actors]] and [[M2M Bridge#Edge Configuration|Edge Configuration]]).
| + | |
− | **It leverages AMTech IoT DAP integration guidelines to implement its functionality (See [[Integration Guideline|Integration Guideline]])
| + | |
− | ***Gets observation production configuration (See [[Integration Guideline#Get observation production configuration|Observation production configuration API]])
| + | |
− | ***Gets thing types instances (See [[Integration Guideline#Get instances by thing type|Observation instances API]])
| + | |
− | ***Creates a web socket to receive asynchronous commands and thing instances changes (crud operations) (See [[Integration Guideline#Get instances by thing type|Observation instances API]])
| + | |
− | ****Dispatch command observations to unique instance
| + | |
− | ****Restart instance when supported properties change by calling stop and star plugin interface
| + | |
− | ***Creates configuration information for Thing type leveraging configuration information and client side M2MBridge placeholders
| + | |
− | ***Load plugin nodes modules if required by configuration
| + | |
− | ***Creates an instance of plugin for each type from observation production configuration
| + | |
− | ***Creates a dispatcher observation with persistence to warranty the deliver of the message when network failed occurred.
| + | |
− | ****Injects sendObservation functionality to each plugin instance
| + | |
− | | + | |
− | == How to implement a new plugin ==
| + | |
− | *Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
| + | |
− | **at /.../M2MBridge/plugins create a directory that matched with the Thing type name to bridge example SNMPDevice (See [[Activities#Thing types|Thing types]])
| + | |
− | *Implement a nodejs module with the following interface
| + | |
− | function SNMPDevice() {
| + | |
− | }
| + | |
− | SNMPDevice.prototype.start = function ( context, complete) {
| + | |
− | try {
| + | |
− | complete(null);
| + | |
− | } catch (e) {
| + | |
− | complete(e);
| + | |
− | }
| + | |
− | };
| + | |
− | SNMPDevice.prototype.stop = function (complete) {
| + | |
− | try {
| + | |
− | complete(null);
| + | |
− | } catch (e) {
| + | |
− | complete(e);
| + | |
− | }
| + | |
− | };
| + | |
− | SNMPDevice.prototype.command = function (observation, complete) {
| + | |
− | try {
| + | |
− | complete(null);
| + | |
− | } catch (e) {
| + | |
− | complete(e);
| + | |
− | }
| + | |
− | };
| + | |
− | module.exports.SNMPDevice = SNMPDevice;
| + | |
− | | + | |
− | == How to install it ==
| + | |
− | *Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
| + | |
− | *Install nodejs https://nodejs.org/en/download/package-manager/
| + | |
− | *Install npm (http://blog.npmjs.org/post/85484771375/how-to-install-npm)
| + | |
− | *Delete at /.../M2MBridge/plugins/xxx unneeded plug-ins
| + | |
− | *Install packages for m2mBridge core and plug-ins (https://docs.npmjs.com/cli/install:)
| + | |
− | *Execute npm install at:
| + | |
− | **M2MBridge directory
| + | |
− | **each plug-in directory
| + | |
− | | + | |
− | == Existing plugins ==
| + | |
− | | + | |
− | === LLRPReader ===
| + | |
− | | + | |
− | === BLEPeripheralsScanner ===
| + | |
− | | + | |
− | === BLEbeaconsScanner ===
| + | |
− | | + | |
− | === SNMPDevice ===
| + | |
− | | + | |
− | === MQTTBroker ===
| + | |
− | | + | |
− | === COAP ===
| + | |