News:

HOT TIP! Enable the History Window in the main UI when trying to problem solve. It provides a handy log of what is happening. Roll over lines in the History to get more details.

Main Menu

Programming Help

Started by ddl, November 12, 2013, 12:21:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ddl

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

***********  get excited and make things  **********

ddl

Yes, that is where I got the idea.  However, I'm not so sure how to integrate VC with my insteon devices. 

nime5ter

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

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

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

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

Quote from: ddl on November 12, 2013, 02:35:18 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

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

#9
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.

<?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)
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

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

Thank you so much for the prompt reply.  Works perfectly!

Thanks again.

jitterjames

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

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

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.