简体   繁体   中英

Fiware-Orion - How to work with attributes values history (lists of values)

I want to register some entities in my Orion instance and keep the history of attributes values in a way I can get the list of values of this attributes.

For example, a sensor S1 measuring temperature of a room hourly should keep a list of values in its temperature attribute in a way that every new update should be added in the end of the list.

The update operation I am doing now only updates the value, without adding it to some "list". I've read the documentation, but I did not find out some useful information about this. Does anyone have suggestions?

that's a good question. You have different options:

1/ Use the STH component to deal with time data series https://github.com/Fiware/context.STH.Comet

2/ Model your entities in Orion using a similar pattern to the one used by the FIWARE Data Models "AirQualityObserved" or "WeatherObserved"

http://fiware-datamodels.readthedocs.io/en/latest/Environment/AirQualityObserved/doc/spec/index.html

ie create one entity for each observation and tag it with a "dateObserved" property. Then you can do queries like

http://orion:1026/v2/entities?type=TemperatureObserved&q=room:R1;dateObserved >=2017-01-01&options=values&orderBy=dateObserved

This will provide an ordered array of temperature values measured since the first of January.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM