Add actor model to query device resources and resource items as VFS - #8274
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR adds an actor model (AM) entry point which lets the GUI and other actors query resources in the plugin by sending small asynchronous messages. For now this supports read-only queries against resources and sub-resources of the
Deviceclass.There is a virtual file system (VFS) protocol layered on top of AM messages to read virtual directories and files.
In the upcoming deCONZ version the VFS is visualized in a debug widget which can be accessed via menu:
Help → Data view
Note: The widget doesn't know anything about devices or resource items, it only shows directories and entries.
The PR generically presents a path like
/devices/00:15:8d:00:01:a2:4a:ff/subdevices/00:15:8d:00:01:a2:4a:ff-01-0406/state/presenceas tree. Items likestate/presencerepresent a directory (state) with an entry (presence).Implementation details:
The actor model in deCONZ is a new way to let various components or plugins send messages to each other without tight coupling via C/C++ APIs. For example the REST plugin can talk with the OTA plugin, GUI or GCFFlasher. Currently this is internal but will be extended to be reachable via encrypted WebSockets.
There is no
get_all, the whole VFS works just like a file system API each directory and entry is queried as a single request. Directories may require multiple requests if the content doesn't fit in a single response as the actor model used rather small message sizes of max. 4k - 64k.The VFS updates its state automatically, similar to ZCL attribute reporting values that are changed emit a notification to all subscribers.
This is the first step to get the REST plugin data represented in the GUI. Next goal is to also visualize some of the data within Node GUI, e.g. a light showing its on/off state or sensors their values. Ideally this can be customized by the user by just drag and drop values from the Data view onto the node in the GUI.