GithubHelp home page GithubHelp logo

Running python script about python-sdk HOT 15 CLOSED

sinricpro avatar sinricpro commented on July 17, 2024
Running python script

from python-sdk.

Comments (15)

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

@ChopsKingsland

This error occurs when the deviceId pattern is wrong.
Can you share the code snippet by hiding your

  • appKey
  • secretKey

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

I’ve got it working now by changing the device type to light. How do I make it do something when it turns on/off?

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024
def onPowerState(did, state):
    # Alexa, turn ON/OFF Device
    if did == "<your deviceId>" and state=="ON":
             # Do something
    elif did == "<your deviceId>" and state=="OFF":
             # Do something
    return True, state

You can define logic like this.

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

I did that, and I now get an error about indentation. I've tried every single combination of indentations and it still doesn't work >:(

    elif did == lightId and state=="OFF":
       ^
IndentationError: expected an indented block```

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

Which editor do you use?

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

Thonny on RPi

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

Don't copy the code. Try typing it from scratch.

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

it doesnt show an error anymore, but when i turn it on/off, nothing happens. How can I make it work?

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

Just put a print statement and check what data you are getting.

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

only on and off as i should be. i tried it printing 1 & 2 but nothing happened

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

Did you try with web console?

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

Or mail me your code at [email protected] . I'll check whats wrong

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

app-for-github.txt

from python-sdk.

thegoliathgeek avatar thegoliathgeek commented on July 17, 2024

@ChopsKingsland

Code is fine

Just change "ON" --> "On" and "OFF"-->"Off"

Screenshot 2020-04-02 at 12 32 40 AM

from python-sdk.

ChopsKingsland avatar ChopsKingsland commented on July 17, 2024

THANKS! 😁 it works!

from python-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.