Skip to content

shaktidhar/steelsquid-kiss-os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The easiest way to understand the Steelsquid Kiss OS is to reading this python module:
https://github.com/steelsquid/steelsquid-kiss-os/blob/master/modules/kiss_expand.py

You can extend the functionality of Steelsquid Kiss OS in 3 ways
I recommend that you use the syncrionisation script.

  • Start a syncrionisation script on a separate computer.
    When you edit files on that computer they will be uploaded to SteelsquidKissOS automatically.
    (There is now also a Windows exe file for easy syncrionistion on windows ...)
  • Edit files on separate computer and upload them manually.
  • Edit files on SteelsquidKissOS

Automatic upload changes to Steelsquid Kiss OS (syncrionisation script)
You can start a program on the development machine that listen for changes on files and upload to Steelsquid Kiss OS automatically.
Move to the directory where you cloned from git (or extracted ZIP-file).
Change IP number in the file config.txt to the ip number to Steelsquid Kiss OS.
The 4 first row in the file contains this:
IP
PORT
USER
PASSWORD

You can also add multiple server if you want to deploy the same to multiple servers.
Use comma to separate like this: IP, IP, IP
Port, user and password must be the same on all servers.
More info on config.txt see Add custom files below.

  • Then execute: ./steelsquid_synchronize.py
  • Windows users: steelsquid_synchronize.exe

When the program starts it will sync all files.
You should see something like this:
2015-06-05 18:31:20 Load settings from steelsquid-kiss-os.sh
2015-06-05 18:31:20 Load settings from config.txt
2015-06-05 18:31:20 Connecting to: 192.168.0.102

------------------------------------------------------------------------------
Listen for changes and commit to following server(s)
192.168.0.108
------------------------------------------------------------------------------
H : help : Show this help
Q : quit : This program will terminate
T : test : Execute the /root/test.py script
M : module : Reload the modules (/opt/steelsquid/python/modules/...)
S : service : Start/Restart steelsquid service (implememt all changes)
K : kill : Stop steelsquid service
R : reboot : Reboot the remote machine
L : list : List modules in modules/ (see if enabled or not)
N : new : Create new module in modules/ (copy kiss_expand.py)
A : annul : Delete a module in modules/ (You can not undo this!!!)
E : enable : Enable a module in modules/ (will start on boot)
D : disable : Disable a module in modules/ (will not start on boot)
W : web : Create new HTML-file in web/ (copy template.html)
V : delweb : Delete a HTML-file in web/ (You can not undo this!!!)
------------------------------------------------------------------------------
You can also send any other simple terminal line command (ls, pwd, mkdir...)
But you can not use any commands that read input (nano, read, passwd)
------------------------------------------------------------------------------

2015-06-05 18:31:21 SYNC: steelsquid-kiss-os.sh
2015-06-05 18:31:21 SYNC: steelsquid_boot.py
2015-06-05 18:31:21 SYNC: steelsquid_event.py
...........

If you edit one of the monitored files it will be uploaded to Steelsquid Kiss OS automatically.
A new row will show. example: 2014-12-07 19:29:50 SYNC: steelsquid_boot.py

Messages and errors on the Steelsquid Kiss OS will also appear on the development machine.
If you for example execute print Olle on Steelsquid KISS OS the text "Olle" will appear on the development machine.

Make stuff execute on boot
If you want to implement new functionality I suggest you do it in the following files

  • Python files added under /opt/steelsquid/python/modules/ is imported (executed) automatically when the steelsquid service starts (system boots).
    This execute in its own thread so no problem with long running stuff.
  • /opt/steelsquid/python/modules/kiss_expand.py
    To execute stuff at boot you can use this file. It will be imported (executed) in its own thread.

The intention is that if you want to quickly add a feature do that in kiss_expand.py.
But if you want to add several different features, create a new file in modules/ for every feature.

  • I suggest that if you want to create a new feature copy the kiss_expand.py and give it a suitable name (You will then get all the help comments in kiss_expand.py to your new file).
    You do this in the synchronization program by press N and then enter the name of the new module.
  • Then you need to enable that module:
    Command line: steelsquid module kiss_expand on
    Python: steelsquid_kiss_global.module_status("kiss_expand", True)
    Syncrinization program: Press E and then select the module.

The files under modules/ can also listen to events and handle web requests.

  • If the module have 2 methods enable and disable this will execute when the module is enabled /disabled.
  • If the module have 6 different classes: SYSTEM, LOOP, EVENTS, WEB, SOCKET och GLOBAL you get a lot of extra stuff...
  • When module is enabled (Method: enable) is executed
  • When module is disabled (Method: disable) is executed
  • System events (Class: SYSTEM) Execute static methods when system start, network connect...
  • Threads (Class: LOOP) Every static method in the class will be executed in a thread
  • Your own events (Class: EVENTS) Create staticmethods in this class to listen for asynchronous events....
  • Built in webserver (Class: WEB) Execute static methods on request from the webserver...
  • Built in Socket server (Class: SOCKET) Execute static methods on request from the socket server...
  • Logic used from different places (Class: GLOBAL) Put global staticmethods in this class, methods you use from different part of the system.

More info see
http://www.steelsquid.org/extend
https://github.com/steelsquid/steelsquid-kiss-os/blob/master/modules/kiss_expand.py

About

A minimal and optimized version of Raspbian, perfect for your I/O projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published