VoxCommando - Control Vera by Voice

Hi waynehead99

I’m not sure if this question is directed at me but is that is the case, I must say I don’t really understand what you are asking. First of all I’m not familiar with the PLEG plugin (assuming that’s what you are referring to), nor do I know if Vera can poll these conditions. I don’t see what it has to do with VoxCommando, but you are mentioning “actions” which is a VC term so I am thinking that you are probably asking something about VoxCommando.

If this is a question for me, please clarify it for me with the understanding that I’m not familiar with “PLEG”.

@Waynehead99 I think the current VoxCommando plugin aren’t setting/querying the TemperatureSetpoint1_Cool or TemperatureSetpoint1_Heat…so you would need to do this with the VoXCommando Vera.Raw command and write your own logic…or perhaps this support will be added in the future like getting the thermostat temperature (not cool or heat set point).

From Rex’s Sample Code, here are the key items:
http://forum.micasaverde.com/index.php/topic,18679.msg152234.html#msg152234

Thermostat
Set ModeTarget, read ModeStatus. “Off”, “HeatOn”, “CoolOn”, “AutoChangeOver”.

Code: [Select]
local mode = luup.variable_get(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”, “ModeStatus”, dID)

luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”, “SetModeTarget”, {NewModeTarget = “Off”}, dID)

Set and read CurrentSetpoint. (Degrees)

Code: [Select]
local setpoint = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”, “CurrentSetpoint”, dID)

luup.call_action(“urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”, “SetCurrentSetpoint”, {NewCurrentSetpoint = “25”}, dID)

local setpoint = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSetpoint1_Cool”, “CurrentSetpoint”, dID)

luup.call_action(“urn:upnp-org:serviceId:TemperatureSetpoint1_Cool”, “SetCurrentSetpoint”, {NewCurrentSetpoint = “30”}, dID)

HAL Version 1 … used Microsoft Speech engine … It interrogated Vera to see what devices were available … and built the grammar dynamically.

The HAlServer was like VoxCommando … I actually had two remote microphone clients … one for windows and one for android. Of course the WIndows one could be on the same machine as the server … but did not have to be.

The voice recognition was better with the Android client than a local microphone on windows … because of the digital signal processing in the phones to eliminate background noise.

I no longer support it … I now use Voice Recognition on my Android phone directly (New HAL Version II)

If you want to get some ideas check out the old Website is:
http://rts-services.com/HalServer

To see the type of grammar see:
http://rts-services.com/HalServer/Help.html

An example generated grammar file is at:
http://rts-services.com/HalServer/Test.grxml

[quote=“AgileHumor, post:22, topic:177473”]PLEG is Program Event Logic Generator used to perform advanced scenes on Vera, however it won’to come into play with what he is asking.
http://forum.micasaverde.com/index.php/board,48.0.html[/quote]
I was responding to waynehead99 who was specifically asking about PLEG so obivously he thinks that it comes into play but I don’t understand in what way he thinks it relates to VoxCommando. But maybe his question was not about VoxCommando.

Hi @jitterjames

Thanks for agreeing to look into adding some more device type functionality e.g HVAC on a future release.

Can we help you create a default set of commands too to maybe help others who enable the plugin? Just a few basic default ones for Dimming and On/Off could be good

Thanks very much for the offer but I think this should be pretty straightforward for us to do ourselves. I already have these commands made, it is just a question of organizing them into a default configuration and including them in the installer, which I will do. I have been spending most of my time on a beta release of VC 2.0 or I probably would have done this already.

What would probably help though, is if I proposed a standard set of “starter” commands and could get some feedback from all of you. I think that what AgileHumor has already done is probably pretty close to what I would do for the basic commands.

At some point I will also create a tutorial showing basic setup for newbies and some details on customizing the events in the plugin etc.

I am certainly interested in continuing to add to the functionality of the plugin and am pleased to see interest growing in this community. It is a great motivator for me.

James

I brought up pleg to confuse you. Sorry about that. Basically what I am asking is that Vera can do notifications and send those out via text or email or another plug in. In either case there is a notification being triggered and that’s what I am curious if it can be polled. So we can see events in Vc from Vera and trigger actions based on those. I would like to be able to trigger events based of notifications the same way. So I have a condition to let me know my garage door is open after a certain period and it sends me a push thru Vera. I want to poll that notification in Vc and create a tts action.

Well it worked! :stuck_out_tongue:

I don’t know of any way to poll Vera to see what email notifications it is sending.

I do know how to recognize events generated by Vera when device or scene states change (or is it status? I can’t keep those straight)

I do know that you can send messages to VoxCommando using UDP, TCP, or HTTP messages. To send a message to VC using luup code is quite easy, so if you were creating your own scene in Vera you could send a message to VoxCommando.

I believe you can also send messages to VoxCommando using the Vera alerts plugin for Vera. But unless PLEG allows you to customize how or where notifications are sent so that you can redirect them to something other than an email I don’t see how you can use that.

How are you currently doing this?

I have a scene triggered that has a notification attached to it. I use Vera alerts to send a push to my phone.

I would need to look at the logs to see what is writin when a notification is triggered that may help but my coding skillz consist of knowing binary contains 0 and 1 and not much more. So I may be asking for something that can’t be done.

