Trick to get support for all 1 wire devices
-
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.shI have made a text file named test.sh into the ROOT folder and which has the following content
wget -q "http://127.0.0.1:8080/httpds?test1=
cat /mnt/owfs/some_sensor/temperature
"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)
#!/bin/bash while true; do wget -q "http://127.0.0.1:8080/httpds?test1=`cat /mnt/owfs/some_sensor/temperature`" wget -q "http://127.0.0.1:8080/httpds?test2=`cat /mnt/owfs/ampther_sensor/temperature`" sleep 30 done
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)
-
-
Wow. That's pretty serious geeking out. :)
One thing i might add...
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.
-
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 :wink:
-
May be a better way of doing this is to
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
Francis