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

    Problem with get_relay and jsonrpclib

    Scheduled Pinned Locked Moved Official API - Evok
    8 Posts 2 Posters 4.4k Views
    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.
    • Hen RiH
      Hen Ri
      last edited by

      Hello everyone,

      I'm a new user of Unipi and to begin with this board, I bought a Unipi 1.1.
      I had a Raspberry running Raspbian GNU/Linux 9.1 (stretch)
      and I used the last version of Python to code (3.5.1).

      I install the 2.0 EVOK version according to the installation method available on github.
      Then because I use python 3.5, I had problem with the jsonrpclib, so I uninstall the jsonrpclib and i install instead jsonrpclib-pelix. (https://forum.unipi.technology/topic/257/error-using-jsonrpclib/6)
      And i used this workaround (https://forum.unipi.technology/topic/86/relay-command-with-python/3) because i had an error.

      The web interface works well.

      I try this code: (find here : https://wiki.mchobby.be/index.php?title=UniPi-EVOK-API)

      from jsonrpclib import Server
      s=Server("http://192.168.1.16:8080/rpc")
      s.relay_set(1,1)
      print(s.relay_get(1))
      s.relay_set(1,0)
      print(s.relay_get(1))
      print(s.ai_get(1))
      

      The relay is working.

      But :
      My result print 3 times "None".

      Is anyone know anything ?
      It seems to be related with the workaround.
      Should i continue with jsonrpclib or start with the websocket-client library?

      Thanks a lot.

      Kind Regards, Henri

      1 Reply Last reply
      Reply Quote 0
      • T
        TomasKnot
        last edited by

        The get functions have unfortunately not been updated for Neuron (only UniPi 1.1) yet, so I'd recommend using websocket for reading for now. We'll try to get it done in the bugfix release, which should be sometime next week.

        1 Reply Last reply
        Reply Quote 0
        • Hen RiH
          Hen Ri
          last edited by

          Thank you for the quick answer.

          But according to what you said, beacause i'm using a unipi 1.1, it should work ?

          1 Reply Last reply
          Reply Quote 0
          • T
            TomasKnot
            last edited by

            Oh, that it should. Will try to replicate what you are seeing.

            1 Reply Last reply
            Reply Quote 0
            • T
              TomasKnot
              last edited by TomasKnot

              Unfortunately I cannot replicate the behaviour you are seeing. Using Stretch from 9/7 and the 2.0 EVOK master, along with UniPi 1.1 and the default settings, I can retrieve relay state with the following command:

              from jsonrpclib import Server
              s=Server("http://127.0.0.1:8080/rpc")
              print s.relay_get(1)
              

              Could you try with a clean image?

              E: The response is following:

              [0, False]
              
              1 Reply Last reply
              Reply Quote 0
              • Hen RiH
                Hen Ri
                last edited by

                I'll try in few hours.

                So I will uninstall and reinstall everything.

                Do you agree that I should use jsonrpclib-pelix for python 3.5?
                Do I have to use the workaround that I used before or It should work without it?

                Thanks for the help

                1 Reply Last reply
                Reply Quote 0
                • Hen RiH
                  Hen Ri
                  last edited by

                  OK I totally reinstall the evok API.
                  And it works well know.

                  Thanks a lot.

                  I'm thinking to use a Neuron for my last version of the product I developped, so I hope you'll find the way to correct the bug on Neuron.

                  Thanks

                  T 1 Reply Last reply
                  Reply Quote 0
                  • T
                    TomasKnot @Hen Ri
                    last edited by

                    @Hen-Ri Glad you got it working!

                    The bug is not really very significant - basically some of the function use a different name. It's a matter of adding two lines to the code for each device type.

                    1 Reply Last reply
                    Reply Quote 0

                    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