Installation Node.js Installation First you need to install node.js that comes with the package manager npm. You need to install or update to version 4 of Node.js (version 4.6.2 at the time of writing). Earlier versions of Node.js aren't supported. If you are on the Raspberry Pi and running the standard Raspbian distribution you can use the following installation procedure. # Using Debian sudo apt install -y curl curl -fsSL https://deb.nodesource.com/setup_12.x | sudo bash - sudo apt install -y nodejs Check you Node.js version with: /usr/bin/env node --version pimatic Installation You must have the gcc compiler or some other suitable compiler installed. Moreover, you need to have git installed. On Debian-based systems run: sudo apt-get install build-essential git If you run debian 11, install python2: sudo apt install python2.7 python2.7-minimal python-is-python2 Once node.js and npm are installed you can run cd /home/pi mkdir pimatic-app npm install pimatic --prefix pimatic-app --production wget --quiet --output-document=pimatic-app/node_modules/pimatic/lib/plugins.coffee https://pimatic.oppserver.net/download/pimatic/plugins.coffee to install the pimatic framework. Copy the default config file: cd pimatic-app cp ./node_modules/pimatic/config_default.json ./config.json You should end up with these files in your pimatic-app directory: config.json the config file node_modules directory for the framework and plugins node_modules/pimatic the pimatic framework files Now, you need to set the password for the admin user. Open the file config.json using a text editor (e.g., nano) and search for the string "users". Then, change the value of the password property for user "admin" below. Configuration The config.json file is in the json format and currently includes four sections: { "settings": { ... }, "plugins": [ ... ], "devices": [ ... ], "rules": [ ... ] } The settings section The settings section contains the configuration for the HTTP and HTTPS server. You have to set the username and password property for the authentication or disable it with setting enabled to false. In the default config just the HTTP server is enabled and configured to run on port 80. See the config-schema for more details and all configuration options. The plugins section In the plugins section you have to list all plugins to load in the form of { "plugin": "plugin-name" } where plugin-name ist the name and directory of the plugin you want to load. All plugins are installed in the node_modules directory and prefixed with pimatic-. The devices section The devices section should contain all devices, you want to have registered in the framework. An actuator is typically provided by a plugin, so take a look at the desired plugin for more details about the configuration of your devices. A device configuration has the form { "id": "light", "class": "SomeSwitch", "name": "Light in the kitchen", ... } where the id property should be unique, the name property should be a human readable description and the class property determines the plugin and type of the device. The rules section The rules section can contain a list of rules in the form of: { "id": "printerOff", "rule": "when its 6pm then turn the printer off" } where id should be a unique string and rule a string of the form "when ... then ...". Running The server can be started with sudo node_modules/pimatic/pimatic.js If you run into a sqlite3 error, run pimatic.js again: Knex: run $ npm install sqlite3 --save Error: Cannot find module 'sqlite3' To daemonize pimatic you can run: sudo node_modules/pimatic/pimatic.js start You can also use status, stop, restart. Installing globally To make pimatic available globally you can run: cd ./node_modules/pimatic sudo npm link Then pimatic can be used with: sudo pimatic.js [start|stop|status|restart] Autostart [NEW] You can autostart pimatic by additionally installing the service script: sudo wget --quiet --output-document=/usr/lib/systemd/system/pimatic.service https://pimatic.oppserver.net/download/pimatic/pimatic-master-opp/install/pimatic.service sudo systemctl enable pimatic.service [OLD] You can autostart pimatic by additionally installing the init.d script: sudo wget --quiet --output-document=/etc/init.d/pimatic https://pimatic.oppserver.net/download/pimatic/pimatic-master-opp/install/pimatic-init-d sudo chmod +x /etc/init.d/pimatic sudo chown root:root /etc/init.d/pimatic sudo update-rc.d pimatic defaults It should now start with: sudo service pimatic start and log the output to: pimatic-app/pimatic-daemon.log