Author Topic: Smartthings  (Read 5556 times)

0 Members and 1 Guest are viewing this topic.

deco123411

  • Jr. Member
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Smartthings
« on: September 06, 2016, 09:52:12 AM »
Hey guys. So I integrated Samsung smartthings with vox commando and Event ghost to notify me if the garage door opens and closes using events.

Unfortunately eventghost does not detect notifications so it can't tell alert me if the garage has been left open for N amount of time.

How would I write a command to alert me{ if door status not  changed to close every 3 minutes}{ tts.speak}''please don't forget to close the door''

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Smartthings
« Reply #1 on: September 06, 2016, 10:50:15 AM »
Hi. Welcome to the forum. It would help if we had more information about your Eventghost commands, but basically you can do something like the following.

1. When Eventghost sends a garage door status event to VC:
 - trigger a command that sets a "door status" variable value to "open" or "closed" based on the Eventghost event.
 - it can also alert you as to the new status (TTS or OSD whatever).
 - in the same command, set an event timer to trigger another command that evaluates the door status variable again in 3m.
 
2. Create a second command in VC that is triggered by your event timer event.
 - if the door status variable is still "open" then it tells you that.
 - if you like, you can have it check again in 3 minutes.
 - if the door status variable is "closed" it can do nothing, or just to be safe you can have it cancel any future 3 minute event timers that may already be set.

Here is some example XML that expects Eventghost to send a "garagedoor.open" or a "garagedoor.closed" event to VC when the door changes its status.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.2.2-->
<commandGroup open="True" name="check garage door" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="58" name="garage door status has changed" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Assumes only 2 garagedoor.* events exist: &quot;garagedoor.open&quot; or &quot;garagedoor.closed&quot;">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastEvent}&amp;&amp;open</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Garage Door just opened</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>garage</param>
            <param>open</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>3m</param>
            <param>garageStatus</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>garage</param>
            <param>closed</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Garage door has just closed.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Garage door has closed.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>garagedoor.*</event>
  </command>
  <command id="59" name="3 minute check" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{var.garage}&amp;&amp;open</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Alert. It's been 3 minutes. The garage door is still open</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>The garage door is still open after 3 minutes.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>3m</param>
            <param>garageStatus</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>VC.StopEventTimer</cmdType>
          <params>
            <param>garageStatus</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>garageStatus</event>
  </command>
</commandGroup>

You'll have to change the command somewhat depending on what kind of events you're generating in Eventghost.
« Last Edit: September 07, 2016, 11:52:23 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

deco123411

  • Jr. Member
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Smartthings
« Reply #2 on: September 24, 2016, 12:49:10 PM »
Yes thank you. ;D ;D
This has helped me in more than one scenario for other events as well.
I am not too familiar with logic and have tried studying the variable wiki.
Wish there was more info on the
if
A=B ,A<B etc but ill research some more


In turn when the garage is open, i am now able to activate my cameras on the tv and highlight the garage after a certain time while turning on 2  of my Hue lights to red.
Then when the garage closes,lights revert back and camera app on tv closes. 

You guys are awesome FYI.

 

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Smartthings
« Reply #3 on: September 24, 2016, 12:59:30 PM »
Sounds promising. :)

Wish there was more info on the
if
A=B ,A<B etc but ill research some more

The main discussion of logic blocks on the wiki is here: http://voxcommando.com/mediawiki/index.php?title=Logic_Block

If that doesn't make sense on its own, keep the page open while you open up and review existing commands that use logic. I think that many of the popular standard configurations each have a few commands that use logic blocks. That may help cement things for you.

There are a few discussions on the forum, but it's the kind of thing where you will want to test and play around in your own configuration. A forum command that is not relevant to your situation may not be very illuminating.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

deco123411

  • Jr. Member
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Smartthings
« Reply #4 on: September 24, 2016, 01:46:03 PM »
Thank you once again.
Out of curiosity. how do i set my own variable to open or close in this example should i want to change it to something else in the future.
 
in other words
I know how to do it with payload lists and ranges but how would VC know if garage A=B has open in it.
or for Tv or lights is now in "on" variable by the events payload

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Smartthings
« Reply #5 on: September 24, 2016, 01:51:45 PM »
The action Results.SetVar is how you create and set the value of your own variable.

The description of the action is here: http://voxcommando.com/mediawiki/index.php?title=Actions#SetVar

If you're not passing a payload value, just enter the value directly as the second parameter within your command macro. The value can use whatever words (strings) you want. I used 'open' and 'closed' but that is for you to decide.

