Author Topic: Question on Vera.Get.Status (it won't stop looping)  (Read 1624 times)

0 Members and 1 Guest are viewing this topic.

RickyD333

  • Contributor
  • ***
  • Posts: 71
  • Karma: 2
    • View Profile
Question on Vera.Get.Status (it won't stop looping)
« on: July 11, 2015, 04:08:43 PM »
Okay, so I was trying to do this earlier, did a cheap workaround to solve it, but I can never not try to figure something out. So I'm at it again. All I am trying to do is check the status of my "Watch TV" activity on my Vera unit and have a particular action take place. If Vera.Get.Status shows that "Watch TV" is off (0), then turn it on. If Vera.Get.Status shows that "Watch TV" is on (1), then OSD.ShowText and TTS.Speak: "Your TV is already on."

I think I got it working for the most part, a little unsure though because whenever I save and execute the command for testing, it repeats the action over and over again. And even if Vera.Get.Status indicates my activity was off, it turns it on as it should but it also activates the second IF section of my command which is if "Watch TV" is on, then OSD.ShowText and TTS.Speak: "Your TV is already on."

So I'm wondering how do I get this to stop looping, which I'm thinking is causing it to also activate my second IF statement.

Here's my xml:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<groupCollection open="True" name="Test Vera Status">
  <commandGroup open="True" name="Test Vera Status" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="814" name="Test" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>Vera.Get.Status</cmdType>
        <params>
          <param>{M:Vera1D.Harmony Control}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <if ifBlockDisabled="False" ifNot="False">
        <ifType>(A)&lt;(B)</ifType>
        <ifParams>0&amp;&amp;1</ifParams>
        <then>
          <action>
            <cmdType>Vera.Scene</cmdType>
            <params>
              <param>{M:Vera1S.Watch TV}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else />
      </if>
      <if ifBlockDisabled="False" ifNot="False">
        <ifType>(A)Contains(B)</ifType>
        <ifParams>{2}&amp;&amp;1</ifParams>
        <then>
          <action>
            <cmdType>OSD.ShowText</cmdType>
            <params>
              <param>your tv is already on</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>your tv is already on.</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType />
            <params />
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else />
      </if>
      <event>Vera1.Scene.31.Active</event>
    </command>
  </commandGroup>
</groupCollection>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Question on Vera.Get.Status (it won't stop looping)
« Reply #1 on: July 11, 2015, 04:25:01 PM »
When do you want this command to be executed?

Currently you are triggering this command using the event: Vera1.Scene.31.Active

I don't know if scene 31 is your "Watch TV" event but if it is, then you don't need to trigger the event to watch TV under any circumstances.  If you do then you will be creating a loop.

I also dont' know what {M:Vera1D.Harmony Control} is or what the status will return or what it will mean.

As far as logic goes, 0 will ALWAYS be less than 1 and so your first logic block will always trigger the scene {M:Vera1S.Watch TV}

In your second logic block, you are checking to see if payload 2 (which is the name of your scene that triggered this command) contains a 1.  I don't know the name of your scene but it usually won't change so this logic block will always do the same thing.