telefonicaid / iotagent-json

IoT Agent for a JSON based protocol (with HTTP, MQTT and AMQP transports)
https://fiware-iotagent-json.rtfd.io/
GNU Affero General Public License v3.0
51 stars 88 forks source link

Implement passive attributes (AKA lazy attributes) #89

Open dmoranj opened 8 years ago

dmoranj commented 8 years ago

This IoTA does not yet support lazy attributes but it support a very similar mechanism based on subscriptions and explicit requests from the device to retrieve information from the Context Broker. It should be easy to modify the configuration mechanism to allow lazy attributes (and consequently, commands), to be used with this IoTA.

ezequiel-umu commented 8 years ago

May I ask which is this very similar mechanism?

dmoranj commented 8 years ago

Of course :) I was talking about what's referred in the protocol as Configuration Retrieval. That's a mechanism that lets the device ask the IoT Agent for particular pieces of information, that the IoT will read, in turn from the Context Broker (both things asynchronously, of course). This mechanism currently works with on single requests from the device, but I'm working on a feature to enable subscriptions to particular pieces of information (this functionality has already been implemented in the IoT Agent Library). Processing a notification and a relayed Context Provisioning request are quite similar tasks, and probably could be dealt with using the same functions with not so many changes.

drasko commented 8 years ago

@dmoranj do you have in mind that device subscribes to the topic /{{apikey}}/{{deviceid}}/commands and listen here for the command coming from Orion, and then respond to this command via /{{apikey}}/{{deviceid}}/replies?

dmoranj commented 8 years ago

Mostly yes. I will probably change the subscription topic, as I prefer to have one-way tokens to ease the creation of ACLs in the MQTT broker, but it will work that way: the client subscribes to a topic where the commands will arrive, and will reply to another topic. In fact, this functionality has been implemented for the MQTT transport of the Ultralight IoT Agent, as you can see here, so most probably we will reuse those topics.

amfgomez commented 6 years ago

Hello, I have a sensor-actuator registered in orion using iot-agent and I created the subscription.

If a third party application modifies a sensor value, orion must send iot-agent information and iot-agent to the device.

For example, if I have 3 attributes inside the sensor and one of them controls a valve. In orion that attribute is true or false. If the attribute is modified in orion must be sent to IOT-agent and IOT-agent to the device to close or open the valve Is it possible?

fgalan commented 6 years ago

@amfgomez what you describe seems to be a question about IOTA-CB integration rather than a comment on the issue of passive attributes. I'd suggest to use StackOverflow to post such question: https://stackoverflow.com/questions/ask. Please, use the "fiware" label. Thanks!

amfgomez commented 6 years ago

https://stackoverflow.com/questions/52499615/modify-attribute-on-device-by-iot-agent-json

fgalan commented 5 years ago

https://github.com/telefonicaid/iotagent-json/blob/master/docs/usermanual.md includes this note:

IMPORTANT NOTE: current version of the agent only supports active attributes, i.e. those attributes actively reported by the device to the agent. Passive or lazy attributes, i.e. those attributes whose value is only given upon explicit request from the agent, are not implemented. Please check the issue #89 for more details and updates regarding its implementation.

That note should be removed once this issue gets completed.