Announcement

Collapse
No announcement yet.

Problem Using Conditions and Toggling?!

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

    Problem Using Conditions and Toggling?!

    Hi everyone.

    I am stuck. I have an event called "dvd play" which blasts an IR signal. But I want to blast the IR signal ONLY when the dvd player is on.

    I have an INSTEON X/10 probe connected to the dvd which correctly reports the status (On or Off) to a homeseer device "dvd status".

    Can't seem to set the manual trigger condition is execute event only when "dvd status" = ON.

    Also, would really like to execute another event "error message-- turn on dvd player" if "dvd status" = Off, when I execute "dvd play" reminding me to turn the dam thing on.

    Clarification:
    If "DVD status" = ON then execute event "DVD Play" else run event "Error Message".

    If the "else" parameter is not available outside of scripting, then I guess I will settle for:
    If "DVD status" = ON then execute event "DVD Play"

    I have no idea how to write any scripts at this point. (Is there a scripting book "FOR DUMMIES"-- I do understand programing basics, just have no idea of the syntax of scripting or even what computer language is used.)

    One the same topic, (sort of) every time I run an event "tv power" I would like to toggle a virtual device on and off. In this manner I can keep track of the status of the tv.

    Using separate and discrete on and off events, this would be easy. But, would like to be able to use just "tv power" event to toggle a virtual device.

    Clarification:
    So first instance of event "tv power" -- virtual device =ON; second instance of event "tv power" --virtual device = Off; third instance of event "tv power" -- virtual device =ON; forth instance of "tv power" -- virtual device = OFF, and so on.

    Thanks all.

    Doug.

    (P.S. I have just enough knowledge to be dangerous and hope I have explained the problem well enough, if not please let me know what information is needed.)

    #2
    You might be able to struggle through making this with an event (or multiple events) but if you are after scripting then this would be an example vb.net script I would use, there are several ways to do things with HS scripting, for example instead of checking the device status like I have done here you could us the commands hs.ison("A2") which will return a boolean value.

    Code:
    Sub Main(ByVal Parms As Object)
    
    Select Case hs.devicestatus("A2") 'change this code to your DVD player
    Case 2 '2 is on
    hs.triggerevent("DVD IR Send")
    'or you can send the IR trigger directly from here
    Case 3
    hs.writelog("Error", "DVD Player Is Off")
    Case Else
    hs.writelog("Error", "DVD Player is in an unknown state")
    End Select
    End Sub
    You can use vb.net or vbscript (well I think you can use more languages but these are the main ones), the above script is written using vb.net syntax but it is virtually identical to vbscript. You can do it with an If...Then...Else aswell;

    Code:
    Sub Main(ByVal Parms As Object)
    
    If hs.devicestatus("A2") = 2 Then
    hs.triggerevent("DVD IR Send")
    ElseIf hs.devicestatus("A2") = 3 Then
    hs.writelog("Error", "DVD Player Is Off")
    Else
    hs.writelog("Error", "Unknown Error")
    End If
    End Sub
    If you triggerered this script from the DVD Play event you would need a second event to send the IR command, however you could put the IR command in the script itself. If you take a look at the help files there is example syntax for the hs.sendIR command.

    For your second example you might be able to get away with a single line immediate script command along the lines of this in your event;

    &if hs.ison("A2") then hs.setdevicestatus("A2", 2) else hs.setdevicestatus("A2", 3)

    or something like that anyway...

    Comment


      #3
      Originally posted by Doug Krasnoff View Post
      I have an event called "dvd play" which blasts an IR signal. But I want to blast the IR signal ONLY when the dvd player is on. I have an INSTEON X/10 probe connected to the dvd which correctly reports the status (On or Off) to a homeseer device "dvd status".

      Can't seem to set the manual trigger condition is execute event only when "dvd status" = ON.
      I may not understand what you've tried, but it may be that you are misinterpreting how Homeseer treats events with conditions. If you are testing by clicking on the Run button, HS ignores the conditions and runs the event. All new users find that non-intuitive. (Heck, I bet 99% of experienced users find it non-intuitive too, but have gotten used to it.)

      If I've misunderstood, perhaps you can add some more explanation.
      Also, would really like to execute another event "error message-- turn on dvd player" if "dvd status" = Off, when I execute "dvd play" reminding me to turn the dam thing on.
      This can be done with events, but is a bit more complicated. You'd need 3 events. The first event has two actions. Each action runs a 'Manual with conditions' event. The condition on the first of them would be that the status is On. The condition on the second would be that the status is Off.

      If that is not clear, please ask follow-up questions.
      . . .every time I run an event "tv power" I would like to toggle a virtual device on and off. In this manner I can keep track of the status of the tv.
      This will require just a bit of scripting, but you don't have to actually write a script. You can use an 'immediate' script statement (see the Users Guide for instructions).
      The statement will look like the image below. Change the device code to the one for your virtual device.
      Attached Files
      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


        #4
        Originally posted by Uncle Michael View Post
        The statement will look like the image below. Change the device code to the one for your virtual device.
        That's a slick technique UM, I have a number of functions where I wanted just a little more logic on the event.

        Paul
        Paul

        Comment


          #5
          Uncle Mike,

          Hopelessly lost.

          I have named an event as "Speak ON" (which only has HS speak the word "ON") and set manual conditions for this event to the device named "dvd status" = ON.

          I have named an event as "Speak OFF" (which only has HS speak the word "OFF") and set manual conditions for this event to the device named "dvd status" = OFF.

          I have named an event as "Test" that has events "Speak ON" and "Speak Off" in the list of operations for "Test."

          I have tried setting "Test" with manual only setting, and hit run. This does not work.

          This is MOST counter-intuitive, indeed.



          Thanks,

          Doug

          Comment


            #6
            Doug,
            If it makes you feel better, you have much company.

            I'm going to include some more screen shots, but I am still guessing as to what the problem is. If this doesn't address it, then it would really help if you could post some shots of the events that are not working the way you expect.

            The top image is the Action tab of an event corresponding to the one you are calling Test. When you add or edit an event action there is a pink oval in the upper right corner of the edit area (cut off in my picture). If it says 'Switch to Advanced View' then you must click on it to get the check box that appears under the delay time boxes. (Don't ask me why it's not always visible. I don't know.)
            That box has to be checked for this to work.


            The next image is the Trigger tab of an even that corresponds to the ones you call Speak On or Speak Off. Be sure to select 'Manual with conditions' as the trigger. Then add your conditions.

            Now, when you run the first event, it should trigger the contingent events, depending on the state of the conditions for those two events.

            At the end is the log record for these events.
            Attached Files
            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


              #7
              OK, in business, thanks A LOT!!! The problem was I did not check the "RUN ONLY IF CONDITIONS ARE TRUE BOX. Very weird that after you set up a conditional event, HS will ignore your set condition if that box is not checked?!?!?! (I really fail to see the logic there. Just my 2 cents.)

              Have not tried your toggling solution, and will not have the time for that for a while because of the holidays but, glad to know someone out there is willing to help. Thanks, again, and have a Merry Christmas.

              --Doug

              Comment


                #8
                Originally posted by Doug Krasnoff View Post
                OK, in business, thanks A LOT!!! The problem was I did not check the "RUN ONLY IF CONDITIONS ARE TRUE BOX.
                Great! Glad you got it working.
                Very weird that after you set up a conditional event, HS will ignore your set condition if that box is not checked?!?!?! (I really fail to see the logic there. Just my 2 cents.)
                Yup. (Did I mention that many find it to be non-intuitive?)

                . . .glad to know someone out there is willing to help. Thanks, again, and have a Merry Christmas.
                You too. I think you will find that there are many here who love to help. It's a great community. (And besides, it's a chance to show off some really arcane knowledge that none of my friends or family understand or care a hoot about. )
                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


                  #9
                  Originally posted by Uncle Michael View Post
                  (And besides, it's a chance to show off some really arcane knowledge that none of my friends or family understand or care a hoot about. )
                  I consider this board an "encounter group" for this kind of thing....
                  Paul

                  Comment


                    #10
                    Originally posted by pbibm View Post
                    I consider this board an "encounter group" for this kind of thing....
                    What a great image. I'm picturing us all sitting around a sparsely furnished, rather drab meeting room sharing our HA successes and failures and commiserating about our HS frustrations.
                    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