Announcement

Collapse
No announcement yet.

Triggering Events with Virtual Devices

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Triggering Events with Virtual Devices

    Here's a step-by-step on how to create a virtual device that can be recognized by the Alexa app and used to trigger events based on On or Off requests.

    In theory the virtual device could also be set to dimmable and be used to control anything that takes a value between 0 and 100. (Like audio volume)


    Creating a Virtual Device:

    1. On the Top Menu, Click on View->Device Management

    2. On the upper right of the page, Click on the green "+" button to create a new device.

    3. Name the device in the pop-up window and click submit.

    4. If you use it set a location2.

    5. Set the location for your device.

    6. Leave "Code" blank

    7. Set Address to something meaningful but unique (i.e. virt-001)

    8. Make sure all the options are unchecked except "Voice Command" which should be checked if you want to use this device with Alexa.

    9. Click on the "Advanced" Tab and type "Virtual" in the field "Device Type (String)".

    10. Click on the "Done" button at the bottom of the page to create the device.


    Creating an Event that Triggers based on a device change:

    1. On the Top Menu, Click on View->Events

    2. Click on the "Show All" button on the upper-right of the page.

    3. Click on the green "+" button next to "Event Groups" to create a new group.

    4. In the pop-up windows name the group and click submit.

    5. Click the green "+" button next to "Events" to create a mew evemt.

    6. In the pop-up window type the name of the event and click submit to create the event.

    7. Select something meaningful for "Type" or leave it blank.

    8. Select If "A Device's Value is..." and under (Choose Another) Select "This device had it's value set to..."

    9. Under (Select A Device) select the virtual device created above.

    10. Under 'is set to' select "On" or "Off"

    11. Make sure the condition is set to "THEN" and under (Choose an Action) Select the action you want.

    12. I generally select "Run a Script or Script Command" since most of my actions are controlled by scripts. Click "Edit" to choose a script to run and fill in the sub or function as well as any script parameters needed.

    Feel free to ask questions.

    --Ken
    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

    #2
    This is helpful. Do I need to set up new events if i already have events set up to operate the system?

    Comment


      #3
      It depends on what you are using to trigger the events you already have setup. You may want to set up separate events for your virtual devices based on device value change of the virtual device and then just set the action to "Run Another Event" to run the events you already have setup. This will keep the actual event logic all in one place.
      "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

      Comment


        #4
        I am triggering events to send ir codes to my audio system. I was just able to add it to the existing ones. Works great thanks.

        I also have separate events for volume up and volume down, but you have to run each of them one step at a time. Any suggestion as to how to make it a true volume up and down, like a slider or enter a value 1-10

        Comment


          #5
          Originally posted by billbingaman View Post
          I am triggering events to send ir codes to my audio system. I was just able to add it to the existing ones. Works great thanks.

          I also have separate events for volume up and volume down, but you have to run each of them one step at a time. Any suggestion as to how to make it a true volume up and down, like a slider or enter a value 1-10
          Make the virtual device dimmable with control type of slider. You will have to provide a range of volume settings like 0 to 100%. Just look at one of your existing devices that has a slider, like a dimmable light.

          Then you should be able to tell Alexa to set the volume to 50%.

          Comment


            #6
            Bill (and Will),

            One of the tricky things about changing volume via IR is knowing your starting and ending points. If you're only controlling your volume via HomeSeer then you can sort of rely on a device value and then calculate the number of steps up or down to get to the desired volume. If your sound system supports discrete volume setting via IR then it's a lot easier since you can just calculate what 50% is and send the discrete value. If you're also using an IR remote to control your sound system then you can't rely on a HomeSeer device value since it will likely be out-of-sync with your sound system.

            My setup is a bit different. I have a Denon AVR-4308CI that has both Ethernet/Wifi and an RS323C port. The Ethernet/Wifi allows telnet commands to be sent to the AVR but doesn't support local change feedback unless a telnet session is active. I really wish they would have just used UDP messages since UDP is session-less, but I digress. Instead I use the RS232C port connected to a Serial-Ethernet adapter along with COM port redirector software on my HS system to connect to the AVR. Since this connection is always active I can not only query and control the AVR but I get status updates every time something is changed whether it's via serial command, the front control panel, or IR remote. I have a serial callback script that processes all the status messages and keeps the HomeSeer virtual devices in-sync with the AVR settings. The Denon also supports direct volume control so when I ask Alexa to set the kitchen volume to 50% the virtual device set value is converted to a Denon volume value of -30 (0 to 100 = -80 to +20) and then sent to the Denon just like sending a command to any other serial device.

            Because the Alexa set, raise, and lower directives require an ending position you have to figure out a way to calculate the number of up or down steps needed if your sound system doesn't support discrete volume setting.

            --Ken
            "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

            Comment


              #7
              Triggering Events with Virtual Devices

              To minimize the problem of keeping the HS volume adjustment "in sync" with a remote, I send 10-12 volume down commands from HS3 to make sure the volume level is zero regardless of its previous volume level. I then send the appropriate number of volume up commands to bring the volume to my desired level. I do this every day for my whole house audio system when it turns on. It has worked well for me for many years.

              Steve Q


              Sent from my iPad using Tapatalk
              HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
              2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

              Comment


                #8
                Good suggestion Steve. That reminded of the X10 trick I used to do with lights. Before X10 devices allowed preset dim levels I'd dim a lamp down to zero instead of turning it off. When I wanted it to ramp up I'd start from zero and walk it up to the desired light level.
                "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                Comment


                  #9
                  Triggering Events with Virtual Devices

                  Yeah, there are lots of ways to get stuff to work. X10 technology got labeled as "unreliable" because of noise on the power line caused by other appliances. "Wall warts" were a huge contributor to this noise 10-15 years ago. Today there is much less power line noise because of better electronics design. So now x10 is still a good choice for a lot of less critical device control. I think it is interesting how much x10 discussion is still occurring on this board. I think x10 will still be around years from now[emoji3].

                  Steve Q


                  Sent from my iPad using Tapatalk
                  Last edited by Steve Q; January 9, 2017, 03:43 PM.
                  HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
                  2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

                  Comment


                    #10
                    Omitting "on" or "off" in the command?

                    Thanks for the guide, it works great! One question I have - it is possible to configure this to NOT require "on" or "off" in the command? My example - I created a virtual device called "Tell kids to get up" which triggers an Event that does TTS through Sonos speakers in my kids rooms to play a chime and tell them to get up. Then it turns the virtual device off. If possible, I would like to be able to say 'Alexa, tell kids to get up" rather then "Alexa, tell kids to get up ON". Is it possible to create a custom command that does not require explicit "on" or "odd" instruction?

                    Comment

                    Working...
                    X