Jump to content
  • 0

Global variable as trigger, is there a better way than mine?


Question

Hi all,

 

I am building our first room using the HC3. Beining used to the HC2 it requires some thinking out of the box for me.

 

My question: I'm building a scene for the ventilation in the new bathroom.

I have a MS6 for RH and this part works.

 

Now my challenge: In the future I want all extraction fans turn on when there is a CO alarm. I made an enumerated with 2 "states": Safe and Breached.

To get the scene to act on the var change (now by a test scene) I am checking the variable in the condition/ trigger part as a non existing state: "off".

Is there a better/ cleaner way to do this?

{
  conditions = { {
      id = 50,
      isTrigger = true,
      operator = ">=",
      property = "value",
      type = "device",
      value = 60
   }, {
      isTrigger = true,
      operator = "!=",
      property = "CoAlarm",
      type = "global-variable",
      value = "off"
    }},
  operator = "all"
}

If I add a condition for "Safe" and "Breached" the scene isn't triggered.

 

This works, but it is a weird way to check variables for what you want to do IMHO.

 

Jim

Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
31 minutes ago, jimicr said:

Hi all,

 

I am building our first room using the HC3. Beining used to the HC2 it requires some thinking out of the box for me.

 

My question: I'm building a scene for the ventilation in the new bathroom.

I have a MS6 for RH and this part works.

 

Now my challenge: In the future I want all extraction fans turn on when there is a CO alarm. I made an enumerated with 2 "states": Safe and Breached.

To get the scene to act on the var change (now by a test scene) I am checking the variable in the condition/ trigger part as a non existing state: "off".

Is there a better/ cleaner way to do this?

{
  conditions = { {
      id = 50,
      isTrigger = true,
      operator = ">=",
      property = "value",
      type = "device",
      value = 60
   }, {
      isTrigger = true,
      operator = "!=",
      property = "CoAlarm",
      type = "global-variable",
      value = "off"
    }},
  operator = "all"
}

If I add a condition for "Safe" and "Breached" the scene isn't triggered.

 

This works, but it is a weird way to check variables for what you want to do IMHO.

 

Jim

Maybe you could post a customEvent to trigger the scene instead?

Edited by jgab
  • Thanks 1
Link to post
Share on other sites
  • 0
17 minutes ago, jgab said:

Maybe you could post a customEvent to trigger the scene instead?

Thanks @jgab, will look into this.

 

Didn't know that that was a possibility!

Will come back here with the result.

 

Jim

 

**EDIT** Thanks @jgab it works! much to learn here

Edited by jimicr
Link to post
Share on other sites
  • 0

I have the code below in a light scene. First check motion (that's the trigger), then the Lux value must be 100 or below, and the sleepstate variable should be false. Check your conditions, test setting the device to: isTrigger=false.

 

{
  conditions = { {
      id = 79,
      isTrigger = true,
      operator = "==",
      property = "value",
      type = "device",
      value = true
    }, {
      id = 81,
      isTrigger = false,
      operator = "<=",
      property = "value",
      type = "device",
      value = 100
    }, {
      isTrigger = false,
      operator = "==",
      property = "sleepstate",
      type = "global-variable",
      value = "false"
    } },
  operator = "all"
}
 
-----------------------
 
You might test:
{
  conditions = { {
      id = 50,
      isTrigger = false,        <-------- False
      operator = ">=",
      property = "value",
      type = "device",
      value = 60
   }, {
      isTrigger = true,         <-------- True
      operator = "==",          <-------- Is
      property = "CoAlarm",
      type = "global-variable",
      value = "breached"        <-------- Breached
    }},
  operator = "all"
}
Edited by robw
Link to post
Share on other sites
  • 0

@robw My situation was different, I needed one var with 2 values and each value should trigger the scene.

 

Did you try the solution I posted in the other thread?

 

Jim

Link to post
Share on other sites
  • 0
10 minutes ago, jimicr said:

@robw My situation was different, I needed one var with 2 values and each value should trigger the scene.

 

Did you try the solution I posted in the other thread?

 

Jim

 

Ok, both had to trigger, I see, sorry.

 

Thank's I just saw it :) I will test now. I've struggled with the iTach - how to press a button from a scene. Now that works. I'm getting a little more code in my head *L*

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...