Engineering-Research-and-Development / iotagent-opcua

IoT Agent for OPC UA protocol
https://iotagent-opcua.rtfd.io/
GNU Affero General Public License v3.0
41 stars 21 forks source link

Create metadata in OCB #128

Closed manolait closed 6 months ago

manolait commented 7 months ago

Hi,

I would like to know if there is an option to create metadata in our OPC-UA server such as maintenance, sensor installation date, installation place, etc. All this within the same node as fields and that the OPC-UA translator is responsible for generating these fields as metadata in the FIWARE understandings.

This would allow us to have, for example, the following information:

[
  {
    "id": "191",
    "type": "Station",
    "CE_del_medio": {
      "type": "float",
      "value": 0.81,
      "metadata": {
        "id": {
          "type": "String",
          "value": "15"
        },
        "img": {
          "type": "String",
          "value": "assets/img/contrast.png"
        },
        "manufacturer": {
          "type": "String",
          "value": "Hortisis"
        },
        "medida": {
          "type": "String",
          "value": "mS/cm"
        },
        "name_comun": {
          "type": "String",
          "value": "CE del medio"
        },
        "place": {
          "type": "String",
          "value": "interior"
        },
        "timestamp": {
          "type": "DateTime",
          "value": "2023-09-18T00:20:30.00Z"
        },
        "type": {
          "type": "String",
          "value": "fertigation"
        }
      }
    },
    "CE_suelo": {
      "type": "float",
      "value": 3.14,
      "metadata": {
        "id": {
          "type": "String",
          "value": "8"
        },
        "img": {
          "type": "String",
          "value": "assets/img/flash.png"
        },
        "manufacturer": {
          "type": "String",
          "value": "Hortisis"
        },
        "medida": {
          "type": "String",
          "value": "mS/cm"
        },
        "name_comun": {
          "type": "String",
          "value": "CE suelo"
        },
        "place": {
          "type": "String",
          "value": "interior"
        },
        "timestamp": {
          "type": "DateTime",
          "value": "2023-09-18T00:20:30.00Z"
        },
        "type": {
          "type": "String",
          "value": "fertigation"
        }
      }
    },
    "CO2": {
      "type": "float",
      "value": 473,
      "metadata": {
        "id": {
          "type": "String",
          "value": "21"
        },
        "img": {
          "type": "String",
          "value": "assets/img/co264.png"
        },
        "manufacturer": {
          "type": "String",
          "value": "Hortisis"
        },
        "medida": {
          "type": "String",
          "value": "ppm"
        },
        "name_comun": {
          "type": "String",
          "value": "CO2"
        },
        "place": {
          "type": "String",
          "value": "interior"
        },
        "timestamp": {
          "type": "DateTime",
          "value": "2023-09-18T00:20:30.00Z"
        },
        "type": {
          "type": "String",
          "value": "clima"
        }
      }
    },
    "Def_vapor_de_presion": {
      "type": "float",
      "value": 0.495939146,
      "metadata": {
        "id": {
          "type": "String",
          "value": "43"
        },
        "img": {
          "type": "String",
          "value": "assets/img/humidity.png"
        },
        "manufacturer": {
          "type": "String",
          "value": "Hortisis"
        },
        "medida": {
          "type": "String",
          "value": "kPa"
        },
        "name_comun": {
          "type": "String",
          "value": "Def vapor de presión"
        },
        "place": {
          "type": "String",
          "value": "interior"
        },
        "timestamp": {
          "type": "DateTime",
          "value": "2023-09-18T00:20:30.00Z"
        },
        "type": {
          "type": "String",
          "value": "clima"
        }
      }
    },
    "Hum_relativa": {
      "type": "float",
      "value": 82.2,
      "metadata": {
        "id": {
          "type": "String",
          "value": "3"
        },
        "img": {
          "type": "String",
          "value": "assets/img/hum.png"
        },
        "manufacturer": {
          "type": "String",
          "value": "Hortisis"
        },
        "medida": {
          "type": "String",
          "value": "%"
        },
        "name_comun": {
          "type": "String",
          "value": "Hum relativa"
        },
        "place": {
          "type": "String",
          "value": "interior"
        },
        "timestamp": {
          "type": "DateTime",
          "value": "2023-09-18T00:20:30.00Z"
        },
        "type": {
          "type": "String",
          "value": "clima"
        }
      }
    }
  }
]

Best regards and thank you.

manfredipist commented 6 months ago

Hello @manolait, you can have a look at the OPC UA server we developed to test the functionalities of our IoTAgent OPC UA (https://github.com/Engineering-Research-and-Development/opc-ua-car-server) in which the object Engine has serveral sub attributes. You could implement the same logic in your OPC UA server to store your desired metadata.