... If I'm misunderstanding the question, maybe you can clarify.
« Last Edit: September 24, 2016, 01:56:14 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

deco123411

  • Jr. Member
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Smartthings
« Reply #6 on: September 24, 2016, 02:14:21 PM »
This is exactly what i was asking.


I read the wiki numerous times,But that is why i am still lost.
I see it over and over in posts but if i set a variable to what ever, how does VC in this case know that eventghost still has status to open

e.g in TCM Builder

Eventghost.send garage opened
tts.speak  '''Garage has been opened''

Results.SetVar garage (param. opened)<-----HOW DOES VC  KNOW ITS STILL OPENED(OR EVENTGHOST TELL VC IT IS CLOSED)

VC.setTIMER 3 minutes
Results.SetVar garage (param. closed)<-----HOW DOES VC KNOW ITS STILL CLOSED.

I guess my question is how does two programs communicate so that VC will know after 3 minutes that status has indeed changed.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Smartthings
« Reply #7 on: September 24, 2016, 03:18:07 PM »
I read the wiki numerous times,But that is why i am still lost.
I see it over and over in posts but if i set a variable to what ever, how does VC in this case know that eventghost still has status to open

A command in VC can only know that based on the event that Eventghost is generating in VC (if that's currently working properly).

That is, you would change the value of that variable within a command that is triggered by the appropriate Eventghost event.

So, in your command that is triggered by the event GarageDoorOPENED, you set the variable to 'open' using the action Results.SetVar.

In the command that is triggered by the event GarageDoorCLOSED, you set the variable to 'closed' using the action Results.SetVar.

That is actually what I did in my original example command earlier in this thread.

Quote
e.g in TCM Builder

Not sure what a TCM Builder is. Are you referring to the Logical Command Builder in VC? (i.e, the macro editor)?
http://voxcommando.com/mediawiki/index.php?title=Logical_Command_Builder


Quote
Results.SetVar garage (param. opened)<-----HOW DOES VC  KNOW ITS STILL OPENED(OR EVENTGHOST TELL VC IT IS CLOSED)

VC.setTIMER 3 minutes
Results.SetVar garage (param. closed)<-----HOW DOES VC KNOW ITS STILL CLOSED.

I guess my question is how does two programs communicate so that VC will know after 3 minutes that status has indeed changed.

Again, the value of the variable should be set by the commands that are triggered by the appropriate Eventghost event.

After 3 minutes, if no new Eventghost event occurred, the variable name will be the same as it was. If a new Eventghost event occurs in the meantime, it will trigger the relevant command in VC that updates the variable value.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

deco123411

  • Jr. Member
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Smartthings
« Reply #8 on: September 24, 2016, 03:36:56 PM »
Thank you for taking the time to explain that to me.

So just to confirm. I can set the variable string to anything that is associated  with anything that is in the event name of event i.e garageOPENED <--
i take the word OPEN and set it as VAR and VC will look for any  VAR string  that has OPEN/OPENED it

so another example would be event lightsilluminated and i set the var to illuminate. VC will look for illuminate.

I meant the LCB(Logical command builder) My appologies.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Smartthings
« Reply #9 on: September 24, 2016, 04:11:40 PM »
No problem. We can only learn by doing, basically, and it's a lot of information to absorb.

Quote
so another example would be event lightsilluminated and i set the var to illuminate. VC will look for illuminate.

Basically, yes. If you create a command--triggered by the event lightsilluminated--in which you set a variable you've named 'lights' to 'illuminate', at that point the variable {var.lights} will == 'illuminate', until you change the variable's value or close VC.

I don't want to make things too confusing, but you can choose almost any word(s) you like for the variable's name and the variable's value.

The name of the event doesn't limit the value that can be assigned to the variable. The name of the event only determines which command is triggered in VC. What you do within that command is entirely up to you.

But because you *know* that the Eventghost event that you named 'GarageDoorOPENED' is only triggered when the garage door opens, you know that this means the garage door is now open, and you set the variable value accordingly.

I'm not sure if it will help, but if I have time today I will try to record a video that goes through my example and will try to explain step by step how these things work. It could be helpful to new users generally. The only problem is that I currently have a broken front tooth, so I will be talking funny! :)




TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

deco123411

  • Jr. Member
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Smartthings
« Reply #10 on: September 24, 2016, 04:40:44 PM »


THAT REALLY HELPED
 ::antlers
Sorry to hear about the tooth. This info and video is truly something that i know will help me and others a great deal. when ever you can would be much appreciated.