New Feature Proposal:
I'd like to see an enhanced ASCII / Telnet interface using a JSON format for the data.
This could be carried on a separate port number from the current JSON data so that it could be distinguished from the current ASCII port.
Currently, when a command is sent over the Telnet interface, you typically get back an "OK" or an error, but it isn't always clear which command that "OK" responds to. This creates a tracking problem if the program that is interfacing with HomeSeer operates asynchronously (e.g., a Javascript program). So, as a starting point, it would be beneficial if the telnet interface passed a hash token back and forth so that commands / responses can be tracked. That is, each time a command is sent to HomeSeer, the program sending the command will specify a "hash" value (which can be any program-selected value as long as all outstanding hash values are unique). When HomeSeer responds to the command, it will include that hash value in its response.
For example, sending a command would involve send a JSON structure along the following lines:
{
"command": "command"
"reference": reference:
"value": XXX
"hash": "XXX"
}
There may also be a similar structure using a value_label instead of a numeric value.
In response, you would get back a report:
{
"report type": "command_result",
"result": " string",
"value_sent", original_sent_value
"result value": new_device_value
"hash": "XXX"
}
Where "result" would be the response message - e.g., "OK" or an error message.
I suggest reporting both the "original_sent_value" and "new_device_value" as this is useful where, for example, you send a "255" to a dimmer (last value) resulting in a report that the new dimmer has responded but it was set to "55" as the new value.
For commands that take a long time to process (for example, a "last value" sent to a dimmer), you could consider a two-stage report.
a) a "command pending" report including the original hash which indicates that the command was received but processing is not complete, and then
b) a "command_result" report when the command finishes-- the result report would then include the new value.
Autonymous reports (i.e., those sent when the value of a HomeSeer device changes from the HomeSeer) could be something like:
{
"report_type": "Device Report",
"reference": XXX
"time": (epoch time when new value was set)
"new_value": value,
"old_value": old_value,
"last_changed": (epoch time when was the "old_value" was set),"
"status_use":
"control_use":
}
Where the "control_use" identifies the "Control Use" for the value, if any, that is specified on the HomeSeer "Status Graphics" page for the device, and the "status_use" corresponds to a value in line with the proposal here: https://forums.homeseer.com/forum/de...to-control-use
Update: 1/19/2020: As a clarification, it should be possible for multiple values to be assigned the same "status use", and if a device has a "control use", then when the report is generated, both the "control use" and its "status use" values get reported, though if a device is "status only" then only the "status use" gets reported.
Comment