Problem with get_relay and jsonrpclib
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.
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
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.
Thank you for the quick answer.
But according to what you said, beacause i'm using a unipi 1.1, it should work ?
Oh, that it should. Will try to replicate what you are seeing.
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:
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
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.
@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.