I am not sure how to code in Python but i wanted to explore this idea. The reason i want to make a pluggin, is the ability to take a voice command send it to eventghost and the parse it. I already use the HTTP Send to eventghost and i am able to process only one command at a time.
I would like to be able to handle multiple commands: Turn off the light and turn off the computer. The pluggin would recognize the word "and" and split it up into two events and send them seperatly.
Turn off the Light
Turn off the computer.
Is this already implemented? Any one have any pointers of where to start?
Thanks,
Flyingsubs
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
A Regex Plugin for Events
-
Flyingsubs
- Experienced User
- Posts: 127
- Joined: Sat Dec 29, 2012 11:26 pm
Re: A Regex Plugin for Events
well, you won't need a plugin to split a command into two...
your HTTP request in EG sould look like: HTTP.command [u"Turn off the light and turn off the computer"]
You can just use a phyton script like:
this will generate the two events:
Turn off the light
turn off the computer
(not tested)
your HTTP request in EG sould look like: HTTP.command [u"Turn off the light and turn off the computer"]
You can just use a phyton script like:
Code: Select all
data=eg.event.payload[0]
data=data.split(" and ")
i=0
while i<len(data):
eg.TriggerEvent(data[i])
i+=1Turn off the light
turn off the computer
(not tested)
-
Flyingsubs
- Experienced User
- Posts: 127
- Joined: Sat Dec 29, 2012 11:26 pm
Re: A Regex Plugin for Events
Oooh, thats a good idea. Thank you. I guess since all incoming payloads are http., i should have it always check for the "and". What if i wanted to do 3 commands in one sentence. How would the script differetiate? I guess for every "and" its splits the payload.
Well at least i have something to play around with and try out myself. Thanks again!
-Flyingsubs
Well at least i have something to play around with and try out myself. Thanks again!
-Flyingsubs
Re: A Regex Plugin for Events
you're welcome!Flyingsubs wrote:Oooh, thats a good idea. Thank you. I guess since all incoming payloads are http., i should have it always check for the "and". What if i wanted to do 3 commands in one sentence. How would the script differetiate? I guess for every "and" its splits the payload.
Well at least i have something to play around with and try out myself. Thanks again!
-Flyingsubs
Two times " and " will generate 3 events and so on...
-
Flyingsubs
- Experienced User
- Posts: 127
- Joined: Sat Dec 29, 2012 11:26 pm
Re: A Regex Plugin for Events
I really want to get into the python side of eventghost. I have a few stability issues that I think would be fixed if i coded in python. Every so often a macro executes but doesn't do everything the macro was suppose to do. IE execute another macro. Seems like i might be extending the limitations of eventghost.
-Flyingsubs
-Flyingsubs
Re: A Regex Plugin for Events
Do it, python is a nice programming language and there are many tutorials in the web!Flyingsubs wrote:I really want to get into the python side of eventghost. I have a few stability issues that I think would be fixed if i coded in python. Every so often a macro executes but doesn't do everything the macro was suppose to do. IE execute another macro. Seems like i might be extending the limitations of eventghost.
-Flyingsubs
