Author Topic: Programming Help  (Read 9980 times)

0 Members and 1 Guest are viewing this topic.

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Programming Help
« on: November 12, 2013, 12:21:04 PM »
Hi, Great program.

I am very new to this and am looking for assistance with implementing a command that will fire when I come home.  Here is the idea.

D... I'm home
D... welcome home the time is ... the temperature outside is ... Would you like me to adjust the thermostat?

If yes then speak "ok, I will adjust the thermostat to 75 degrees and will adjust the lighting in the TV Room and Kitchen to 75 percent.  Is there anything else you would like me to do?"
If no then speak " ok, Would you like to listen to music? (From this point on I can use information provided from the example on this forum)

Any help would be appreciated.

To help me accomplish this I am using the following equipment.

XBMC
ISY994 Universal Device controller
Insteon Light switches
Insteon Thermostat

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Programming Help
« Reply #1 on: November 12, 2013, 01:41:24 PM »
I think this video give you a start  ;)

www.youtube.com/watch?v=ewCRJZKFW34
***********  get excited and make things  **********

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Programming Help
« Reply #2 on: November 12, 2013, 01:50:40 PM »
Yes, that is where I got the idea.  However, I'm not so sure how to integrate VC with my insteon devices. 

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Programming Help
« Reply #3 on: November 12, 2013, 02:15:50 PM »
Do you already have VC working well with XBMC?

Have you been able to create the non-Insteon portions of the commands you're describing? It would be good to know what your level of familiarity is with VC command building, as well as your familiarity with your Insteon devices.

You will probably need to use one of the plugins, such as the X10 plugin or the TCP plugin to communicate with the Insteon devices.
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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Programming Help
« Reply #4 on: November 12, 2013, 02:32:29 PM »
Actually, to control the insteon you will probably want to use the "scrape" action and refer to the following page for commands:
http://wiki.universal-devices.com/index.php?title=ISY_Developers:API:REST_Interface#Commands

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Programming Help
« Reply #5 on: November 12, 2013, 02:35:18 PM »
I have only used VC for a couple of days now.  I already have it working with XBMC.  I have limited experience with insteon and yes, I have been able to create the non insteon portions of the commands that I am describing. While I agree with you that I should start slow I just got real excited about the overall possibility.:)

As far as weather reporting... I was hoping to direct VC to report from a weather service if available.

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Programming Help
« Reply #6 on: November 12, 2013, 02:39:34 PM »
Thanks for the heads up about the scraping action.  I will try it tonight when I get home.  I am familiar with the Rest api and should be able to figure it out. 

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Programming Help
« Reply #7 on: November 12, 2013, 03:15:04 PM »
As far as weather reporting... I was hoping to direct VC to report from a weather service if available.

No problem there.  You can use the weather underground plugin.  "Wunder".

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Programming Help
« Reply #8 on: November 12, 2013, 07:49:32 PM »
Using the weather plugin.  I would like to create an action that will speak the current temperature.  I cant figure out the syntax.  Can you guide me in the right direction?  Here is what I've done so far.

Action = TTS.SpeakSync  "The current temp outside is {c.temp_f}" 

When I test this it reads the text as type above.  It does not include the actual temperature outside.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Programming Help
« Reply #9 on: November 12, 2013, 08:20:58 PM »
You need to first use a WUnder plugin-specific action to get the temperature. Then in your TTS.Speak action you can use {LastResult} to access the returned value.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="705" name="WEATHER" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>WUnder.Refresh</cmdType>
    <cmdString>Montreal&amp;&amp;EN&amp;&amp;C</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>WUnder.GetCustom</cmdType>
    <cmdString>{C.temp_f}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>The current temperature is {LastResult} Fahrenheit</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>The current temperature is {LastResult} Fahrenheit</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

The documentation for the WUnder.GetCustom action recommends using the refresh action first, which is why I put it in my code. It will work without it, but using refresh ensures you're always getting the most recent data.

List of WUnder plugin actions are here: http://voxcommando.com/mediawiki/index.php?title=Plugin_WUnder

As well as in the Action Selection Tree (see http://voxcommando.com/mediawiki/index.php?title=Logical_Command_Builder)
« Last Edit: November 12, 2013, 08:43:43 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)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Programming Help
« Reply #10 on: November 12, 2013, 08:42:47 PM »
Update: I just double-checked with James. Probably you don't need to bother with the Refresh action and can just use WUnder.GetCustom on its own.
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)

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Programming Help
« Reply #11 on: November 12, 2013, 08:48:30 PM »
Thank you so much for the prompt reply.  Works perfectly!

Thanks again.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Programming Help
« Reply #12 on: November 12, 2013, 09:00:06 PM »
If I remember correctly, any time you make a request for info, it will use the data cached from the last request, but before doing so, it will check how long it has been and if the data is more than 15 minutes old, it will auto-refresh the data first.

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Programming Help
« Reply #13 on: November 12, 2013, 09:21:11 PM »
ok, Thanks.

Now I have another question.  I would like to send a command from VC to process a program that turns on my lights.  I am using an ISY99 Universal device controller to control all of my insteon devices.  Earlier the suggestion was made that I use the scrape action in VC to implement this. 

After looking at the documentation for the scrape action.  I'm not so sure I understand the options.  XML and UserAgent.  I am familiar with Rest API and am able to get a list of the nodes and programs. I am still not sure how to setup the action in VC. Any other suggestions?


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Programming Help
« Reply #14 on: November 12, 2013, 09:53:39 PM »
Just use the regular scrape action.  You don't need the other variations.  There are plenty of examples on the forum using scrape. 

The first parameter will be the URL and possibly some get parameters defined in the isy api.  To turn the lights on you don't really need to worry about what info gets sent back, but if you want to there are other actions that can deal with the result of the scrape.