Announcement

Collapse
No announcement yet.

Run event if expression is true

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • fx12002
    replied
    Hi Randy,

    Thank you, I now understand what you were asking. Removing the actual dimmer caused the event to work exactly as needed. Thank you all for your help with this, I appreciate it!

    Leave a comment:


  • rprade
    replied
    Originally posted by fx12002 View Post
    Hi,

    So testing everything, I think I may be doing something wrong ... when I set the trim adjuster, the light dimmer level jumps to 99%. I included an image of what I have and here is what each device is:

    446 = Actual dimmer
    434 = The time of day level
    704 = Trim adjuster.

    Thank you for your help!
    That is what I was trying to explain in my post #10 above. Take the actual dimmer out of the formula. I reread your initial post and I am thinking that will work.

    Leave a comment:


  • fx12002
    replied
    Hi,

    So testing everything, I think I may be doing something wrong ... when I set the trim adjuster, the light dimmer level jumps to 99%. I included an image of what I have and here is what each device is:

    446 = Actual dimmer
    434 = The time of day level
    704 = Trim adjuster.

    Thank you for your help!
    Attached Files

    Leave a comment:


  • rprade
    replied
    Originally posted by fx12002 View Post
    Thank you both for your replies, this is very helpful. Randy, your understanding of what I am doing is exactly correct. I haven't been able to test yet but this looks like it would work perfectly. Regarding the possibility of specifying a dimmer value above 100%, this could happen and if it is an issue I guess depends on if you set a device to a value outside of its range, does it not execute the command at all or will it go to the highest possible value within its range. For example, coming from Smartthings, if I set a device to 150% level, it would set it to 100% and in the log would show the error.

    Barry, thank you for your reply as well, I will test both. Also, this has been extremely helpful as a reference for me to see the syntax for this type of logic.

    Thanks again, will test tonight.
    I think the action will fail if you try to set the Device's value outside the configured range in the VS settings. If you try to set a dimmer to 120% it will just fail. If you use the expression I posted it will constrain the values to what the dimmer can handle at the top end and set a floor at the bottom.

    It is also important for me to understand your logic, because I can see a cumulative error in what I posted, because of affecting the device value each time and having the device value as part of the calculation.

    Assuming you are just setting the dimmer to the TimeofDay device plus the trim it would be

    Min(Max (($$DVR:721:+$$DVR:610: ,10), 99)

    Click image for larger version

Name:	Capture.PNG
Views:	6
Size:	27.5 KB
ID:	1275066

    Here everything works

    Click image for larger version

Name:	Capture1.PNG
Views:	4
Size:	24.7 KB
ID:	1275067

    Here it would calculate to -22% so it stops at 10%
    Click image for larger version

Name:	Capture2.PNG
Views:	4
Size:	24.4 KB
ID:	1275068

    Here it would have calculated to 135% so it stops at 99%

    Click image for larger version

Name:	Capture3.PNG
Views:	4
Size:	24.4 KB
ID:	1275069

    Leave a comment:


  • fx12002
    replied
    Thank you both for your replies, this is very helpful. Randy, your understanding of what I am doing is exactly correct. I haven't been able to test yet but this looks like it would work perfectly. Regarding the possibility of specifying a dimmer value above 100%, this could happen and if it is an issue I guess depends on if you set a device to a value outside of its range, does it not execute the command at all or will it go to the highest possible value within its range. For example, coming from Smartthings, if I set a device to 150% level, it would set it to 100% and in the log would show the error.

    Barry, thank you for your reply as well, I will test both. Also, this has been extremely helpful as a reference for me to see the syntax for this type of logic.

    Thanks again, will test tonight.

    Leave a comment:


  • rprade
    replied
    Originally posted by logman View Post
    This works too:

    Code:
    if($$DVR:434: + $$DVR:704: > 0, "$$DVR:434: + $$DVR:704:" , "0")
    The last "0" in the string is value if false, so you can change it to whatever you want (another expression or another device value).

    --Barry
    As is usually the case there is more than one way, but that doesn't catch the value exceeding 99, since his trim device has a value range of -50, 50.

    We both still need to understand his logic with the three devices involved.

    Leave a comment:


  • logman
    replied
    This works too:

    Code:
    if($$DVR:434: + $$DVR:704: > 0, "$$DVR:434: + $$DVR:704:" , "0")
    The last "0" in the string is value if false, so you can change it to whatever you want (another expression or another device value).

    --Barry

    Leave a comment:


  • rprade
    replied
    I need to know the value ranges for your dimmer, TimeofDay and Trim devices and exactly how you apply them. I just tested this and it works perfectly based on my assumptions.

    Dimmer = 718
    TimeofDay= 721
    Trim = 610

    Min(Max (($$DVR:718:+$$DVR:721:+$$DVR:610: ,10), 99)

    This will Take the dimmer, add the TimeofDay and trim values and constrain it to a minimum of 10% and a maximum of 99%.

    I do see a problem in my assumptions, that is why I need to know exactly what you are doing.

    Leave a comment:


  • rprade
    replied
    Originally posted by fx12002 View Post
    Thank you for the replies. I did see those links but don't know the correct syntax/ structure to string it all together. At minimum, I realized by changing the trigger order I can at least only run the event if the value would be greater than 0 (or whatever lower limit value).

    Then have a second event that would run instead. But, like you said Randy, I think I may be able to use the min/ max functions all in one expression that would be more elegant. But, I have no clue how to structure it!

    Thank you for your help,
    K.
    I'll take a stab at it and post back. I think it might be possible to use Min and Max to keep the value from being less than a threshold and to prevent exceeding the maximum of 99 for a dimmer.

    Just to be clear you have a light (dimmer) that you want to adjust its value up or down by yout TimeofDay (+- value) device offset by a trim device (trim). This would be dimmer+TimeofDay+trim? Then you would want this to be no less than a minimum and no greater than 99. Does all this sound correct?

    Leave a comment:


  • fx12002
    replied
    Thank you for the replies. I did see those links but don't know the correct syntax/ structure to string it all together. At minimum, I realized by changing the trigger order I can at least only run the event if the value would be greater than 0 (or whatever lower limit value).

    Then have a second event that would run instead. But, like you said Randy, I think I may be able to use the min/ max functions all in one expression that would be more elegant. But, I have no clue how to structure it!

    Thank you for your help,
    K.

    Leave a comment:


  • rprade
    replied
    Originally posted by fx12002 View Post
    Hi all,


    In my house, I have a daily time of day based light level virtual device that changes throughout the day. There are then other events for specific lights that set the actual light level to the virtual device level when it changes. For some lights, I have a second virtual device I call a trim adjuster. If my global time of day device level is too bright for that specific light, I can trim the level the light is set to be more appropriate without having to change a bunch of other events. I do this with an event that sets the device to an expression: "$$DVR:434:+$$DVR:704:" (for example). The trim device (704) has a status range of -50 to 50.

    So, with the above in mind, I am trying to figure out a way to only set the device to the sum of the above expression if the value is greater than zero (or some other low number).

    IE:

    IF SpecificDevice is not OFF
    AND IF TimeofDay_Device changes
    AND IF TimeofDay_Device+TrimeDevice is > 0
    THEN
    Set Device to Expression: $$DVR:434:+$$DVR:704:

    Hope this makes sense, sorry if I am missing something obvious.

    Thank you!
    First of all, I think the trigger should be the TimeofDay device changing and the condition would be the device not being Off. You could probably use the Min or Max functions in the expression to set upper or lower limits. See this thread

    https://forums.homeseer.com/forum/ul...in-easytrigger

    Leave a comment:


  • cc4005
    replied
    I've not used this type of functionality with easytrigger yet but this post appears to explain exactly what you're looking for.

    Leave a comment:


  • fx12002
    started a topic Run event if expression is true

    Run event if expression is true

    Hi all,


    In my house, I have a daily time of day based light level virtual device that changes throughout the day. There are then other events for specific lights that set the actual light level to the virtual device level when it changes. For some lights, I have a second virtual device I call a trim adjuster. If my global time of day device level is too bright for that specific light, I can trim the level the light is set to be more appropriate without having to change a bunch of other events. I do this with an event that sets the device to an expression: "$$DVR:434:+$$DVR:704:" (for example). The trim device (704) has a status range of -50 to 50.

    So, with the above in mind, I am trying to figure out a way to only set the device to the sum of the above expression if the value is greater than zero (or some other low number).

    IE:

    IF SpecificDevice is not OFF
    AND IF TimeofDay_Device changes
    AND IF TimeofDay_Device+TrimeDevice is > 0
    THEN
    Set Device to Expression: $$DVR:434:+$$DVR:704:

    Hope this makes sense, sorry if I am missing something obvious.

    Thank you!
Working...
X