2. Locate the config.js file in the root directory, add the modules name into the modules array.
Creating modules for PiHub, is incredibly easy. A few simple steps is all thats required!
Start by creating a folder in the modules directory, for this guide we will be creating a simple alert module with a icon.
Create the folder "alertbutton" in modules directory, then create a js file with the same name inside that folder.
At this point you should have /modules/alertbutton/alertbutton.js created, then add the following code:
alertbutton.js
function alertbutton_init() { addAppIcon("fa-exclamation-triangle", "alert('Hello World!')"); }
Youre done, it's that easy! Now head over to your config.js and add "alertbutton" into the array, and watch the button automaticly appear.
More advanced functions to come, undocumented example usage required is loadCSS which will load css files in a modules css folder.