Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 1 | { |
| 2 | "host": "127.0.0.1", |
| 3 | "port": "5000", |
| 4 | "mapping":[ |
| 5 | { |
| 6 | "endpoint": "/device1", |
| 7 | "HTTPMethods": [ |
| 8 | "POST" |
| 9 | ], |
| 10 | "security": |
| 11 | { |
| 12 | "type": "basic", |
| 13 | "username": "user", |
| 14 | "password": "passwd" |
| 15 | }, |
| 16 | "converter": { |
| 17 | "type": "json", |
| 18 | "deviceNameExpression": "Device ${name}", |
| 19 | "deviceTypeExpression": "default", |
| 20 | "attributes": [ |
| 21 | { |
| 22 | "type": "string", |
| 23 | "key": "model", |
| 24 | "value": "${sensorModel}" |
| 25 | } |
| 26 | ], |
| 27 | "timeseries": [ |
| 28 | { |
| 29 | "type": "double", |
| 30 | "key": "${sensorModel}", |
| 31 | "value": "${temp}" |
| 32 | }, |
| 33 | { |
| 34 | "type": "double", |
| 35 | "key": "humidity", |
| 36 | "value": "${hum}" |
| 37 | } |
| 38 | ] |
| 39 | } |
| 40 | }, |
| 41 | { |
| 42 | "endpoint": "/anon1", |
| 43 | "HTTPMethods": [ |
| 44 | "GET", |
| 45 | "POST" |
| 46 | ], |
| 47 | "security": |
| 48 | { |
| 49 | "type": "anonymous" |
| 50 | }, |
| 51 | "converter": { |
| 52 | "type": "json", |
| 53 | "deviceNameExpression": "Device 2", |
| 54 | "deviceTypeExpression": "default", |
| 55 | "attributes": [ |
| 56 | { |
| 57 | "type": "string", |
| 58 | "key": "model", |
| 59 | "value": "Model2" |
| 60 | } |
| 61 | ], |
| 62 | "timeseries": [ |
| 63 | { |
| 64 | "type": "double", |
| 65 | "key": "temperature", |
| 66 | "value": "${temp}" |
| 67 | }, |
| 68 | { |
| 69 | "type": "double", |
| 70 | "key": "humidity", |
| 71 | "value": "${hum}" |
| 72 | } |
| 73 | ] |
| 74 | } |
| 75 | }, |
| 76 | { |
| 77 | "endpoint": "/anon2", |
| 78 | "HTTPMethods": [ |
| 79 | "POST" |
| 80 | ], |
| 81 | "security": |
| 82 | { |
| 83 | "type": "anonymous" |
| 84 | }, |
| 85 | "converter": { |
| 86 | "type": "custom", |
| 87 | "deviceNameExpression": "SuperAnonDevice", |
| 88 | "deviceTypeExpression": "default", |
| 89 | "extension": "CustomRestUplinkConverter", |
| 90 | "extension-config": [ |
| 91 | { |
| 92 | "key": "Totaliser", |
| 93 | "datatype": "float", |
| 94 | "fromByte": 0, |
| 95 | "toByte": 4, |
| 96 | "byteorder": "big", |
| 97 | "signed": true, |
| 98 | "multiplier": 1 |
| 99 | }] |
| 100 | } |
| 101 | } |
| 102 | ], |
| 103 | "attributeUpdates": [ |
| 104 | { |
| 105 | "HTTPMethod": "POST", |
| 106 | "SSLVerify": false, |
| 107 | "httpHeaders": { |
| 108 | "CONTENT-TYPE": "application/json" |
| 109 | }, |
| 110 | "security": { |
| 111 | "type": "basic", |
| 112 | "username": "user", |
| 113 | "password": "passwd" |
| 114 | }, |
| 115 | "timeout": 0.5, |
| 116 | "tries": 3, |
| 117 | "allowRedirects": true, |
| 118 | "deviceNameFilter": ".*REST$", |
| 119 | "attributeFilter": "data", |
| 120 | "requestUrlExpression": "sensor/${deviceName}/${attributeKey}", |
| 121 | "valueExpression": "{\"${attributeKey}\":\"${attributeValue}\"}" |
| 122 | } |
| 123 | ], |
| 124 | "serverSideRpc": [ |
| 125 | { |
| 126 | "deviceNameFilter": ".*", |
| 127 | "methodFilter": "echo", |
| 128 | "requestUrlExpression": "http://127.0.0.1:5001/${deviceName}", |
| 129 | "responseTimeout": 1, |
| 130 | "HTTPMethod": "GET", |
| 131 | "valueExpression": "${params}", |
| 132 | "timeout": 0.5, |
| 133 | "tries": 3, |
| 134 | "httpHeaders": { |
| 135 | "Content-Type": "application/json" |
| 136 | }, |
| 137 | "security": { |
| 138 | "type": "anonymous" |
| 139 | } |
| 140 | }, |
| 141 | { |
| 142 | "deviceNameFilter": ".*", |
| 143 | "methodFilter": "no-reply", |
| 144 | "requestUrlExpression": "sensor/${deviceName}/request/${methodName}/${requestId}", |
| 145 | "HTTPMethod": "POST", |
| 146 | "valueExpression": "${params}", |
| 147 | "httpHeaders": { |
| 148 | "Content-Type": "application/json" |
| 149 | } |
| 150 | } |
| 151 | ] |
| 152 | } |