Author Topic: My current setup/implementation  (Read 4100 times)

0 Members and 1 Guest are viewing this topic.

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
My current setup/implementation
« on: January 06, 2016, 06:35:21 AM »
Hi! I just thought that I maybe should share my commands xml with all of you, so that someone maybe can get help from it :)!

I have many functionalities, one of witch is an alarm clock. You tell it to set the alarm to a specific time, in military time, and then it sets an event timer, and a map.

The map is there so that the computer can reboot, and the alarm will still go off, because it checks for any entries in the map when it loads. If there is any (clears when the alarm goes off) it sets a new event timer.

One other ting is my alarm system, I can arm both my room and the hallway outside. I use ir detectors to sense motion. My whole family has got their own codes, witch I can disable at any time, so that I can control who gets in or out.

It can speak (common topics), and it can tell one joke so far. I live in Sweden, so it is one of our Norwegian jokes ;).

I control my lights using a tellstick, and alarm using an arduino uno.

Some commands are in Swedish (Not phrases, Macro names), so sorry for that (Too lazy to translate).
And the Kodi commands is from someone else, I suspect it was James who did them (I don't use Kodi that often, so it was unnecessary to spend time on making commands for it).

Best regards

Oskar
What you can´t do now... Go learn it!

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: My current setup/implementation
« Reply #1 on: January 07, 2016, 01:05:24 PM »
Hi, Oskar. Thanks for posting your command tree.

A lot of new users like to know how to have conversations with VoxCommando, and your "Talk" command group looks like it could be a great starting point for them.

How long have you been using the program? It looks like you've learned a lot.

Your approach to turning VC off when there is a TTS announcement is interesting.

We're curious to know why you have chosen to pause VC for 500 ms before it changes its state, in your "Off when speaking" command. Was there a particular problem that this solved for you?

A few things that you might want to experiment with:

1. Are you familiar with the {status} variable in VC?

It returns the current listening mode of VoxCommando (on, standby, or off).


2. Your morning alarm clock is pretty cool. In that command group, you're currently manually raising the volume in +2 increments in one of the commands.

It might be fun for you to figure out how to write that command so that the computer is doing the addition for you, looping and adding 2 to the volume with each loop.

One thing for all users to keep in mind: the VC.Pause action should be used carefully, because when that action is used, VoxCommando will not just pause that command, it stops doing anything and waits until the pause is over. VoxCommando freezes.

There are several solutions to this, depending on the objective. Let us know if you're interested in knowing more.
---

A tip for those who don't know how to open someone else's voicecommands.xml file in your command tree editor without fear of overwriting your own configuration:

Your command tree window is actually a "multiple document interface," which means that you can open a separate command tree in its own window: http://voxcommando.com/mediawiki/index.php?title=MDI_editor_interface.

If you then see some commands or groups etc. that you'd like to experiment with, you can copy them over to your own tree in the usual ways.

« Last Edit: January 07, 2016, 03:25:38 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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: My current setup/implementation
« Reply #2 on: January 07, 2016, 06:59:26 PM »
I do something similar with my wife's alarm clock but over a longer period,
  • it turns on Pandora to 1 of 5 selected stations
    sets the volume to 5
    waits 5 minutes
    checks to make sure Pandora is still on
    Sets the volume to 10
    sets the lamp to 10%
    Waits 5 minutes
    Checks to make sure Pandora is still on
    Sets the the volume to 15
    sets the light to 20%
    Waits 5 minutes
    Sets the volume to 20
    sets the lights to 30
    pauses Pandora
    Then tells her good morning and the weather and tells her if there are any birthdays today (Friends and Family)
    sets volume to 15
    and then
    un-pauses Pandora

(All while I still use my phone as an alarm clock :bonk )

I would share the command but I have it all setup using   VC.SetEventTimmer, so it makes it a little more difficult to share

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Re: My current setup/implementation
« Reply #3 on: January 08, 2016, 01:45:20 PM »
Hi, Oskar. Thanks for posting your command tree.

A lot of new users like to know how to have conversations with VoxCommando, and your "Talk" command group looks like it could be a great starting point for them.

How long have you been using the program? It looks like you've learned a lot.

Your approach to turning VC off when there is a TTS announcement is interesting.

We're curious to know why you have chosen to pause VC for 500 ms before it changes its state, in your "Off when speaking" command. Was there a particular problem that this solved for you?

A few things that you might want to experiment with:

1. Are you familiar with the {status} variable in VC?

It returns the current listening mode of VoxCommando (on, standby, or off).


2. Your morning alarm clock is pretty cool. In that command group, you're currently manually raising the volume in +2 increments in one of the commands.

It might be fun for you to figure out how to write that command so that the computer is doing the addition for you, looping and adding 2 to the volume with each loop.

One thing for all users to keep in mind: the VC.Pause action should be used carefully, because when that action is used, VoxCommando will not just pause that command, it stops doing anything and waits until the pause is over. VoxCommando freezes.

There are several solutions to this, depending on the objective. Let us know if you're interested in knowing more.
---

A tip for those who don't know how to open someone else's voicecommands.xml file in your command tree editor without fear of overwriting your own configuration:

Your command tree window is actually a "multiple document interface," which means that you can open a separate command tree in its own window: http://voxcommando.com/mediawiki/index.php?title=MDI_editor_interface.

If you then see some commands or groups etc. that you'd like to experiment with, you can copy them over to your own tree in the usual ways.

The reason for why I wait 500 ms is because my VoxCommando froze when not using the delay... I don't remember what else it was good for except to avoid interference when I have my speakers on...

I have been using it for four months now, so I guess that I am a fast learner with school and all ;)

