機械翻訳について

サンプル・デバイス・モデルのアップロード

「Oracle Fusion Cloud IoTインテリジェント・アプリケーション」サンプルを完成させるには、湿度および温度センサー・デバイス・モデルを「Oracle Fusion Cloud IoTインテリジェント・アプリケーション」インスタンスにアップロードする必要があります。

湿度デバイス・モデルは、5秒ごとに湿度の読み取り値を送信します。 最大閾値が設定されると、最大閾値および湿度レベルは、後続のデータ・メッセージに含まれます。 デフォルトの最大湿度しきい値の60%に達するかそれを超えると、アラートが送信されます。

温度デバイス・モデルは、5秒ごとに温度の読取り値を送信します。 デバイスの電源が入っているとき、および値が変更されたときはいつでも、発信データ・メッセージには最小値と最大値が含まれます。 最大または最小の温度閾値が設定されると、最大および最小の閾値および現在の温度が、後続のデータ・メッセージに含まれます。 最小または最大温度のしきい値に達するか超過すると、tooColdまたはtooHotアラートが送信されます。 オプションで、しきい値を警告メッセージに含めることができます(デフォルトはNO)。 最小および最大温度のデフォルトのしきい値は0と65度です。

REST起動が起動されると、最小および最大温度値が現在の温度にリセットされます。 デバイスがオフになると、データとアラート・メッセージはオンになるまで送信されません。

  1. テキスト・エディタを開きます。
  2. このテキストをコピーして、湿度センサー・デバイス・モデルのテキスト・エディタに貼り付けます:
    {
        "urn": "urn:com:oracle:iot:device:humidity_sensor",
        "name": "Humidity Sensor",
        "description": "Device model for sensor that measures humidity.",
        "attributes": [
            {
                "name": "humidity",
                "description": "Measures humidity between 0% and 100%",
                "type": "INTEGER",
                "range": "0,100"
            },
            {
                "name": "maxThreshold",
                "description": "Maximum humidity threshold",
                "type": "INTEGER",
                "range": "60,100",
                "writable": true,
                "defaultValue":80
            }
        ],
        "formats": [
            {
                "urn": "urn:com:oracle:iot:device:humidity_sensor:too_humid",
                "name": "tooHumidAlert",
                "description": "Sample alert when humidity reaches the maximum humidity threshold",
                "type": "ALERT",
                "value": {
                    "fields": [
                        {
                            "name": "humidity",
                            "type": "INTEGER",
                            "optional": false
                        }
                    ]
                }
            }
        ]
    }
  3. ファイルをHumiditySensor.jsonとして保存し、テキスト・エディタを閉じます。
  4. コマンド・プロンプトを開き、このcurlコマンドを実行して、湿度センサー・デバイス・モデルをOracle Fusion Cloud IoTインテリジェント・アプリケーションインスタンスにアップロードします:
    curl -k -u "<username>:<password>" https://<your_Oracle_IoT_CloudService_instance>:<instance_port_number>/iot/api/v2/deviceModels -X POST -d @HumiditySensor.json -H "Content-Type:application/json" -H "Accept:application/json"
    <username><password><your_Oracle_IoT_CloudService instance>および<instance_port_number>の変数を環境に合わせた値に置き換えます。 たとえば:
    curl -k -u "joeuser@xyz.com:password" https://myiotserver.com:7105/iot/api/v2/deviceModels -X POST -d @HumiditySensor.json -H "Content-Type:application/json" -H "Accept:application/json"
  5. テキスト・エディタを開きます。
  6. このテキストをコピーして、温度センサー・デバイス・モデルのテキスト・エディタに貼り付けます:
    {
        "urn": "urn:com:oracle:iot:device:temperature_sensor",
        "name": "Temperature Sensor",
        "description": "Device model for sensor that measures temperature.",
        "attributes": [
            {
                "name": "temp",
                "description": "Measures temperature value between -20 and +80 Cel",
                "range": "-20,80",
                "type": "NUMBER"
            },
            {
                "name": "unit",
                "description": "Measurement unit, such as Cel for Celsius.",
                "type": "STRING",
                "defaultValue":"C"
            },
            {
                "name": "minTemp",
                "alias": "minimumTemperature",
                "description": "The minimum value measured by the sensor since power ON or reset",
                "type": "NUMBER"
            },
            {
                "name": "maxTemp",
                "alias": "maximumTemperature",
                "description": "The maximum value measured by the sensor since power ON or reset",
                "type": "NUMBER"
            },
            {
                "name": "minThreshold",
                "description": "The minimum temperature threshold",
                "type": "INTEGER",
                "range": "-20,0",
                "writable": true,
                "defaultValue":0
            },
            {
                "name": "maxThreshold",
                "description": "The maximum temperature threshold",
                "type": "INTEGER",
                "range": "65,80",
                "writable": true,
                "defaultValue":70
            },
            {
                "name": "startTime",
                "description": "The time (measured in EPOCH) at which the system was powered ON or reset",
                "type": "DATETIME"
            }
        ],
        "actions": [
            {
                "name": "reset",
                "description": "Reset the minimum and maximum measured values to current value"
            },
            {
                "name": "power",
                "description": "Turns system ON or OFF",
                "argType": "BOOLEAN"
            }
        ],
        "formats": [
            {
                "urn": "urn:com:oracle:iot:device:temperature_sensor:too_hot",
                "name": "tooHotAlert",
                "description": "Temperature has reached the maximum temperature threshold",
                "type": "ALERT",
                "value": {
                    "fields": [
                        {
                            "name": "temp",
                            "type": "NUMBER",
                            "optional": false
                        },
                        {
                            "name": "unit",
                            "type": "STRING",
                            "optional": false
                        },
                        {
                            "name": "maxThreshold",
                            "type": "NUMBER",
                            "optional": true
                        }
                    ]
                }
            },
            {
                "urn": "urn:com:oracle:iot:device:temperature_sensor:too_cold",
                "name": "tooColdAlert",
                "description": "Temperature has reached the minimum temperature threshold",
                "type": "ALERT",
                "value": {
                    "fields": [
                        {
                            "name": "temp",
                            "type": "NUMBER",
                            "optional": false
                        },
                        {
                            "name": "unit",
                            "type": "STRING",
                            "optional": false
                        },
                        {
                            "name": "minThreshold",
                            "type": "NUMBER",
                            "optional": true
                        }
                    ]
                }
            }
        ]
    }
  7. ファイルをTemperatureSensor.jsonとして保存し、テキスト・エディタを閉じます。
  8. コマンド・プロンプトを開き、このcurlコマンドを実行して、温度センサー・デバイス・モデルをOracle Fusion Cloud IoTインテリジェント・アプリケーションにアップロードします:
    curl -k -u "<username>:<password>" https://<your_Oracle_IoT_CloudService_instance>:<instance_port_number>/iot/api/v2/deviceModels -X POST -d @TemperatureSensor.json -H "Content-Type:application/json" -H "Accept:application/json"
    <username><password><your_Oracle_IoT_CloudService instance>および<instance_port_number>変数を環境の値に置き換えます。 たとえば:
    curl -k -u "joeuser@abc.com:password" https://myiotserver.com:7105/iot/api/v2/deviceModels -X POST -d @TemperatureSensor.json -H "Content-Type:application/json" -H "Accept:application/json"