Relay Command with Python

  • Hello everyone,

    I think it is not related to evok itself but to the jsonrpclib. According to the github ... its/master there were some recent changes so please try to install older version of jsonrpclib....

    I am currently in Japan but will be back in two weeks so I will take a look at it then.

  • Dear Community,

    we need to find out why "StringIO()" cant receive "most of the time" the right object(Callback) when changing the relay state!
    Because at the moment I just found a workaround but not a solution for this problem.
    So i would really appreciate if someone have an idea!!!

    Best regards,
    Martin M.

  • Thanks this is working for a while…

  • I have the same problem, do you have any solution?

  • I tried to replicate the issue but did not succeeded. Could you descibe the whole setup (run the script on the same host?, os version?, …)? basicaly everything that might help me to get this error.

  • Hello everyone,
    @Andres atm just a work around but not a real solution.
    @Tomas I ve tested it on a fresh install of RASPBIAN JESSIE and installed your API with "" like in your Guide.
    Then i ve just run my script like described above.
    What do u mean with, "on the same host" ?

  • Ok, now I get it. The new version of debian might be the issue… I have not tested it because a lot of things have changed. I recommend moving back to wheezy...

  • Are we going to get a solution?

  • Like I said. The solution is to get Raspbian wheezy. Jessie is not supported

  • I tried with Raspian Weezy, and a get the same result.

  • Hey again unipi users,

    like i tought… it has nothing to do with the dist version or the jsonrpclib.
    Tomas i ve descripded excatly where the problem cames from, so you just need to find out,
    why the function "StringIO" doesnt get the right callback.
    I dont know how the unipi and Your API are communicating, so its up to you.
    It would be a pleasur if you could find time to explain me your API base, then i also could find out,
    why this problem occours.

    Kind regards,
    Martin M.

  • I would like to help you guys but I still do not have enough information because this issue does not appear in my setup. What RPi do you use? Are you polling the API from the same machine (UniPi) or from different computer? Any other packages installed? What OS+version? Basically anything that might help me to achieve this behavior.

  • Hey guys,

    i just bought one of your UniPis and I am having problems using evok with python.
    I am using a brand new Raspberry Pi 3 B with the very newest Raspbian Jessie.

    my python script:

        from jsonrpclib import Server

    console's response:

    Traceback (most recent call last):
    File "", line 4, in <module>
    File "/usr/local/lib/python2.7/dist-packages/jsonrpclib/", line 288, in call
    return self.__send(self.__name, args)
    File "/usr/local/lib/python2.7/dist-packages/jsonrpclib/", line 237, in _request
    response = self._run_request(request)
    File "/usr/local/lib/python2.7/dist-packages/jsonrpclib/", line 255, in _run_request
    File "/usr/lib/python2.7/", line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
    File "/usr/lib/python2.7/", line 1321, in single_request

    I have enabled the real time clock as described in your wiki ( ... d_software)
    $ sudo hwclock -r
    Fri 27 May 2016 11:59:50 UTC -0.870418 seconds
    so, works.

    I would appreciate if you have any advide for me!

  • ..and my UniPi control panel does not work either. there are no buttons to change the states of any output. maybe this can be a hint about me having forgotten any installation (but i dont think so!)

  • and it may also be interesting to see my i2detect output:

    pi@unipi:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
    20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- UU
    70: -- -- -- -- -- -- -- --

  • okay I am finding more and more information that might be helpful:
    I have this error under http://unipi/rest/relay/1/value
    500: Internal Server Error
    some people wrote about the same issue--it always got solved anyhow, but it could never really determined where the problem comes from.
    i installed with wget and with git, I plugged it to different plug sockets. i am using the delivered power supply.

  • I forgot to put a CR2023 battery on the unipi! damn it i will get one and then come back and tell you if this was the problem!

  • okay..problem stays the same

  • I have even tried it with power supply for unipi and raspberrypi separated. (and I took of the JP1 to test this )

  • I reinstalled from scratch and this time I noticed this warniung

        /tmp/pip-build-m8wmVa/tornado/ UserWarning:
        WARNING: The tornado.speedups extension module could not
        be compiled. No C extensions are essential for Tornado to run,
        although they do result in significant speed improvements for
        The output above this warning shows how the compilation failed.
        Here are some hints for popular operating systems:
        If you are seeing this message on Linux you probably need to
        install GCC and/or the Python development package for your
        version of Python.
        Debian and Ubuntu users should issue the following command:
            $ sudo apt-get install build-essential python-dev
        RedHat, CentOS, and Fedora users should issue the following command:
            $ sudo yum install gcc python-devel
        If you are seeing this message on OSX please read the documentation
          "The output above "
        command 'arm-linux-gnueabihf-gcc' failed with exit status 1
        no previously-included directories found matching 'docs/build'
        warning: no files found matching 'tornado/test/README'
      Running install for toro
        no previously-included directories found matching 'doc/_build'
      Running install for jsonrpclib
      Running install for backports.ssl-match-hostname