Announcement

Collapse
No announcement yet.

Virtual Device Event

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

    Virtual Device Event

    All, Im apparently having a brain fart. Im trying to setup virtual devices to show room status (lights on or off) for HStouch. I have the event working to turn on the virtual device when any light is on in a room - but I'm having issues with turning the virtual device off when all the lights are off in that room. Below are my settings - If someone could please tell me what I'm missing i'd be forever in your debt!
    Attached Files

    #2
    There are always a number of ways to achieve a result. The simplest event to create would be a recurring trigger

    IF the event will automatically trigger every 10s
    AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On
    AND IF Downstairs Dining Room Chandelier has a value equal to Off
    AND IF Downstairs Dining Hallway has a value equal to Off
    AND IF Downstairs Dining Room Cove Lights has a value equal to Off

    Then Set Device Downstairs Dining Room Dining Room Virtual Indicator to Off

    The more efficient event would take a little more effort to build

    IF Downstairs Dining Room Chandelier has its value set to Off
    AND IF Downstairs Dining Hallway has a value equal to Off
    AND IF Downstairs Dining Room Cove Lights has a value equal to Off
    AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On

    OR IF Downstairs Dining Room Hallway has its value set to Off
    AND IF Downstairs Dining Chandelier has a value equal to Off
    AND IF Downstairs Dining Room Cove Lights has a value equal to Off
    AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On

    OR IF Downstairs Dining Room Cove Lights has its value set to Off
    AND IF Downstairs Dining Hallway has a value equal to Off
    AND IF Downstairs Dining Room Chandelier has a value equal to Off
    AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On

    Then Set Device Downstairs Dining Room Dining Room Virtual Indicator to Off


    While the first event checks every 10 seconds, it will only run once when the virtual device is on and all the lights are Off. The second event checks when any of the three lights are turned Off. If the virtual device is On and the other two lights are Off, it turns the virtual device Off.
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      Originally posted by rprade View Post
      There are always a number of ways to achieve a result. The simplest event to create would be a recurring trigger

      IF the event will automatically trigger every 10s
      AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On
      AND IF Downstairs Dining Room Chandelier has a value equal to Off
      AND IF Downstairs Dining Hallway has a value equal to Off
      AND IF Downstairs Dining Room Cove Lights has a value equal to Off

      Then Set Device Downstairs Dining Room Dining Room Virtual Indicator to Off

      The more efficient event would take a little more effort to build

      IF Downstairs Dining Room Chandelier has its value set to Off
      AND IF Downstairs Dining Hallway has a value equal to Off
      AND IF Downstairs Dining Room Cove Lights has a value equal to Off
      AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On

      OR IF Downstairs Dining Room Hallway has its value set to Off
      AND IF Downstairs Dining Chandelier has a value equal to Off
      AND IF Downstairs Dining Room Cove Lights has a value equal to Off
      AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On

      OR IF Downstairs Dining Room Cove Lights has its value set to Off
      AND IF Downstairs Dining Hallway has a value equal to Off
      AND IF Downstairs Dining Room Chandelier has a value equal to Off
      AND IF Downstairs Dining Room Dining Room Virtual Indicator has a value equal to On

      Then Set Device Downstairs Dining Room Dining Room Virtual Indicator to Off


      While the first event checks every 10 seconds, it will only run once when the virtual device is on and all the lights are Off. The second event checks when any of the three lights are turned Off. If the virtual device is On and the other two lights are Off, it turns the virtual device Off.


      Thanks I'll try that...of course the second event example has the least system overhead since I'm doing this for 20+ rooms!


      Sent from my iPhone using Tapatalk

      Comment


        #4
        Originally posted by Derek View Post
        Thanks I'll try that...of course the second event example has the least system overhead since I'm doing this for 20+ rooms!


        Sent from my iPhone using Tapatalk
        That is correct, but understand that triggering an event that is prevented from running due to conditions, has very, very little impact on system resources. As I said, the second event is more efficient, but not by a margin that would impact system performance, even with dozens of them running.
        HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

        Comment


          #5
          Originally posted by rprade View Post
          That is correct, but understand that triggering an event that is prevented from running due to conditions, has very, very little impact on system resources. As I said, the second event is more efficient, but not by a margin that would impact system performance, even with dozens of them running.
          Randy,
          I probably should just ignore this, but I'm actually puzzled.
          There seem to be lots of assumptions, but not much hard information about the impact of event trigger structure on overhead.
          Without knowing the internal workings of the event engine, how is it possible to know the impact of alternative event triggering options? It could be that HS evaluates every device value continually, regardless of whether it is an event trigger, event condition, or neither. Are you aware of any relevant documentation?
          I have not seen any impact of event structure on performance, nor am I aware of anyone posting any data that sheds light on the subject. Have I just missed it?
          Mike____________________________________________________________ __________________
          HS3 Pro Edition 3.0.0.548, NUC i3

          HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

          Comment


            #6
            Originally posted by Uncle Michael View Post
            Randy,
            I probably should just ignore this, but I'm actually puzzled.
            It is fair that you are puzzled. I am making some assumptions based upon thinking I understand what is going on behind the scenes. I have tried to get confirmation as to how the event engine really works, but have been unsuccessful. I *think* that triggers are queued and the events are launched when the queue criteria is met. If the trigger is true and the conditions are met a thread or threads are spun off to complete the actions. If the conditions aren't met when the trigger is true, no thread is created and the event is dropped until the next trigger. Regardless of the inner workings, it defies logic to me how the true/false evaluation of triggers and conditions could tax resources much at all. Especially as compared to all the work that has to be done for any action. Many actions have to interface with external devices through a plug-in which communicates with the device and reports its status back to a HomeSeer device. I think it is safe to assume that the really heavy lifting in any event is to complete an action.

            For an event to trigger seems to take little CPU. If the Boolean logic of the condition(s) is not met, the event does nothing until the next time the trigger is true and again the condition(s) are evaluated. Only when the trigger and conditions are all true does the event run actions. The action then causes CPU traffic because it has to control a device and wait for it to report back, run a script or simply write a log entry.

            The evaluation of IFs, OR Ifs and AND IFs are simply true false evaluations. I did a test in 2014 with 100 events using the same trigger of a virtual device and a common condition of another virtual device. This was on a system with a Z-Wave and Arduino plug-ins. All other plug-ins were disabled. The actions in the events were to control different devices or write log entries or both. I wanted to see how much load trigger evaluation caused. I could see no impact whatsoever on CPU when I added the 100 events. I went back and forth by swapping .hsd files and there was no difference in nominal CPU usage. Turning on the trigger device did not affect it at all. Turning the virtual device on and then turning on the trigger device caused CPU load to increase considerably.

            In my system with lots of events and devices, plug-ins are the biggest consumer of system resources.

            I certainly would like to hear from anyone who can show me that I am mistaken and that triggered events that fail the conditions consume any significant amount of system resources.
            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

            Comment


              #7
              Originally posted by rprade View Post
              Regardless of the inner workings, it defies logic to me how the true/false evaluation of triggers and conditions could tax resources much at all. Especially as compared to all the work that has to be done for any action.

              I could see no impact whatsoever on CPU when I added the 100 events.

              In my system with lots of events and devices, plug-ins are the biggest consumer of system resources.

              I certainly would like to hear from anyone who can show me that I am mistaken and that triggered events that fail the conditions consume any significant amount of system resources.
              I agree completely. While my own testing has not been as focused as yours, I also have seen no impact from events that do not trigger. I suspect, but do not have good data to support, that adding devices has some impact. My assumption is that all devices are tracked continually and that the event triggers follow automatically from the device database, with very litter, if any additional computational effort.

              To your last point, it would seem to be a useful piece of information to have so that people could get past the barrier of adding events because they fear that evaluating the trigger will add overhead to their system, when, in fact, it seems pretty clear that an event uses resources only when it actually runs.
              Mike____________________________________________________________ __________________
              HS3 Pro Edition 3.0.0.548, NUC i3

              HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

              Comment

              Working...
              X