Closed StefanoMartin closed 2 years ago
In version 2.0 of the status schema, the type is from the old system and it needs to be updated if we are going to use it. @StefanoMartin what do you think about changing it?
A summary about the last videocall on this issue.
It will be possible to create status under a value
Status will have the following structure:
{
"id" : "status.json",
"$schema" : "http://json-schema.org/draft-04/schema#",
"title" : "status-2.0",
"type" : "object",
"properties" : {
"message" : {"type": "string"},
"timestamp": {
"$ref": "../../../core/validation/2.0/util/types.json#/time"
},
"info": {"type": "object"},
"data" : {"type": "string"},
"level" : {
"type": "string",
"enum": ["important", "error", "warning", "info", "debug"]
},
"type" : {
"type": "string"
},
"meta" : {"type": "object"}
},
"additionalProperties": false,
"required" : ["message", "level"]
}
The differences are the following:
Add methods to handle creation of statuses, like: value.setStatus, value.statuses, value.onStatus (maybe also under device)
Change state's status to 'pending' when value.control() is used
Change state's status to 'send' or to 'failed' at the end of value.onControl() <-- Add also some method to permit to do outside of onControl()
Change state's status to 'send' when value.report() is used <--- My note: Is it really necessary?
Add an option to change error status as a string.
Either this option should be in state under status ("Send", "Pending", "Failed") + a new feature that includes the reason of the error. Or we need possibility to create status error at device level.