Условие подписки посредника Fiware Orion не работает
Я использую Orion Context Broker версии 1.1.0
У меня была единственная сущность в моей БД:
{
"id"=>"Room1",
"type"=>"Room",
"temperature"=>{"type"=>"none", "value"=>10, "metadata"=>{}}
}
У меня не было ни одногоsubscription
.
Тогда я создал 3subscriptions
:
[
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature>10"}}}
},
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature<10"}}}
},
{
"subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature==10"}}}
}
]
Как видите, разница только в выражениях:Температура> 10, Температура <10, Температура == 10.
Так что в любое время я меняюRoom1 температура У меня должен быть только одинsubscription
запуск уведомления.
Но это не работает как надо !!!
Каждый раз, когда я меняютемператураУ меня есть все 3 уведомления.
Однако когдаsubscriptions
были созданы, только один из них вызвал уведомление, в зависимости отtemperature
стоимость комнаты1. Сработало как положено.
Но когдаRoom1 temperature
изменен, он не работает правильно и вызывает все 3 уведомления.
Редактировать: Полный вывод операции GET / v2 / subscription:
[
{
"id"=>"574716a22fe8cdc00a696a94",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature>10"}}
},
"notification"=>{"attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5
},
{
"id"=>"574716a22fe8cdc00a696a95",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature<10"}}
},
"notification"=>{"attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5},
{
"id"=>"574716a22fe8cdc00a696a96",
"expires"=>"2017-04-05T14:00:00.00Z",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}],
"condition"=>{"attrs"=>["temperature"],
"expression"=>{"q"=>"temperature==10"}}
},
"notification"=>{"timesSent"=>2, "lastNotification"=>"2016-05-26T15:30:42.00Z", "attrs"=>["temperature"], "http"=>{"url"=>"http://localhost:1028/accumulate"}},
"throttling"=>5
}
]
Edit2: Добавьте сценарий:
ИзмененоRoom1 temperature
до 11Был такой же вывод, но[...{"timesSent"=>1}..., ...{"timesSent"=>1}..., ...{"timesSent"=>3}...]
ИзмененоRoom1 temperature
до 10Был такой же вывод, но[...{"timesSent"=>2}..., ...{"timesSent"=>2}..., ...{"timesSent"=>4}...]
ИзмененоRoom1 temperature
до 9Был такой же вывод, но[...{"timesSent"=>3}..., ...{"timesSent"=>3}..., ...{"timesSent"=>5}...]