[SOLVED] Get Alexa responses that contain a variable value taken from a script.

  • Hi everyone,

    Greetings from Brazil.
    Can I receive responses from Alexa that contain a variable value taken from a Python script, for example?

    A simple example:

    I ask Alexa what time my workday should end. Through a routine.
    A Python script runs and returns the end time to Alexa, and she responds:
    "Your workday ends at $endtime"
    "Your workday ends at 17:06"

    It's possible?

    Thanks in advance.
    Best regards,


  • After searching the forum, I found some tips that led me here.

    I have created a simple python script.

    from the Popen import thread
    result = 'Nineteen'
    Popen("C:\\Users\\PS\\.TRIGGERcmdData \\SendResult.bat "+str(result))

    The file "results.log" is written with a new line:

    {"data": [{"name": "Result", "voice": "Result", "voiceReply": "Executing {{trigger}} on {{computer}} with {{result}}", "allowParams ": false," user ":" MY_USER "," computer ":" MY_COMPUTER "," switch_is_on ": false," runCount ": 3," createdAt ":" 2020-10-16T04: 13: 20.240Z "," updatedAt ":" 2020-10-16T04: 30: 55.695Z "," lastResult ":" Nineteen "," id ":" MY_ID "}]," message ":" Result of command updated successfully. "}

    But Alexa doesn't answer anything. Could you help me?```

  • @psandimp, you can use these fields in the Voice Reply field:

    • {{trigger}}
    • {{computer}}
    • {{params}}
    • {{result}}

    Please try this python script:

    import os
    result = 'Nineteen'
    sts = os.system(os.environ['USERPROFILE'] + "\\.TRIGGERcmdData\\SendResult.bat "+str(result))

    I said, "Alexa, ask triggercmd to run result."
    Alexa replied, "Result is nineteen."

    I tested with these command settings:


    This only works with the non-Smart Home Alexa skill / Google action.

  • Dear @Russ,
    The problem has been solved.

    I was trying to run this command through the TriggerCMD Smart Home Skill.
    I just switched to the non-Smart Home Alexa skill and it worked great.

    Thank you so much!
    Best regards,

  • Awesome @psandimp. Yea I think probably a lot of people start using one skill and they don't realize the other one exists.

Log in to reply