1. No, I was not. Maybe something interesting for the future..

2. It might be, but I have too little time ;)

VC.Pause is dangerous, as you say. I wish that I had some other way to pause, like C#'s wait(1000); (think it is C#, can program in seven languages, witch is difficult to keep apart). Can you give any tips?

@PegLegTV:

That is nice! Do you have a pc that is always on, or what. I tried to have mine in hibernate (it is one meter from my bed), but I almost slept over today because it didn't log in when using windows task scheduler...

Any tips? :)


@nime5ter:

Any help with the issue above   :bonk


Thanks for helping me nime5ter, and PegLegTV: thanks for the alternative solution!

Best regards Oskar Stenberg
What you can´t do now... Go learn it!

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: My current setup/implementation
« Reply #4 on: January 08, 2016, 02:04:35 PM »
Quote
@PegLegTV:

That is nice! Do you have a pc that is always on, or what. I tried to have mine in hibernate (it is one meter from my bed), but I almost slept over today because it didn't log in when using windows task scheduler...

Any tips? :)

all my pc's stay on 24/7 (just easier), plus they are all low power consumption PC's my main PC is linked in my signature, and then I use 2 Lenovo Q190's

I use Google Calendar and the Gcal Plugin for the alarm clocks
I created a Calendar specifically for daily things, Wake up, time to take the kids to school, time to pick kids up, practice, take out the trash, kids bedtime.... and so on (Makes it easier to keep track of no school and what not)

for my wifes alarm clock I use Eventghost to trigger an event, because she works the same scheduled days every week, but if she has a day off all she has to do is mark it in the calendar and it turns her alarm off for that day,

I know you can change the power settings in the bios to turn a computer on at a certain time, but I'm not sure if you can wake a computer from hibernate with the bios settings, other wise if you have another computer that stays on all the time you could use wake on lan to wake the other computers from hibernate at a specific time

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Re: My current setup/implementation
« Reply #5 on: January 08, 2016, 05:10:53 PM »
Thanks for the reply!

