Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD NGSI attribute custom node #60

Merged
merged 2 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ images/
*.png
*.gif
*.bmp
yarn.lock
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## node-red-contrib-letsfiware-NGSI v0.7.1-next

- ADD NGSI attribute custom node (#60)
- ADD NGSI attributes custom node (#58)
- FIX node name (#56)
- ADD NGSI attribute value custom node (#55)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Node-RED implementation for FIWARE Open APIs
- [NGSI Entity CRUD](docs/custom_nodes/ngsi_entity_crud.md)
- [NGSI Source](docs/custom_nodes/ngsi_source.md)
- [NGSI Attributes](docs/custom_nodes/ngsi_attributes.md)
- [NGSI Attribute](docs/custom_nodes/ngsi_attribute.md)
- [NGSI Attribute value](docs/custom_nodes/ngsi_attribute_value.md)
- [NGSI Batch update](docs/custom_nodes/ngsi_batch_update.md)
- [NGSI Subscription](docs/custom_nodes/ngsi_subscription.md)
Expand Down
251 changes: 251 additions & 0 deletions docs/custom_nodes/ngsi_attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
# NGSI attribute

This custom node is a simple node that allows to read, update or delete an attribute in NGSIv2 entity.

![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/attribute-01.png)

## Read an attribute

It alows to read an attribute in NGSIv2 entity.

### Properties

![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/attribute-02.png)

- `name`: A name for a node instance
- `Context Broker`: An endpoint of a context broker
- `ServicePath`: FIWARE Service Path
- `Action type`: read
- `Entity id`: Entity id to read an attribute
- `Entity type`: Entity type to read an attribute
- `Attribute name`: Name of attribute name to read
- `Metadata`: List of metadata names
- `Skip forwarding`: If true, Context Broker skips forwarding to Context Providers

### Exmaple

#### Input

Payload *JSON Object*

A `msg.payload` should contain information related to the attribute to be read.

```
{}
```

```
{
"attrName": "relativeHumidity"
}
```

```
{
"id": "E",
"type": "T",
"attrName": "relativeHumidity"
}
```

#### Output

Payload *JSON Object*

A `msg.payload` contains an object representing the attribute.

```
{
"type":"Number",
"value":45,
"metadata":{}
}
```

## Update an attribute

It alows to update an attributes in NGSIv2 entity.

### Properties

![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/attribute-03.png)

- `name`: A name for a node instance
- `Context Broker`: An endpoint of a context broker
- `ServicePath`: FIWARE Service Path
- `Action type`: update
- `Entity id`: Entity id to update an attributes
- `Entity type`: Entity type to update an attributes
- `Attribute name`: Name of attribute name to update
- `Override metadata`: If true, replace the existing metadata
- `Forced update`: If true, it triggers matching subscriptions
- `Flow control`: If true, it enables flow control mechanism

### Exmaple

#### Input

Payload *JSON Object*

A `msg.payload` should contain an object representing the attribute to be updated.

```
{
"type": "Number",
"value": 1234.5
}
```

#### Output

Payload *null or number*

A `msg.payload` contains a status code.

```
204
```

```
null
```

## Delete an attribute

It alows to delete an attribute in NGSIv2 entity.

### Properties

![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/attribute-04.png)

- `name`: A name for a node instance
- `Context Broker`: An endpoint of a context broker
- `ServicePath`: FIWARE Service Path
- `Action type`: upsert
- `Entity id`: Entity id to delete an attributes
- `Entity type`: Entity type to delete an attributes
- `Attribute name`: Name of attribute name to delete

### Exmaple

#### Input

Payload *JSON Object*

A `msg.payload` should contain information related to the attribute to be deleted.

```
{}
```

```
{
"attrName": "relativeHumidity"
}
```

```
{
"id": "E",
"type": "T",
"attrName": "relativeHumidity"
}
```


#### Output

Payload *null or string*

A `msg.payload` contains a status code.

```
204
```

```
null
```

## Use value of actionType in payload

It alows to read, update or delete an attribute in NGSIv2 entity.

### Properties

![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/attribute-05.png)

- `name`: A name for a node instance
- `Context Broker`: An endpoint of a context broker
- `ServicePath`: FIWARE Service Path
- `Action type`: value of actionType in payload
- `Entity id`: Entity id to read, update or delete an attribute
- `Entity type`: Entity type to read, update or delete an attribute
- `Attribute name`: Name of attribute name to read, update or delete
- `Metadata`: List of metadata names
- `Skip forwarding`: If true, Context Broker skips forwarding to Context Providers
- `Override metadata`: If true, replace the existing metadata
- `Forced update`: If true, it triggers matching subscriptions
- `Flow control`: If true, it enables flow control mechanism

### Exmaple

#### Input

Payload *JSON Object*

When reading an attribute, A `msg.payload` should contain a JSON Object with `actionType` and related information the attribute to be read.

```
{
"actionType": "read",
"attrName": "relativeHumidity"
}
```

When updating an attribute, A `msg.payload` should contain a JSON Object with `actionType` and `attribute`.

```
{
"actionType": "update",
"attribute": {
"type": "Number",
"value": 1234.5
}
}
```

When deleting an attribute, A `msg.payload` should contain a JSON Object with `actionType` and related information the attribute to be deleted.

```
{
"actionType": "read",
"attrName": "relativeHumidity"
}
```

#### Output

Payload *JSON Object*

When reading the attribute, a `msg.payload` contains an object representing the attribute.

```
{
"type":"Number",
"value":45,
"metadata":{}
}
```

Payload *null or number*

When updating and deleting an attribute, a `msg.payload` contains a status code.

```
204
```

```
null
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Node-RED NGSI integration
- [NGSI Entity CRUD](custom_nodes/ngsi_entity_crud.md)
- [NGSI Source](custom_nodes/ngsi_source.md)
- [NGSI Attributes](custom_nodes/ngsi_attributes.md)
- [NGSI Attribute](custom_nodes/ngsi_attribute.md)
- [NGSI Attribute value](custom_nodes/ngsi_attribute_value.md)
- [NGSI Batch update](custom_nodes/ngsi_batch_update.md)
- [NGSI Subscription](custom_nodes/ngsi_subscription.md)
Expand Down
Loading