Analog_Sensor and expired sensor reading

View: New views
7 Messages — Rating Filter:   Alert me  

Analog_Sensor and expired sensor reading

by Lieven Hollevoet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm trying to couple readings from my ambient lightlevel sensor with Misterhouse. The reason is that I would like to use Misterhouse to control some lights and our window blinds, and that I would like to use the real light conditions instead of the ones calculated by Misterhouse.

Some background: the sensor itself reports its readings wirelessly to a 'gateway' that is on my LAN. Misterhouse then periodically interrogates the gateway to get the readings. The gateway keeps a counter that is reset every time a valid RF packet is received. In this way, I can know how fresh the value is that I read from the gateway. If for some reason the gateway is not receiving RF packets, I don't want Misterhouse to react on an 'old' value. If the counter is bigger than 250, I consider the reading to be too old to be used.

The basics are already working (see attached code file), but I have a specific question concerning the 'freshness counter' in the gateway.

I'm using an ANALOG_SENSOR to keep track of the current lightlevel (between 0 and 100%). Is there a way to make clear that the current measurement that is done for the analog sensor is not valid any more?

What I'd like to obtain is that if I request the value of the analog_sensor item in usercode,  I could first verify if the value is still valid.

Theoretical example user code in combination with attached file:

# Switch on the desklight if it is getting dark
my $desklight_auto_on_allowed = 1;

if (new_minute) {

    my $lightlevel = $sa_lightlevel->measurement();

 
    if ($lightlevel > 70 and $sa_lightlevel->valid()) {
        $desklight_auto_on_allowed = 1;
    }
    if ($lightlevel < 30  and $sa_lightlevel->valid() and $desklight_auto_on_allowed){
    &::print_log("It is dark outside ($lightlevel %), switching desklight on...");
    $desklight->set("ON");
    $desklight_auto_on_allowed = 0;
    }
   
}

Can somebody point me in the direction on how to solve this please?

Kind regards,
 Lieven.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


lightsensor.pl (3K) Download Attachment

Re: Analog_Sensor and expired sensor reading

by David Norwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Since Analog_Sensor is derived from Generic_Item, you can use the get_idle_time method on that object to return the seconds since it was last set.
 
David
 
----- Original Message -----
From: lieven@...
Sent: Saturday, October 10, 2009 1:54 PM
Subject: [mh] Analog_Sensor and expired sensor reading

Hello,

I'm trying to couple readings from my ambient lightlevel sensor with Misterhouse. The reason is that I would like to use Misterhouse to control some lights and our window blinds, and that I would like to use the real light conditions instead of the ones calculated by Misterhouse.

Some background: the sensor itself reports its readings wirelessly to a 'gateway' that is on my LAN. Misterhouse then periodically interrogates the gateway to get the readings. The gateway keeps a counter that is reset every time a valid RF packet is received. In this way, I can know how fresh the value is that I read from the gateway. If for some reason the gateway is not receiving RF packets, I don't want Misterhouse to react on an 'old' value. If the counter is bigger than 250, I consider the reading to be too old to be used.

The basics are already working (see attached code file), but I have a specific question concerning the 'freshness counter' in the gateway.

I'm using an ANALOG_SENSOR to keep track of the current lightlevel (between 0 and 100%). Is there a way to make clear that the current measurement that is done for the analog sensor is not valid any more?

What I'd like to obtain is that if I request the value of the analog_sensor item in usercode,  I could first verify if the value is still valid.

Theoretical example user code in combination with attached file:

# Switch on the desklight if it is getting dark
my $desklight_auto_on_allowed = 1;

if (new_minute) {

    my $lightlevel = $sa_lightlevel->measurement();

 
    if ($lightlevel > 70 and $sa_lightlevel->valid()) {
        $desklight_auto_on_allowed = 1;
    }
    if ($lightlevel < 30  and $sa_lightlevel->valid() and $desklight_auto_on_allowed){
    &::print_log("It is dark outside ($lightlevel %), switching desklight on...");
    $desklight->set("ON");
    $desklight_auto_on_allowed = 0;
    }
   
}

Can somebody point me in the direction on how to solve this please?

Kind regards,
 Lieven.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Analog_Sensor and expired sensor reading

by Lieven Hollevoet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello David,

perfect, indeed that's what I was searching for.

Thanks,
 Lieven.

On Sun, Oct 11, 2009 at 06:23, David Norwood <dnorwood2@...> wrote:
Since Analog_Sensor is derived from Generic_Item, you can use the get_idle_time method on that object to return the seconds since it was last set.
 
David
 
----- Original Message -----
From: lieven@...
Sent: Saturday, October 10, 2009 1:54 PM
Subject: [mh] Analog_Sensor and expired sensor reading

Hello,

I'm trying to couple readings from my ambient lightlevel sensor with Misterhouse. The reason is that I would like to use Misterhouse to control some lights and our window blinds, and that I would like to use the real light conditions instead of the ones calculated by Misterhouse.