I thought about google cal, but since my parents are scared that the house will burn down if we leave the router or any computers on over night.. It won't work for me  :'(

Thanks for the tip with BIOS, I have considered it, but it seems like I have to tell Windows to require no password when it wakes up from hibernate. (Idiot solution, don't know why I didn't think of it earlier) but I don't know if it works!

I have thought about using separate PC's, but here comes the issue with both Mom and Dad, and my age.

Since I am fourteen years old I don't make that much money (approx 1,5 USD a month), and I live in Sweden (where electronics are very expensive due to taxes and customs duty). So I can't afford more than one PC.

Thanks for the answer

Oskar
What you can´t do now... Go learn it!

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: My current setup/implementation
« Reply #6 on: January 08, 2016, 06:32:17 PM »
I used the bios setting on a Windows XP running a Playon server a couple years back, I don't recall if I had a password on that PC or not though

If you have an android Phone or Tablet you could use Wake on lan from you phone or tablet at a specific time to wake your computer
you may need the tasker app to do so though

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: My current setup/implementation
« Reply #7 on: January 08, 2016, 06:53:44 PM »
I sleep my computers.  I don't personally see the point of using hibernate unless you have a laptop that is not plugged in.  Modern desktop PCs use almost exactly the same amount of electricity when they are sleeping as they do when you hibernate.  I also set my PCs to not require a password when they wake up and that part works anyway.

However, when VC (or any program) crashes or acts strange on my system it is usually after I have brought the PC out of sleep.  I'm not sure if the same would happen with hibernation since I don't use it.
« Last Edit: January 08, 2016, 06:57:35 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: My current setup/implementation
« Reply #8 on: January 08, 2016, 06:57:11 PM »
I must admit, I have never heard of anyone turning their router off at night.  Do they really consider it a fire hazard or are they trying to save electricity?  Or maybe they are concerned about the harmful effect of radio transmissions.

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Re: My current setup/implementation
« Reply #9 on: January 09, 2016, 03:15:11 AM »
They are both concerned about it as a fire hazard, and a risk for getting hacked. It is never on when we leave home either  :o

It worked to bring the PC out of sleep and log in, but as you said James VC acted a little strange.

It didn't wake me, it didn't react to the old eventTimer that I set last night, and it didn't set a new timer when I woke it...

Changed the code to the following:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<command id="446" name="CheckForAlarmTime" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Map.Get</cmdType>
    <params>
      <param>AlarmPermaVar</param>
      <param>AlarmTime</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.SetEventTimer</cmdType>
    <params>
      <param>{LastResult}</param>
      <param>WakeupCall</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>VC.Loaded</event>
  <event>VC.RebuildComplete</event>
  <event>Unfocused.Idle</event>
</command>

Wonder if it will work now when I set it to react to Unfocused.Idle (it will try to set a new eventTimer when it wakes). Else I guess that I will have to Restart VC using my task to wake the computer, it sets a new timer then (confirmed)!

@PegLegTV

Solved it! It worked with Windows task scheduler! Thanks for the tip!


Thanks for all the help!

By the way, James... Your wife told me that there was alternative solutions to make a pause instead of VC.Pause. Can you tell me any?

Best Regards and thanks for your time!

Oskar
What you can´t do now... Go learn it!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: My current setup/implementation
« Reply #10 on: January 09, 2016, 03:08:16 PM »
The reason for why I wait 500 ms is because my VoxCommando froze when not using the delay... I don't remember what else it was good for except to avoid interference when I have my speakers on...
It's odd.  I can't see why it would freeze, but if it did, I don't see how adding VC.Pause would prevent the freezing.  All it would do is guarantee that it would freeze for 1/2 second everytime your TTS started.  Maybe you can try it again without the pause to see if it works.  An even better solution would probably be one of the following:

A) When TTS starts talking, mute your microphone.  There is an action for setting the microphone input level.  When TTS stops, reset the input level to whatever you prefer.  This technique will work with almost any microphone.  There are a few microphones that don't actually respond to a change in their input level but they are rare.

B) Select the option in the TTS plugin settings to "disable speech recognition during TTS.SpeakSync" and then use TTS.SpeakSync in most of your commands.  Of course this will freeze VC while it is talking but I've never seen this cause a problem yet.  This will not be a good option for you if you want to use the "Talking Head".