If a scene is triggered, then VC will trigger a scene event automatically, which you can assign to a command. I’m not sure why that does not solve your problem right there.

Or does something happen within the scene, where it then decides whether or not to send the notification? Is this where PLEG comes in? Does PLEG kick in when the scene is triggered and then call the Vera Alerts?

The more information you can give me the faster I will be able to come up with a solution.

Sorry about that, multitasking…

Anyways, I just tested having the garage door send me an alert that it was opened. I use PLEG (which if you own vera and don’t have this, you are crippled on functionality) to create complex conditions (IE turn lights off after x amount of no motion being sent and during the night). Vera doesn’t allow for this function easily without Lua coding which as you know, I can’t do.

I looked at the logs and I see where PLEG marked the condition as true (amongst telling the status of all my other conditions, so this isn’t a viable option i don’t think to trigger off of), but I don’t see any notification trigger from VERA in the logs.

So, you can see from my screenshot, that PLEG is still creating a trigger in vera. I do use vera alerts to push my notifications (PLEG and vera alerts were designed by the same person so they integrate well), but it still looks like at its core, its still using vera code to generate the notification since the alerts are in the vera UI… again I could be wrong and RTS step in if you see this and I am.

I thought there would be something in the logs for when the notification was being generated and I could spark an event in VC based on that, but now that I am digging into it, my brain can’t figure out how it would even be possible. If Vera Alerts can do this, that may be a doable approach to my ask.

OK. That mostly confused me more, and I don’t really feel that you actually answered my question, but anyway, it seems that detecting the activation/deactivation of Scenes or the changing of device states does not meet your needs.

In that case, you can use VeraAlerts to send a message to VoxCommando:

  • Create a new VeraAlerts profile of type: Vera-Alerts-LAN
  • Rename it to VoxCommandoAlert or similar if you want
  • Set the IP to the address of your VoxCommando machine on the LAN
  • You can use any port you want but I used the default of 2048 which is a nice round number.
  • Do whatever else you need to do to make sure this is being triggered / sent by PLEG etc. as you would with your other Vera Alerts.

In VoxCommando you need to enable the TCP plugin and then add this command to your tree:

<?xml version="1.0" encoding="utf-16"?> <commandGroup open="True" name="TCP Vera Alerts" enabled="True" prefix="" priority="0" requiredProcess="" description=""> <command id="245" name="create server to listen for Vera Alerts" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description=""> <action> <cmdType>TCP.Server.Start</cmdType> <cmdString>2048</cmdString> <cmdRepeat>1</cmdRepeat> </action> <event>VC.Loaded</event> </command> </commandGroup>
This command will execute automatically when VC starts and create a TCP server that listens for messages on port 2048.

What message you send exactly and what you do with it once it gets to VC is another story but probably worth crossing the first bridge or two before worrying about that

…but for example your VeraAlerts profile could use a message prefix of tts.speak&& and then VC would speak your notifications out loud. Or if you wanted to be able to trigger commands you message prefix could be something like: VC.TriggerEvent&&VeraAlert.

What you propose with Vera alerts serves my needs. Thank you.

Definitely check out pleg. A much needed plugin.

Hi @Jitterjames

Do you actually need Vera Alerts, could you not just send/post some text over a specified IP/port to VoxCommander. (As I’m not that technical, I may have got the terminology wrong.)

I wasn’t able to get this to work.

Vox is working…but I can’t telnet (it OK’s after every charachter) or use the VeraAlerts settings.

Screenshots attached

[quote=“jitterjames, post:28, topic:177473”]I do know that you can send messages to VoxCommando using UDP, TCP, or HTTP messages. To send a message to VC using luup code is quite easy, so if you were creating your own scene in Vera you could send a message to VoxCommando.

I believe you can also send messages to VoxCommando using the Vera alerts plugin for Vera. But unless PLEG allows you to customize how or where notifications are sent so that you can redirect them to something other than an email I don’t see how you can use that.[/quote]

I’m not able to test it, but would something like this work from Vera.

[code]local socket = require(“socket”)
host = “192.168.1.25”

local sensor = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 5)

c = assert(socket.connect(host, 2048))
c:send(“the temperature is now,” … Sensor)
c:close()
[/code]

I think yes.

waynehead99 was pretty specific that he did not want to use luup. But if you want to, then it’s easy enough.

What you posted would probably also work fine, except that I haven’t tested it, and I happen to like UDP. VC is always listening for UDP without needing to enable a plugin.

@AgileHumour: when did Telnet come into it?

@jitterjames I typically use this to test TCP IP sockets commands like VMCController.

I do make a connection so it’s not a firewall, but per the example settings (and the VC code for the tcp socket)…it is currently not working with Vera Alerts as described in my screenshot (at least the test message).

@waynehead99 I just found out a day or two ago PLEG now supports Luup Code now in actions. Would a Luup method work better if that is the case?

I was just looking for a way to trigger an action in VC based off a notification in Vera. Doesn’t matter what’s producing the notification so luup for my case. Plus I am not big on coding. If I can trigger events with Vera alerts my needs have been met.