Some background: the sensor itself reports its readings wirelessly to a 'gateway' that is on my LAN. Misterhouse then periodically interrogates the gateway to get the readings. The gateway keeps a counter that is reset every time a valid RF packet is received. In this way, I can know how fresh the value is that I read from the gateway. If for some reason the gateway is not receiving RF packets, I don't want Misterhouse to react on an 'old' value. If the counter is bigger than 250, I consider the reading to be too old to be used.

The basics are already working (see attached code file), but I have a specific question concerning the 'freshness counter' in the gateway.

I'm using an ANALOG_SENSOR to keep track of the current lightlevel (between 0 and 100%). Is there a way to make clear that the current measurement that is done for the analog sensor is not valid any more?

What I'd like to obtain is that if I request the value of the analog_sensor item in usercode,  I could first verify if the value is still valid.

Theoretical example user code in combination with attached file:

# Switch on the desklight if it is getting dark
my $desklight_auto_on_allowed = 1;

if (new_minute) {

    my $lightlevel = $sa_lightlevel->measurement();

 
    if ($lightlevel > 70 and $sa_lightlevel->valid()) {
        $desklight_auto_on_allowed = 1;
    }
    if ($lightlevel < 30  and $sa_lightlevel->valid() and $desklight_auto_on_allowed){
    &::print_log("It is dark outside ($lightlevel %), switching desklight on...");
    $desklight->set("ON");
    $desklight_auto_on_allowed = 0;
    }
   
}

Can somebody point me in the direction on how to solve this please?

Kind regards,
 Lieven.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Analog_Sensor and expired sensor reading

by David Norwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Which light sensor are you using?  Is it something custom that you hacked up?  I have two of the 1-wire temperature/humidity/solar sensors from Hobby Boards, and I haven't figured out how to read the solar sensors yet.  
 
David
 
----- Original Message -----
From: lieven@...
Sent: Sunday, October 11, 2009 1:06 PM
Subject: Re: [mh] Analog_Sensor and expired sensor reading

Hello David,

perfect, indeed that's what I was searching for.

Thanks,
 Lieven.

On Sun, Oct 11, 2009 at 06:23, David Norwood <dnorwood2@...> wrote:
Since Analog_Sensor is derived from Generic_Item, you can use the get_idle_time method on that object to return the seconds since it was last set.
 
David
 
----- Original Message -----
From: lieven@...
Sent: Saturday, October 10, 2009 1:54 PM
Subject: [mh] Analog_Sensor and expired sensor reading

Hello,

I'm trying to couple readings from my ambient lightlevel sensor with Misterhouse. The reason is that I would like to use Misterhouse to control some lights and our window blinds, and that I would like to use the real light conditions instead of the ones calculated by Misterhouse.

Some background: the sensor itself reports its readings wirelessly to a 'gateway' that is on my LAN. Misterhouse then periodically interrogates the gateway to get the readings. The gateway keeps a counter that is reset every time a valid RF packet is received. In this way, I can know how fresh the value is that I read from the gateway. If for some reason the gateway is not receiving RF packets, I don't want Misterhouse to react on an 'old' value. If the counter is bigger than 250, I consider the reading to be too old to be used.

The basics are already working (see attached code file), but I have a specific question concerning the 'freshness counter' in the gateway.

I'm using an ANALOG_SENSOR to keep track of the current lightlevel (between 0 and 100%). Is there a way to make clear that the current measurement that is done for the analog sensor is not valid any more?

What I'd like to obtain is that if I request the value of the analog_sensor item in usercode,  I could first verify if the value is still valid.

Theoretical example user code in combination with attached file:

# Switch on the desklight if it is getting dark
my $desklight_auto_on_allowed = 1;

if (new_minute) {

    my $lightlevel = $sa_lightlevel->measurement();

 
    if ($lightlevel > 70 and $sa_lightlevel->valid()) {
        $desklight_auto_on_allowed = 1;
    }
    if ($lightlevel < 30  and $sa_lightlevel->valid() and $desklight_auto_on_allowed){
    &::print_log("It is dark outside ($lightlevel %), switching desklight on...");
    $desklight->set("ON");
    $desklight_auto_on_allowed = 0;
    }
   
}

Can somebody point me in the direction on how to solve this please?

Kind regards,
 Lieven.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Analog_Sensor and expired sensor reading

by Lieven Hollevoet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It is a custom design, so I'm afraid I won't be able to help you with the Hobby Boards one.

I made a description of my setup here: http://lika.be/wp/2009/06/self-powered-wireless-ambient-light-sensor/

Lieven.


On Mon, Oct 12, 2009 at 06:19, David Norwood <dnorwood2@...> wrote:
Which light sensor are you using?  Is it something custom that you hacked up?  I have two of the 1-wire temperature/humidity/solar sensors from Hobby Boards, and I haven't figured out how to read the solar sensors yet.  
 
David
 
----- Original Message -----
From: lieven@...
Sent: Sunday, October 11, 2009 1:06 PM
Subject: Re: [mh] Analog_Sensor and expired sensor reading

Hello David,

perfect, indeed that's what I was searching for.