VC.Pause is dangerous, as you say. I wish that I had some other way to pause, like C#'s wait(1000); (think it is C#, can program in seven languages, witch is difficult to keep apart). Can you give any tips?

Ah... if only it were as simple as that.  Asynchronous programming in a UI driven program is much more complicated than simply calling wait instead of delay.

Still for longer wait times we do have options.  It is up to you what is an acceptable amount of time to use VC.Pause which will temporarily freeze VoxCommando.  For me, I would say 500 is my limit before I would start looking for other options.

For long delays the best and safest solution is to use an event timer (VC.SetEventTimer) to trigger a command.  You can also pass this new command payloads which is handy and there are ways to cancel the timer too.

But there are occasionally times when you really want to just use VC.Pause anyway and it is possible to do it asynchronously so that VC will not freeze up.  In order to do this you can rename your command so that it starts with ++ (two plus symbols).  My advice to all users, and the reason why this feature is not documented in the wiki, is to only use this when you really need it, in order to avoid the possibility of errors caused from multiple threads interfering with each other.

Have fun and play safe!  :biglaugh
« Last Edit: January 09, 2016, 03:34:53 PM by nime5ter »

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Re: My current setup/implementation
« Reply #11 on: January 10, 2016, 05:03:24 AM »
Thanks!

I will try it without the pause, and I think alternative A :)

The ++ I will try, but school just started, so I have only one hour of programming per week left :(

Thanks for all the help and the great program

Oskar Stenberg
What you can´t do now... Go learn it!

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Re: My current setup/implementation
« Reply #12 on: February 16, 2016, 03:59:13 AM »
I just made the sound.up(grad) as a new type of command.

I am now using Sound.setVolume() and then VC.setEventTimer and now it works great!

Thanks for all the help and this amazing program!
What you can´t do now... Go learn it!

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Re: My current setup/implementation
« Reply #13 on: March 01, 2016, 04:43:01 PM »
It's odd.  I can't see why it would freeze, but if it did, I don't see how adding VC.Pause would prevent the freezing.  All it would do is guarantee that it would freeze for 1/2 second everytime your TTS started.  Maybe you can try it again without the pause to see if it works.  An even better solution would probably be one of the following:

A) When TTS starts talking, mute your microphone.  There is an action for setting the microphone input level.  When TTS stops, reset the input level to whatever you prefer.  This technique will work with almost any microphone.  There are a few microphones that don't actually respond to a change in their input level but they are rare.

B) Select the option in the TTS plugin settings to "disable speech recognition during TTS.SpeakSync" and then use TTS.SpeakSync in most of your commands.  Of course this will freeze VC while it is talking but I've never seen this cause a problem yet.  This will not be a good option for you if you want to use the "Talking Head".

Ah... if only it were as simple as that.  Asynchronous programming in a UI driven program is much more complicated than simply calling wait instead of delay.

Still for longer wait times we do have options.  It is up to you what is an acceptable amount of time to use VC.Pause which will temporarily freeze VoxCommando.  For me, I would say 500 is my limit before I would start looking for other options.

For long delays the best and safest solution is to use an event timer (VC.SetEventTimer) to trigger a command.  You can also pass this new command payloads which is handy and there are ways to cancel the timer too.

But there are occasionally times when you really want to just use VC.Pause anyway and it is possible to do it asynchronously so that VC will not freeze up.  In order to do this you can rename your command so that it starts with ++ (two plus symbols).  My advice to all users, and the reason why this feature is not documented in the wiki, is to only use this when you really need it, in order to avoid the possibility of errors caused from multiple threads interfering with each other.

Have fun and play safe!  :biglaugh

I now remember why I had that pause in, it was because there is a 300 ms input delay to my stereo (due to old audio-processing circuits), so that will continue to talk after VC is done!

Thanks again

Oskar

Ps. Can you maybe take a look at my new post on the support page, since you and your wife has already helped me so much with the AlarmClock command group? I will post a HUGE improvement to that script as soon as that is solved.
What you can´t do now... Go learn it!