ExoHome Device Report Config¶
Report config defines how often a device reports data to cloud. You can separate data fields into different groups based on data type. Currently, we support the report behavior below.
- Anychange: Device will report the value of the data fields to cloud when there is a status change.
- Period: Device will report the value of the data fields to cloud periodically according to the defined period.
- Schedule: Device will report the value of the data fields to cloud at the scheduled time.
- Subscribe: Device will report the value of the data fields to cloud when receiving subscribe action.
Please define the "param" in 24-hour clock format with hour and minute.
Report Config Definition and Specification¶
type: array
items:
type: object
properties:
type:
type: string
enum:
- anychange
- period
- schedule
- subscribe
type: array
items:
type: object
properties:
type:
type: string
enum:
- anychange
- period
- schedule
- subscribe
param:
type: number
description: millisecond for period type. 'HH:MM' for schedule type. not applicable for anychange and subscribe type.
history:
type: boolean
description: true means the device should queue the data during offline. false means only need to report when device is online. not applicable for anychange and subscribe type.
fields:
type: array
description: The data of fields listed in the array should be reported as defined timing
items:
type: string
description: The name of the field
Report Config Example¶
Example:
[
{"type":"period","param":1800000, "history":true, "fields":["H00","H01","H02","H03","H04","H05","H06","H07","H08","H09","H10","H11","H12","H13","H14","H15","H16","H17","H18","H19","H20","H21","H22","H23","H24","H25","H26","H27","H28"]},
{"type":"period","param":300000, "fields":["H00","H01","H02","H03","H04","H05","H06","H07","H08","H09","H10","H11","H12","H13","H14","H15","H16","H17","H18","H19","H20","H21","H22","H23","H24","H25","H26","H27","H28","H30","H31"]},
{"type":"schedule","param":"12:00", "history":true, "fields":["H29"]},
{"type":"anychange","fields":["H00","H01","H02","H03","H04","H05","H06","H07","H08","H09","H10","H11","H12","H13","H14","H15","H16"]},
{"type":"subscribe","fields":["H00","H01"]}
]
Upload Historical Data to Cloud¶
If you want to queue the "period" or "schedule" data during device offline and upload the data when the device is online again. Please follow "to historical timestamps" of "Report Data" section in Murano MQTT to report offline data via $resource.batch MQTT topic. For each data record, the data should be put in values as the value of states attribute and JSON.stringify encoded.
Example history data¶
[{"timestamp":1549941719000,"values":{"states":"{\"H00\":1,\"H01\":2}"}},{"timestamp":1549941722000,"values":{"states":"{\"H00\":0,\"H01\":5}"}}]