Thanks,
 Lieven.

On Sun, Oct 11, 2009 at 06:23, David Norwood <dnorwood2@...> wrote:
Since Analog_Sensor is derived from Generic_Item, you can use the get_idle_time method on that object to return the seconds since it was last set.
 
David
 
----- Original Message -----
From: lieven@...
Sent: Saturday, October 10, 2009 1:54 PM
Subject: [mh] Analog_Sensor and expired sensor reading

Hello,

I'm trying to couple readings from my ambient lightlevel sensor with Misterhouse. The reason is that I would like to use Misterhouse to control some lights and our window blinds, and that I would like to use the real light conditions instead of the ones calculated by Misterhouse.

Some background: the sensor itself reports its readings wirelessly to a 'gateway' that is on my LAN. Misterhouse then periodically interrogates the gateway to get the readings. The gateway keeps a counter that is reset every time a valid RF packet is received. In this way, I can know how fresh the value is that I read from the gateway. If for some reason the gateway is not receiving RF packets, I don't want Misterhouse to react on an 'old' value. If the counter is bigger than 250, I consider the reading to be too old to be used.

The basics are already working (see attached code file), but I have a specific question concerning the 'freshness counter' in the gateway.

I'm using an ANALOG_SENSOR to keep track of the current lightlevel (between 0 and 100%). Is there a way to make clear that the current measurement that is done for the analog sensor is not valid any more?

What I'd like to obtain is that if I request the value of the analog_sensor item in usercode,  I could first verify if the value is still valid.

Theoretical example user code in combination with attached file:

# Switch on the desklight if it is getting dark
my $desklight_auto_on_allowed = 1;

if (new_minute) {

    my $lightlevel = $sa_lightlevel->measurement();

 
    if ($lightlevel > 70 and $sa_lightlevel->valid()) {
        $desklight_auto_on_allowed = 1;
    }
    if ($lightlevel < 30  and $sa_lightlevel->valid() and $desklight_auto_on_allowed){
    &::print_log("It is dark outside ($lightlevel %), switching desklight on...");
    $desklight->set("ON");
    $desklight_auto_on_allowed = 0;
    }
   
}

Can somebody point me in the direction on how to solve this please?

Kind regards,
 Lieven.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


benchmark error??

by Tom MacLean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Greetings!

I'm hoping one of you might be so kind as to point out an obvious route of
enquiry.... after a power failure and an SVN update, my previously working
MH is now giving me an error and failing to start:

  10/15/09 03:00:11 PM: Global symbol "$benchmark_tickcount" requires
explicit package name at (eval 411) line 3222.
Global symbol "$benchmark_tickcount" requires explicit package name at
(eval 411) line 3222.
Unmatched right curly bracket at (eval 411) line 3224, at end of line
syntax error at (eval 411) line 3224, near ";

}"
Line 3217:  }
Line 3218:
Line 3219:
Line 3220:
Line 3221:
Line 3222:     $Benchmark_Members{'insteon'} += &get_tickcount -
$benchmark_tickcount if $benchmark_tickcount and
$Benchmark_Members{on_off_flag};
Line 3223:
Line 3224:  } # End of
insteon#-------------------------------------------------
Line 3225:
Line 3226:  sub insteon_table_loopcode {
Line 3227:   print '   insteon_table' if $Debug{user_code};

Any ideas what might have chnaged that my previously working insteon.pl
might no longer work?

Many Thanks,
Tom M.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: benchmark error??

by Tom MacLean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Found my problem.  Don't know how it got there, but as the message below
indicated, I had an extra curly brace. Sorry for wasting your bandwidth.
(My excuse is that I'm jetlagged, and was stressed because my automation
was broken!)

Regards,
tom

On Thu, 15 Oct 2009, Thomas Maclean wrote:

>
> Greetings!
>
> I'm hoping one of you might be so kind as to point out an obvious route of
> enquiry.... after a power failure and an SVN update, my previously working
> MH is now giving me an error and failing to start:
>
>   10/15/09 03:00:11 PM: Global symbol "$benchmark_tickcount" requires
> explicit package name at (eval 411) line 3222.
> Global symbol "$benchmark_tickcount" requires explicit package name at
> (eval 411) line 3222.
> Unmatched right curly bracket at (eval 411) line 3224, at end of line
> syntax error at (eval 411) line 3224, near ";
>
> }"
> Line 3217:  }
> Line 3218:
> Line 3219:
> Line 3220:
> Line 3221:
> Line 3222:     $Benchmark_Members{'insteon'} += &get_tickcount -
> $benchmark_tickcount if $benchmark_tickcount and
> $Benchmark_Members{on_off_flag};
> Line 3223:
> Line 3224:  } # End of
> insteon#-------------------------------------------------
> Line 3225:
> Line 3226:  sub insteon_table_loopcode {
> Line 3227:   print '   insteon_table' if $Debug{user_code};
>
> Any ideas what might have chnaged that my previously working insteon.pl
> might no longer work?
>
> Many Thanks,
> Tom M.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ________________________________________________________
> To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365