Perseus CEP 中的日期时间
DataTime in Perseo CEP
我正在使用 CEP 以更新模式修改类型日期字段。
实体:
{
"id":"controller",
"type":"control",
"lasmodify":{
"type":"DataTime",
"value":""
}
}
{
"id":"Device01",
"type":"device",
"id_controller":{
"type":"Text",
"value":"controller01"
}
"datemodify":{
"type":"DataTime",
"value":"2018-12-04T20:05:00.00Z"
}
}
我要拍摄Device01订阅,controller01属性lasmodify会被device01实体的datemodify修改。
非常感谢您
此致。
如果我没理解错的话,您想在 CEP 收到设备更改通知时更新控制器。
解决方案应该类似于此规则:
{
"name":"update_rule",
"text":"select ev.controler? as controlerID, ev.datemodify? as newDate, \"update_rule\" as ruleName from pattern [every ev=iotEvent(type=\"device\")]",
"action":{
"type":"update",
"parameters":{
"id":"${controlerID}",
"type":"control",
"attributes": [
{
"name":"lasmodify",
"type":"DataTime"
"value":"${newDate}"
}
]
}
}
}
我不知道您使用的是什么版本的 Perseo,但是使用 perseo-fe and perseo-core 的最新固件映像,您可以省略规则名称并使用 NGSIv2
{
"name":"update_rule",
"text":"select ev.controler? as controlerID, ev.datemodify? as newDate from pattern [every ev=iotEvent(type=\"device\")]",
"action":{
"type":"update",
"parameters":{
"id":"${controlerID}",
"type":"control",
"version": "2",
"attributes": [
{
"name":"lasmodify",
"type":"DataTime"
"value":"${newDate}"
}
]
}
}
}
我正在使用 CEP 以更新模式修改类型日期字段。
实体:
{
"id":"controller",
"type":"control",
"lasmodify":{
"type":"DataTime",
"value":""
}
}
{
"id":"Device01",
"type":"device",
"id_controller":{
"type":"Text",
"value":"controller01"
}
"datemodify":{
"type":"DataTime",
"value":"2018-12-04T20:05:00.00Z"
}
}
我要拍摄Device01订阅,controller01属性lasmodify会被device01实体的datemodify修改。
非常感谢您 此致。
如果我没理解错的话,您想在 CEP 收到设备更改通知时更新控制器。 解决方案应该类似于此规则:
{
"name":"update_rule",
"text":"select ev.controler? as controlerID, ev.datemodify? as newDate, \"update_rule\" as ruleName from pattern [every ev=iotEvent(type=\"device\")]",
"action":{
"type":"update",
"parameters":{
"id":"${controlerID}",
"type":"control",
"attributes": [
{
"name":"lasmodify",
"type":"DataTime"
"value":"${newDate}"
}
]
}
}
}
我不知道您使用的是什么版本的 Perseo,但是使用 perseo-fe and perseo-core 的最新固件映像,您可以省略规则名称并使用 NGSIv2
{
"name":"update_rule",
"text":"select ev.controler? as controlerID, ev.datemodify? as newDate from pattern [every ev=iotEvent(type=\"device\")]",
"action":{
"type":"update",
"parameters":{
"id":"${controlerID}",
"type":"control",
"version": "2",
"attributes": [
{
"name":"lasmodify",
"type":"DataTime"
"value":"${newDate}"
}
]
}
}
}