Hello all,
I would like a to know how i could see the current pimatic version in the gui.
I saw it in someone’s gui i came across.
[solved]Wanted Howto see pimatic version in gui
Hello all,
I would like a to know how i could see the current pimatic version in the gui.
I saw it in someone’s gui i came across.
@derksuh
will show you in just a moment …
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
here you are !
you will have to set the path to pimatic according to yours!
{
"id": "pimatic-version",
"name": "Pimatic Version",
"class": "ShellSensor",
"attributeName": "version",
"attributeType": "string",
"command": "cat /usr/local/pimatic-app/node_modules/pimatic/package.json | grep version\\\": |awk {'print $2'}|sed 's/,//g' |sed 's/\"//g'",
"interval": 180000
},
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
I do not want to be a wiseacre but on my system i got an error.
2016-01-12 12:50:01error [pimatic]: Could not get attribute value of Pimatic Version.version: Error getting attribute value for Pimatic Version: cat: /usr/local/pimatic-app/node_modules/pimatic/package.json: Bestand of map bestaat niet
found the file in an other location.
The line that worked on my system:
“command”: “cat /home/pi/pimatic-app/node_modules/pimatic/package.json | grep version\”: |awk {‘print $2’}|sed ‘s/,//g’ |sed ‘s/"//g’",
Greetings Hans
@hansjeu i think you have the wrong path. I also had to change the path from the device leader21 showed above.
In my setup it was /home/pi/pimatic-app etcetera
Yes guys, that’s exactly what I wrote above … You will have to set the path to your pimatic directory according to your setup 😉
my example is copied directly out of my config.
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
@leader21 now we need a command to read the online available version to build a roule
pimatic + MySensors + Homeduino + z-way
https://github.com/n3roGit/MySensors_n3ro
Will see if this is possible somehow.
pls. check and up vote (the first post in the topic…) this nice feature request here since this is what you want. isn’t it
http://forum.pimatic.org/topic/86/show-changelog-when-an-update-is-available/6
edit : working on it will come up with a “solution” / workaround soon
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
allright, got it working for pimatic itself
what you need is the device pimatic-version (see post #4 here above!) that checks the local pimatic version number, a shellsensor, a variables device, a variable called $pimatic-update-info and two rules.
first insert the following devices into the config.json
This is the shellsensor that requests the actual available pimatic version number from the pimatic github package.json file
{
"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
},
The following device is the variables device that will show the update info in the gui (second line)
{
"id": "pimatic-update-gui",
"name": "pimatic update info",
"class": "VariablesDevice",
"variables": [
{
"name": "pimatic-update-gui",
"type": "string",
"expression": "$pimatic-update-info"
}
]
},
don’t forget to create the variable $pimatic-update-info
and here are the rules
For the available update :
IF $pimatic-version-git.versionrequest is not $pimatic-version.version THEN set $pimatic-update-info = "Update to v$pimatic-version-git.versionrequest available"
If no update is available
IF $pimatic-version-git.versionrequest is $pimatic-version.version THEN set $pimatic-update-info = "No update found"
now add the variables device to the gui.
This should do it
You can alter this with the plugins but you need to create a new variables device and adapt the curl string of the command from the shellsensor accordingly.
Will try to get another version running that checks plugin updates but i guess i cannot do that with curl / grep … let’s see …
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
inspired from all this tinkering i was wondering if there wouldn’t be a way to show a pimatic changelog. what should i say - have a look for yourself :
here’s the howto :
you need
first start with the installation of the program github-changes. this will fetch commit information from github and creates a logfile.
sudo npm install -g github-changes
now go on with the installation of the pimatic-filebrowser AND iframe plugin (if already existing, go to the next step)
insert the following plugin code for the filebrowser device to your plugin section of the config.json (or install via gui):
{
"plugin": "filebrowser",
"mappings": [
{
"path": "/files",
"directory": "/"
}
]
}
now you are able to browse your pi’s filesystem with http://UrlFromYourPi/files
for the iframe plugin you will have to insert this code to the plugin section of your config.son (or install via gui);
{
"plugin": "iframe"
}
next create the iframe device (and change URL and credentials according to yours!!)
{
"class": "iframeDevice",
"id": "pimatic-changelog",
"name": "Pimatic Changelog",
"url": "http://admin:topsecret@192.168.178.20/files/home/pi/pimatic-changelog.log",
"width": 600,
"height": 150,
"border": 0,
"scrolling": "yes",
"scale": 1,
"reload": 300
}
almost done! continue with a rule like :
IF $pimatic-version-git.versionrequest gets updated THEN execute "sudo github-changes -o pimatic -r pimatic -f /home/pi/CHANGELOG.md && head -23 /home/pi/CHANGELOG.md | tail -20 | awk '-F)' \{'print \$2'\} | sed 's/(//g' > /home/pi/pimatic-changelog.log"
now add the iframe to your gui. i guess you won’t see anything yet since the rule has not been triggered. either change the rule at the IF part like IF it is friday THEN … or call the command from the bash :
sudo github-changes -o pimatic -r pimatic -f /home/pi/CHANGELOG.md && head -23 /home/pi/CHANGELOG.md | tail -20 | awk -F\) {'print $2'} | sed 's/(//g' > pimatic-changelog.log
this will create the pimatic-changelog.log file once.
you can see the complete changelog when you are having a look at the CHANGELOG.md file.
the pimatic-changelog.log is only an excerpt of 20 lines.
If you want to see more than the last 20 lines of the changelog, just change the numbers of the head and tail command from the rule. but always be sure to have +3 more at head than of tail since the first three rows of the parsed CHANGELOG.md are blanks.
another thing to say is that the github-changes progam calls the github api and uses approx. 15 calls for that. since we do not authorise ourselves to git there’s only a limited request rate of 60 api calls per hour - just for your information not to let the script run every 5 minutes.
looking complicated but it isn’t! most work is copy and paste
That’s it for now . Well, then have fun with it - if there are any issues call me
Cheers
btw - here’s my system dashboard
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
just one thing that i discovered. i get a broken pipe error on my pi.
the command works though and the changelog will be created.
i read have read about the broken pipe here. seems like awk is to slow parsing the CHANGELOG.md (since it has approx 1400 lines). but nevermind, but most important information is available as far as i can see. so if you get this error don’t care and relax
EDIT: Now I changed the order how the CHANGELOG.md is parsed. first head, then tail, so awk and sed won’t have so much work. the broken pipe error seems to be gone now!
edited the above howto threat accordingly!
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
digging deeper …
now having the homeduino changelog and version query at my system dash too.
above the changelogs you can see the device “System Befehle” (system commands)
I’ve already had that but now i altered it with an “update homeduino” button.
this button triggers a rule that updates the homeduino sketch directly from the gui (executing a bash script). now i am able to manually trigger the homeduino update process from gui or even with a rule.
i merged the existing pimatic devices and the new homeduino devices as well as the buttons device AND the homeduino-online-installer.sh code here at this pastebin, so you can copy and paste it easily. put the script into the /home/pi/ directory. if using another one, be sure to change the path at the rule “system homeduino update” accordingly!
http://pastebin.com/Z8TjfcvD
for your information - the homeduino-online-installer.sh script stops pimatic, will delete the old homeduino directory, clones the new repo to your pi and will install the new sketch to an nano on usb0 as this is the default. then pimatic starts again. so please be patient and wait after the homeduino update button is presses until the gui will restart !! a logfile can be found at /home/pi/homeduino-online-installer.log. better check it after install 'cause there’s no output to the gui since pimatic is stopped! you can easily check with the filebrowser plugin - remember? just call http://UrlFromYourPi/files/home/pi/homeduino-online-updater.sh
with a browser of your choice!
that’s all for today! hope anybody will test it someday and send me a feedback
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
nice! it’s working as expected
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
Hi @leader21 ,
The line "curl -s https://github.com/pimatic/pimatic/blob/master/package.json | grep version | grep span | awk -F\\> {'print $11'} | awk -F\\< {'print $1'}\n",
does not result in the presentation of the Homeduino version.
The line
"curl -s https://github.com/pimatic/pimatic/blob/master/package.json | grep version | grep span
works fine and give the result
<td id="LC12" class="blob-code blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-pds">"</span>version<span class="pl-pds">"</span></span>: <span class="pl-s"><span class="pl-pds">"</span>0.8.71<span class="pl-pds">"</span></span>,</td>
but the final part, the selection of the version does not work. I’ve been on it for a few hours now but I don’t manage to complete this issue. Can you point me in the right direction?
Thanks in advance.
your above command won’t bing you any information on homeduino but pimatic version number. but guess that’s just a typo from you.
just tried the commands they work fine for me.
another problem might be that you have limited github api calls! the limit will be resetted every hour. so if you tried too much, there will be a restriction and you don’t get any result.
try
curl -s https://github.com/pimatic/pimatic-homeduino/blob/master/package.json | grep version | grep span | awk -F\> {'print $11'} | awk -F\< {'print $1'}\n
at the bash.
this should bring 0.8.71
as result for homeduino
if this does not work, there’s another problem that we have to care about then.
here are my devices, maybe they will help
{
"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://user:pwd@192.168.178.20/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://user:pwd@192.168.178.20/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/master/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"
}
]
},
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
To my shame I just found the typo in the variable. That’s why the presentation in the gui went wrong.
Wish I just could delete my post from yesterday
:-s
Never mind! happens everyday even to the best coders
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
Tried to implement this but was unable to select the “Update” trigger. Using the text gave me this error:
Could not find provider that decides next predicaten of “IF $pimatic-version.git.versionrequest het updated” .
for me it works like that
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"
check the spelling of your variables, they are not correct. you can copy / paste the above if and then part directly into the pimatic gui rule.
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
@leader21 I.need.to.learn.to.read.the.whole.topic…
My bad, i missed the “Create pimatic-version-git” post a few post’s up… I really need to read the whole topic before asking questions…