How alexey-gamov/wirenboard works
This project is a lightweight repository providing custom templates and rules for the WirenBoard controller when used in conjunction with SprutHub. Essentially, it supports two main functionalities:
Main Components
• Repository Storage: This holds all the configuration files and scripts. Separate them into two domains:
• Templates (located in the “templates/sprut-mqtt” folder) – These are device configuration files (in JSON) intended for SprutHub.
• WB-Rules (located in the “wb-rules” folder) – These are custom JavaScript rules executed on the WirenBoard controller.
• WirenBoard Controller: This is the hardware controller that ultimately will run the custom rules.
• SprutHub Interface: The hub that uses the device templates to discover and manage MQTT devices.
• User Interaction/Configuration: The process described in the README where a user copies files into a hidden folder and then uses the WirenBoard web interface to reload templates or add new rules.
Relationships and Interactions
• From the Repository → Templates: Show that the JSON configuration files are manually copied (as per instructions) into a user-specific hidden folder on the controller’s filesystem (e.g., /mnt/data/makesimple/.SprutHub/data/Templates/MQTT/Custom).
• From the Repository → WB-Rules: Show that the JavaScript files are copied into the controller’s “Правила” (Rules) section via the web interface.
• From the Controller → SprutHub: Illustrate that once the templates are uploaded, the SprutHub service integrates them. The controller interacts with SprutHub (e.g., when “Перезагрузить шаблоны” is triggered) to refresh the list of devices.
• From the Web Interface to the Controller and SprutHub: Represent the administrative actions (like reloading templates or creating rules) that a user performs via the web UI.
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly separates configuration files (templates) from operational logic (rules), underscoring a separation of device configuration versus control behavior.
• Extensibility: By placing configuration files in easily replaceable and reloadable directories, the design supports straightforward updates and device integrations.
Technologies and Frameworks
• MQTT: As the messaging protocol for device discovery and communication, essential for SprutHub integration.
• JavaScript: Used for the wb-rules that define controller behavior.
• WirenBoard hardware: The physical controller that executes these rules.
• SprutHub: The management hub that processes the JSON templates and connects to the MQTT ecosystem.
• Clearly labeled nodes:
• Repository (with subdivisions: “Templates” and “WB-Rules”)
• WirenBoard Controller (with a “Rules” engine)
• SprutHub (template loader and device manager)
• User/Web Interface (for manual file reload and rule creation)
• Visual Distinction:
Final Checklist
• Component is clearly labeled.
• Annotations to note that the rules and templates are meant for customizing the controller’s behavior and interaction with the MQTT network via SprutHub.