Joined: 19/10/2009 05:08:44
Messages: 52
Location: Oulu Finland
Offline
Now when there is the new process event handler (many thanks for a good feature). I made some experiments with it and came up with a way how to get from owfs data to mango. (see www.owfs.org)
I have been using scripts to feed data from owfs to mysql and mango is then reading the data base with SQL data source. This works but it is not too easy to setup for beginners.
Here comes an easier way using HTTP receiver datasource. It works quite twisted way with a simple script making calls with wget to the receiver. No mysql needed in between.
Option A
I made a virtual data source and a point with "alternate" change type. Then defined event detector to create events on change. So this point is periodically making events. The process handler is calling /var/lib/tomcat6/webapps/ROOT/test.sh
I have made a text file named test.sh into the ROOT folder and which has the following content
This method can be used also for witing to owfs (sending commands to 1 wire devices)
option B
make the script running all the time(launched in system start) and make a loop structure with sleep. This is not under control of mango but might be even easier. Something like this (not tested)
Some notes.
- the instruction works for linux(ubuntu). For windows it should be possible similar way but using .bat file. There is wget also for Windows, but some research needed.
- The owfs needs to have "--allow_other" to make the ow filesystem readable for the tomcat process.
- the .sh file properties needs to be set as executable and in option A have permission for the tomcat user(chmod 777, should do the trick)
I made a virtual data source and a point with "alternate" change type. Then defined event detector to create events on change. So this point is periodically making events.
You could also use a scheduled event to accomplish the same.
Actually, another thing i might add is this: http://automation.serotoninsoftware.com. This might make things easier, but might not be robust enough for you yet. Still, maybe worth looking at.
Joined: 19/10/2009 05:08:44
Messages: 52
Location: Oulu Finland
Offline
Hmm, the cron pattern would be a cleaner way to do the same trick. I did not tweak so much as just trying if the method works. The owfs -> script -> mysql -> mango method is in use for real.
Mango automation looks cool. Maybe I would have picked it if it had been available when I started playing with these. Maybe luckily it was not. As I don't have as much time I would like to have playing already with Mango m2m
1 - write a JSP page to run an op system command
2 - use the JSP to loop through the reply to create a neat page with the collected data
3 - use an HTTP retreiver to pick up the data (same way as I am doing for op sys stats)
This means thoe whole process is under mango control and mango timings
But I like the idea of using OWFS if a device is not mango supported