Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pimatic and homeduino changelog devices
- here you will find all needed codework for to copy and past into your config.json to get the pimatic and homeduino
- changelog devices running. don't forget to install "sudo npm install -g github-changes" and change the credentials of the iframe devices below!
- cheers
- leader21
- =================================================
- PLUGINS FOR THE PLUGIN SECTION OF THE CONFIG.JSON
- =================================================
- {
- "plugin": "filebrowser",
- "mappings": [
- {
- "path": "/files",
- "directory": "/"
- }
- ]
- },
- {
- "plugin": "iframe"
- },
- {
- "plugin": "shell-execute"
- }
- =================================================
- DEVICES FOR THE DEVICE SECTION OF THE CONFIG.JSON
- =================================================
- {
- "id": "systembuttons",
- "name": "System Commands",
- "class": "ButtonsDevice",
- "buttons": [
- {
- "id": "button-reboot",
- "text": "Reboot Pi"
- },
- {
- "id": "button-shutdown",
- "text": "Shutdown Pi"
- },
- {
- "id": "button-pimatic-restart",
- "text": "Restart pimatic"
- },
- {
- "id": "button-homeduino-update",
- "text": "Update Homeduino"
- }
- ]
- },
- {
- "id": "pimatic-version",
- "name": "Pimatic Version",
- "class": "ShellSensor",
- "attributeName": "version",
- "attributeType": "string",
- "command": "cat /home/pi/pimatic-app/node_modules/pimatic/package.json |grep version\\\": |awk {'print $2'}|sed 's/,//g' |sed 's/\"//g'",
- "interval": 180000
- },
- {
- "id": "homeduino-version",
- "name": "homeduino Version",
- "class": "ShellSensor",
- "attributeName": "version",
- "attributeType": "string",
- "command": "cat /home/pi/pimatic-app/node_modules/pimatic-homeduino/package.json |grep version\\\": |awk {'print $2'}|sed 's/,//g' |sed 's/\"//g'",
- "interval": 180000
- },
- {
- "class": "iframeDevice",
- "id": "homeduino-changelog",
- "name": "Homeduino Changelog",
- "url": "http://admin:password@YOUR-PIMATIC-IP-HERE/files/home/pi/homeduino-changelog.log",
- "width": 600,
- "height": 150,
- "border": 0,
- "scrolling": "yes",
- "scale": 1,
- "reload": 30
- },
- {
- "class": "iframeDevice",
- "id": "pimatic-changelog",
- "name": "Pimatic Changelog",
- "url": "http://admin:password@YOUR-PIMATIC-IP-HERE/files/home/pi/pimatic-changelog.log",
- "width": 600,
- "height": 150,
- "border": 0,
- "scrolling": "yes",
- "scale": 1,
- "reload": 30
- },
- {
- "id": "pimatic-version-git",
- "name": "Pimatic Version Request",
- "class": "ShellSensor",
- "attributeName": "versionrequest",
- "attributeType": "string",
- "command": "curl -s https://github.com/pimatic/pimatic/blob/master/package.json | grep version | grep span | awk -F\\> {'print $11'} | awk -F\\< {'print $1'}\n",
- "interval": 21600000
- },
- {
- "id": "homeduino-version-git",
- "name": "homeduino Version Request",
- "class": "ShellSensor",
- "attributeName": "versionrequest",
- "attributeType": "string",
- "command": "curl -s https://github.com/pimatic/pimatic-homeduino/blob/v0.9.x/package.json | grep version | grep span | awk -F\\> {'print $11'} | awk -F\\< {'print $1'}\n",
- "interval": 21600000
- },
- {
- "id": "pimatic-update-gui",
- "name": "pimatic update info",
- "class": "VariablesDevice",
- "variables": [
- {
- "name": "pimatic-update-gui",
- "type": "string",
- "expression": "$pimatic-update-info"
- }
- ]
- },
- {
- "id": "homeduino-update-gui",
- "name": "homeduino update info",
- "class": "VariablesDevice",
- "variables": [
- {
- "name": "homeduino-update-gui",
- "type": "string",
- "expression": "$homeduino-update-info"
- }
- ]
- },
- =================================================================
- RULES FOR COMPARING VERSION NUMBERS AND FOR SYSTEM BUTTONS DEVICE
- =================================================================
- {
- "id": "pimatic-update-available",
- "name": "pimatic update available",
- "rule": "if $pimatic-version-git.versionrequest is not $pimatic-version.version then set $pimatic-update-info = \"Update to v$pimatic-version-git.versionrequest available\"",
- "active": true,
- "logging": true
- },
- {
- "id": "pimatic-update-not-available",
- "name": "pimatic update not available",
- "rule": "if $pimatic-version-git.versionrequest is $pimatic-version.version then set $pimatic-update-info = \"No update found\"",
- "active": true,
- "logging": true
- },
- {
- "id": "pimatic-changelog-request",
- "name": "pimatic changelog request",
- "rule": "if $pimatic-version-git.versionrequest gets updated then execute \"sudo github-changes -o pimatic -r pimatic -f /home/pi/CHANGELOG-PIMATIC.md && head -23 /home/pi/CHANGELOG-PIMATIC.md | tail -20 | awk '-F)' \\{'print \\$2'\\} | sed 's/(//g' > /home/pi/pimatic-changelog.log\"",
- "active": true,
- "logging": true
- },
- {
- "id": "homeduino-update-available",
- "name": "homeduino update available",
- "rule": "if $homeduino-version-git.versionrequest is not $homeduino-version.version then set $homeduino-update-info = \"Update to v$homeduino-version-git.versionrequest available\"",
- "active": true,
- "logging": true
- },
- {
- "id": "homeduino-update-not-available",
- "name": "homeduino update not available",
- "rule": "if $homeduino-version-git.versionrequest is $homeduino-version.version then set $homeduino-update-info = \"No update found\"",
- "active": true,
- "logging": true
- },
- {
- "id": "homeduino-changelog-request",
- "name": "homeduino changelog request",
- "rule": "if $homeduino-version-git.versionrequest gets updated then execute \"sudo github-changes -o pimatic -r pimatic-homeduino -b v0.9.x -f /home/pi/CHANGELOG-HOMEDUINO.md && head -23 /home/pi/CHANGELOG-HOMEDUINO.md | tail -20 | awk '-F)' \\{'print \\$2'\\} | sed 's/(//g' > /home/pi/homeduino-changelog.log\"",
- "active": true,
- "logging": true
- },
- {
- "id": "system-homeduino-update",
- "name": "System Homeduino update",
- "rule": "if button-homeduino-update is pressed then execute \"sudo bash /home/pi/homeduino-online-installer.sh\"",
- "active": true,
- "logging": true
- },
- {
- "id": "system-pimatic-restart",
- "name": "System Pimatic restart",
- "rule": "if button-pimatic-restart is pressed then execute \"sudo service pimatic restart\"",
- "active": true,
- "logging": true
- },
- {
- "id": "system-reboot",
- "name": "System reboot",
- "rule": "if button-reboot is pressed then execute \"sudo reboot\"",
- "active": true,
- "logging": true
- },
- {
- "id": "system-shutdown",
- "name": "System shutdown",
- "rule": "if button-shutdown is pressed then execute \"sudo shutdown -h now\"",
- "active": true,
- "logging": true
- }
- ======================================================
- VARIABLES FOR THE VARIABLES SECTION OF THE CONFIG.JSON
- ======================================================
- {
- "name": "pimatic-update-info",
- "value": "No update found"
- },
- {
- "name": "homeduino-update-info",
- "value": "No update found"
- }
- =====================================================================
- homeduino-online-installer.sh BASH SCRIPT FOR HOMEDUINO UPDATE BUTTON
- =====================================================================
- #!/bin/bash
- # homeduino-online-installer.sh
- # updating homeduino when pimatic is running.
- # removing old logfile
- sudo rm -rf /home/pi/homeduino-online-installer.log
- # setting the date to the logfile
- date &>> /home/pi/homeduino-online-installer.log
- # stop pimatic daemon
- sudo service pimatic stop &>> /home/pi/homeduino-online-installer.log
- # getting update and upgrade
- sudo apt-get -qq update &>> /home/pi/homeduino-online-installer.log
- sudo apt-get -qq upgrade &>> /home/pi/homeduino-online-installer.log
- # copy homeduino to homedirectory
- cd /home/pi &>> /home/pi/homeduino-online-installer.log
- sudo rm -rf homeduino &>> /home/pi/homeduino-online-installer.log
- sudo git clone --recursive https://github.com/pimatic/homeduino.git &>> /home/pi/homeduino-online-installer.log
- # flash arduino
- cd homeduino &>> /home/pi/homeduino-online-installer.log
- sudo make upload &>> /home/pi/homeduino-online-installer.log
- # start pimatic daemon
- sudo service pimatic start &>> /home/pi/homeduino-online-installer.log
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement