Author Topic: Advanced event criteria options  (Read 1896 times)

PKWilson

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Advanced event criteria options
« on: June 07, 2008, 09:15:37 am »
Hi all,

I'm sure this must be documented somewhere, but I'm struggling to find it. Can anyone point me to where I can find the values that are accepted by the event criteria, specifically:

House Mode
User Mode
Room Mode
Time of Day

I've tried various combinations of numbers, words (armed, away etc). I managed to work out Daytime and Night for the time of day..but I assume there are more.

Is there a definitive list of all the event criteria and the values they expect?

Thanks
Phil

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: Advanced event criteria options
« Reply #1 on: June 07, 2008, 01:24:23 pm »
Take a look at the Apex Alarm, you should be able to find all that info from the GSD template.

Regards,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

PKWilson

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Re: Advanced event criteria options
« Reply #2 on: June 13, 2008, 03:02:45 am »
Thanks for that info. I was able to find the house mode numeric equivalents in the ruby code.

Unfortunately it doesn't appear to do anything. The event I'm testing with is just a simple "Check every minute and if the house is in 'Armed - away' mode, turn a light on.

So my event criteria are:

(
Time of day = 1m AND
House Mode = 2
)

It doesn't matter what I have in the house mode, it always turns the light on. I've tried using numbers, "Armed - away", "ARMED_AWAY", contains "away" as well as all those in single quotes and a number of other variations, but it doesn't matter what I put in as a value, the light always turned on.

Do I need to have another criteria?

I have used the pk_housemode criteria with a "House Mode Changed" event and it works fine with the numeric values, I just don't seem to be able to get the House Mode criteria to have any affect at all.

Does anyone have any other ideas?


Thanks for your help.

Phil

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: Advanced event criteria options
« Reply #3 on: June 13, 2008, 03:21:01 am »
The values can be determined by looking up the relevant PK_ for a given table:


mysql> SELECT PK_HouseMode, Description from HouseMode;

+--------------+-----------------------+
| PK_HouseMode | Description           |
+--------------+-----------------------+
|            1 | Unarmed - at home     |
|            2 | Armed - away          |
|            3 | Armed - at home       |
|            4 | Sleeping              |
|            5 | Entertaining          |
|            6 | Armed - Extended away |
+--------------+-----------------------+
6 rows in set (0.02 sec)

mysql> select PK_UserMode, Description FROM UserMode;
+-------------+----------------+
| PK_UserMode | Description    |
+-------------+----------------+
|           1 | At Home        |
|           2 | Away           |
|           3 | Sleeping       |
|           4 | Do not disturb |
+-------------+----------------+
4 rows in set (0.03 sec)


roommode? where do you see that?

time of day is simply a 24 hour time format. i.e. 11pm becomes 23:00

-Thom

PKWilson

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Re: Advanced event criteria options
« Reply #4 on: June 13, 2008, 05:03:44 am »
Thanks Thom

Unfortunately setting a criteria using the House Mode (not PK_HouseMode) appears to have no affect.

When I have a criteria set to House Mode = 2, it doesn't matter if I have set my house to any other number, the criteria always acts if House Mode = 2 is true.

As in the example in my previous post, all I'm doing is running an interval timer (Time of Day = 1m) and checking to see what the House Mode is (House Mode = 2). No matter what I set the house to in the security screen on the orbiter, it always triggers that event as if House Mode = 2 was true. In my test case, by turning a light on.

Maybe it's just a glitch on my system. I'd love to hear if this simple event works correctly on another system.

Also, the Room Mode is just another criteria in the Advanced Event criteria dropdown, after PK_Skin and before Specific Date. I have no idea what it's referring to.

Cheers

PKWilson

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Re: Advanced event criteria options
« Reply #5 on: June 13, 2008, 05:54:39 am »
Up until now I have been trying to do this by adding a timed event and then going into the Advanced Configuration to edit the criteria.

I thought I would have a go by creating an advanced event based on the interval timer. I tried using the same notation as the timed event (time of day = 1m), but this doesn't seem to work.

How do I specify the interval when creating an interval timer advanced event?

Thanks



tmoore

  • Guest
Re: Advanced event criteria options
« Reply #6 on: December 17, 2008, 01:14:44 am »
I'm having the same problem.  I can set House Mode as any value (even a text value) in the advanced settings, and it always evaluates as true.

Is there a resolution to this problem?

Thanks

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: Advanced event criteria options
« Reply #7 on: December 17, 2008, 01:57:39 am »
House Mode must be an integer.

Look at the HouseMode table and use the PK_HouseMode values.

-Thom

tmoore

  • Guest
Re: Advanced event criteria options
« Reply #8 on: December 17, 2008, 05:34:55 am »
The problem is that it doesn't matter what integer value is used.  It always evaluates to true.  My point about the text value is that I can test any value for House Mode, even if it isn't even an integer (just for the sake of it), and it still evaluates to true.

For example, I set up a timed event for each day of the week for a light to go on at 18:00 but only if House Mode equals 2.  However, the light goes on at 18:00 no matter what state the house is in. 

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 890
  • Living with LMCE
    • View Profile
Re: Advanced event criteria options
« Reply #9 on: December 17, 2008, 08:02:58 am »
Hi,

I'm also spotting incorrect behavour regarding criteria that includes housemodes. I've implemented few simple actions when housemode changes (in that case I'm also trying to set User modes accordingly), but it seems that it works for certain changes of housemode and not fo the others...

I guess the best thing to do right now would be to maybe accumulate those problems to single wiki page and then maybe one of developers could review them and fix things if necessary.

I agree that having working event handler is one of the most important things under LMCE (now when we're slowly progressing well on the core features).

It would also be great if some php guy could enhance web interface (so certain values,criterias could be selected from pulldown menus and not lurking into sql database)...

I guess something similar to what Casaverde did with their interface would be really well accepted. Dealing with events and actions should be as easy as possible...

Thanks in advance,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: Advanced event criteria options
« Reply #10 on: December 17, 2008, 02:58:05 pm »
One of my end goals is to revamp the way the system is programmed by users.

Eventually, I want to take a capabilities based approach:

I have a room
   room has this device (say, a media director, a tv, etc.)
   room has several of that device (some lights)
   room has these sensors (a motion detector, a contact sensor, etc.)

what all can I do with what I have in this room?

Present those options, along with a slimlined UI for each option in an uncluttered fashion.

-Thom

tmoore

  • Guest
Re: Advanced event criteria options
« Reply #11 on: December 17, 2008, 05:21:57 pm »
Sounds good.

In the interim, does anyone have a workaround for checking the house mode in an event condition?

I'm not a programmer (at least, I'm very rusty...), and haven't yet got into the internals of LMCE.  How is the house state stored?  Is it a table value in the database?  If so, maybe I could write a little wrapper in bash to check the state and send the message to turn on the light...  I'd love to have a go at patching the code, but that's beyond my skill level at the moment.

Thanks

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: Advanced event criteria options
« Reply #12 on: December 17, 2008, 05:28:21 pm »
The database contains the states.

We have code that takes databases and creates ORM wrappers for them, one of the side effects of this, are that table rows are given #defines in the code, which are referenced by various bits of code in LMCE.

In this case, The Event_Plugin implements ALL of the event system.

-Thom

tmoore

  • Guest
Re: Advanced event criteria options
« Reply #13 on: December 17, 2008, 05:38:56 pm »
Thanks Thom.  That gives me a starting point.  I'll report back when/if I make any progress...

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 890
  • Living with LMCE
    • View Profile
Re: Advanced event criteria options
« Reply #14 on: December 18, 2008, 12:37:00 am »
One of my end goals is to revamp the way the system is programmed by users.

Eventually, I want to take a capabilities based approach:

I have a room
   room has this device (say, a media director, a tv, etc.)
   room has several of that device (some lights)
   room has these sensors (a motion detector, a contact sensor, etc.)

what all can I do with what I have in this room?

Present those options, along with a slimlined UI for each option in an uncluttered fashion.

-Thom

I'll add few ideas...

I think that approach with predefined events and filling in just needed certain parts (devices,sensors) is a good start. What I'm missing is the convenient way to define things from a pulldown list of available choices for particular spot in criteria or action...

I also played with Micasaverde demo and I think they also have few interesting approaches implemented....

I'd suggest that in first phase we get event handling into working and debuggable state. Then try to make thing easier for others to use it and get to a set of most used common events, that can be offered as prepackaged templates for final user....

Regards,

Bulek.
Thanks in advance,

regards,

Bulek.