Help, web programming EVOK Unipi !!!



  • EVOK I want to know which method I can use to make a (Program) to control Unipi from the browser.

    python json not work for me
    pytthon WebSocket not work

    So I would like to know which method and recommend programming language (EVOK) to tell my Unipi example, that when detecting a DI, the program will turn on one relay

    Unipi documentation of the web, proposed methods do not work, I know because I tried.

    a greeting to the community and any help is appreciated thanks



  • EVOK I want to know which method I can use to make a (Program) to control Unipi from the browser.

    python json not work for me
    pytthon WebSocket not work

    So I would like to know which method and recommend programming language (EVOK) to tell my Unipi example, that when detecting a DI, the program will turn on one relay

    Unipi documentation of the web, proposed methods do not work, I know because I tried.

    a greeting to the community and any help is appreciated thanks



  • Evok supports three ways of interfacing with the physical deivces: websocket (recommended), jsonrpc and HTTP REST.

    It is up to you which program you want to use but there are many solutions online for home automation that are compatible with evok (or only the UniPi), See http://unipi.technology/software/ + pimatic and other...



  • beboop0110,
    I found it easiest to get it working with the REST interface with Python. I needed the URLLIB module included, and off it went. The important lines in Python were:

    url='http://0.0.0.0/rest/relay/'+str(Relay)
    print ('URL = ' + url)
    unipi = urllib.request.urlopen(url).read()
    print ('Current Status = ' + str(unipi))

    if the light is on, turn it off.

    and if it's off, then turn it on

    if State == 1:
    data = urllib.parse.urlencode({b'value':'1'})
    else:
    data = urllib.parse.urlencode({b'value':'0'})
    bdata = bytes(data,'utf-8')
    r = urllib.request.Request(url, bdata)
    params = urllib.request.urlopen(url,data=bdata).read()

    Hope this helps! NOTE: This is not the whole program, just the important few lines.
    Merv.



  • Thanks for the indications have been very helpful to me, I'm no expert and could not handle.

    I could solve the problea with websocket installing the module (apt-get install python-websocket)

    Then run the script to test the EVOK sample page (python adn websocket)

    and it worked perfect

    https://www.howtoinstall.co/en/debian/j ... websocket/

    now websocket found !!! =)

    thanks !!!