TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Take variable from voice into Python

    Scheduled Pinned Locked Moved Alexa
    2 Posts 2 Posters 715 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      Itricio
      last edited by

      So basically, I want to take a number I say to Alexa (specifically int), and make a variable from python, that number. Is this possible, and if it is, how can I do it? Thanks

      RussR 1 Reply Last reply Reply Quote 0
      • RussR Offline
        Russ @Itricio
        last edited by Russ

        @Itricio, you'll need to use one of the non-Smart Home skills - either TRIGGERcmd, or TRIGGER command. The Smart Home skills only pass "on" or "off" as the parameter.

        Here's a script that takes a parameter, and passes it back to TRIGGERcmd so you can have Alexa say the parameter back to you if you include {{result}} in the Voice Reply field.

        import sys, os
        
        if(len(sys.argv) > 1):
            first_param = sys.argv[1]
            print('Sending parameter to TRIGGERcmd for Alexa or Google Assistant to speak: ' + first_param)
            sts = os.system(os.environ['USERPROFILE'] + "\\.TRIGGERcmdData\\SendResult.bat " + first_param)
        else:
            print('No script arguments/parameters.')
        

        Assuming you give your script the word "script" in your voice field, say, ""Alexa, ask triggercmd to run script with parameter five."

        Here's some more about using the Voice Reply command field:
        https://www.triggercmd.com/forum/topic/962/solved-get-alexa-responses-that-contain-a-variable-value-taken-from-a-script/4

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • tuicemenT tuicemen moved this topic from Instructions on

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post