Install 1wire on meteohub

Hardware topics that do not fit in one of the other categories

Moderator: Mattk

Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Install 1wire on meteohub

Post by Periklast »

I know some people have running a 1wire system on meteohub.

Can you say what i have to do to read the sensors?

I've installed owfs by
* Downloading
* Extracting
* ./configure
* ./make
* ./make install

but now I'm stuck.

I want to read the sensors with perl.

edit: i'm using the usb-adaptor
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote: but now I'm stuck.
If I've understood correctly, then at this stage

For a DS9490 USB adaptor:

Code: Select all

perl -MOW -e "OW::init('u'); printf OW::get('');"
should get you something like:

Code: Select all

DEFAULT: Opened USB DS9490 adapter at 002/002.
I want to read the sensors with perl.
You'll also need to mount the 1-wire system for which you need fuse. e.g.

Code: Select all

mkdir /home/1wire
mkdir /home/1wire/mnt

modprobe fuse

/opt/owfs/bin/owfs u /home/1wire/mnt
With that you should be able to 'see' the 1-wire devices using

ls /home/1wire/mnt

e.g.

Code: Select all

10.A78B94010800  1F.72D303000000  26.D55BB6000000  settings      system
1D.04010E000000  1F.F5D303000000  81.FD4927000000  simultaneous uncached
1D.5CEB09000000  26.3F59B6000000  alarm            statistics
1F.63D603000000  26.C3A5BC000000  bus.0            structure
For regular use fuse needs to be loaded automatically during reboot, so add a
fuse
line to /etc/modules

Then you get your perl to read from the relevant pseudo-files on /home/1wire/mnt.

Does that make sense?
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

It seems you have to install fuse.

I installed fuse and after that, I tried to re-install owfs (because /opt/owfs/bin/owfs doesn't excist) (it was disabled by configure.
So I run follow command:

Code: Select all

 ./configure --enable-owfs --enable-owperl
but at the end, it gives me an error:

Code: Select all

checking for fuse_main in -lfuse... no
configure: WARNING:
 Can't find libfuse.a - add the search path with --with-fuselib
configure: WARNING: Running ldconfig or adding "/usr/local/lib" to /etc/ld.so.conf might also solve the problem, otherwise re-install fuse.
configure: error: Can't enable OWFS
I editted the /etc/ld.so.conf to

Code: Select all

include /etc/ld.so.conf.d/*.conf
/usr/local/lib
followed by ldconfig but the error remains.

edit: libfuse.a exist in /usr/local/lib
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote:It seems you have to install fuse.
Checking my notes I did

Code: Select all

apt-get install fuse-utils libfuse-dev
before I installed owfs itself.

Did you get libfuse aswell as fuse?
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

Thanks, now it works! Now i'm figuring out how to use the files in /home/1wire/mnt
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

I managed to read the solar and uv sensor and add it to meteohub.
BUT, everything works ok if I don't give the sensors any ID and name. From the moment I give the sensors an ID, the plugin don't work anymore.

Code: Select all

#!/usr/bin/perl -w 
use strict;
use IO::Handle; 


my $solarid = "26.7DD1F1000000";
my $uvid= "EE.CB34CB010800";

my $oldsolarvalue = 0;
my $olduvvalue = 0;


sub trim($)
{
	my $string = shift;
	$string =~ s/^\\s+//;
	$string =~ s/\\s+$//;
	return $string;
}
sub GetSolar(){
	my $cursol = $oldsolarvalue;
	eval{
		my $file = "/home/1wire/mnt/$solarid/vis";
		open (SOL,$file) || die();
		my $read=<SOL>;
		close(SOL);
		my $solar = trim($read);

		$cursol = int($solar*4000);
		
		$oldsolarvalue = $cursol;
	};
	if ($@){
		
	};
	
	print "sol0 $cursol\\n";
}
sub GetUV(){
	my $curuv = $olduvvalue;
	eval{
		my $file = "/home/1wire/mnt/$uvid/UVI/UVI";
		open (UVI,$file) || die();
		my $read=<UVI>;
		close(UVI);
		my $uvi = trim($read);
		$uvi = $uvi*10;
		$curuv = $uvi;

		$olduvvalue = $uvi;
	};
	if ($@){

	};
	print "uv0 $curuv\\n";
}


STDOUT->autoflush( 1 ); 
while ( 1 ) 
{ 
    GetSolar();
    GetUV();	
     
    
    sleep( 30 ); 
}


And I gave sol0 id sol0 and uv0 id uv0

Next, I'm gonna connect my lightning detector (counter) to 1wire and meteohub. What will be the sensortype? Rain/Data/...?
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote:From the moment I give the sensors an ID, the plugin don't work anymore.
I've no immediate ideas on that. I'm assuming that you have taken a look in the meteohub log to see if anything is being reported there?
Next, I'm gonna connect my lightning detector (counter) to 1wire and meteohub. What will be the sensortype? Rain/Data/...?
I use data.
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

yes, it's strange. I don't see anything in the log.

If I give an id to UV (ex uv0/uv1) it works but add an id to the solar, the plugin stops working.
It stops after reading the first plugin-sensor.

If I first output the uv and then the solar, only uv is seen (sometimes solar) but there is no refresh of both sensors.
If I first output the solar, only the solar is seen (sometimes) and no uv is seen. There is also no refresh.
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote:yes, it's strange. I don't see anything in the log.
Maybe you could add some temporary debugging aids to your code, e.g. write notes to a file at various points in the code then see if those notes help pin down what's happening?
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

I did some advanced debugging. I don't see any error in the output.
What I see is that the script is running all the time and output everything correctly. Except, meteohub doesn't trace all the output, except the first line.
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote:What I see is that the script is running all the time and output everything correctly. Except, meteohub doesn't trace all the output, except the first line.
Does this minimal dummy plug-in work for you? It does on my ALIX-1D

Code: Select all

#!/usr/bin/perl -w
use strict;
use IO::Handle;
my $value = 1;
STDOUT->autoflush( 1 );
while ( 1 )
{
    print "sol0 $value\\n";

    $value++;
    sleep( 5 );
}
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

I've tried it now and it works only if you not give it an id (ex sol0-sol1). Seems only to happen sol.

edit: how to implement the lightning counter? I see counters.A / counter.B and counters.ALL
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote:I've tried it now and it works only if you not give it an id (ex sol0-sol1). Seems only to happen sol.
Haven't we been here before?

i.e. http://www.meteohub.de/joomla/index.php ... rt=12#7327

Are you using vmware or your ALIX?
Periklast
Junior Boarder
Junior Boarder
Posts: 34
Joined: Sun Apr 26, 2009 9:14 am

Re:Install 1wire on meteohub

Post by Periklast »

I'm using Alix now and I have the same problem as vmware.

Don't know why, maybe advanced logging by meteohub itself?
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Install 1wire on meteohub

Post by skyewright »

Periklast wrote:Don't know why, maybe advanced logging by meteohub itself?
Perhaps.
What happens if you modify your perl to report the solar values as a "data" sensor instead of a "sol" one?

If itworks as data then you are at least recording something and the problem is further isolated.
Post Reply