Websocket "cmd":"all" not working

  • Re: Problem using cmd:all using Websockets

    it seems that I have the same problems with "cmd":"all"

    def ws_send_all():
        ws = websocket.WebSocket()

    Is the code above ok?

    Also I do not quite understand what the Command "filter" is doing. Please explain.

    Regarding the Command "full" it seems, that no status message comes back. However, when I am setting relay on or off with Command "set" there is a immediate status message comming back.

    kind regards

  • I solved the problem with the rest interface - not with websockets. It feeds directly into the on_mesage Function of websockets and updates all device data.

    unipi_all = urllib.request.urlopen(url_rest).read()
    unipi_all = unipi_all.decode("utf-8")
    unipi_all = json.loads(unipi_all)
    unipi_all = json.dumps(unipi_all)
    unipi_all = json.loads(unipi_all)
    for unipi_dev in unipi_all:
        #print(unipi_dev + "\n")
        on_message(url, unipi_dev)

  • Hi @juntiedt!

    It's hard to know the exact reason for the problems you are seeing from the info you provided, but the most likely possibility is that the input you send to the websocket is in Unicode rather than ASCII; testing this produces the same behavior. This may be caused by the library or environment you use, rather than anything you are doing yourself. We can provide Unicode support quite easily, but it might take a few days to filter into the Git repository/release.

    Also note that each instance has separate listening channels, though delta events are sent on all. This means that closing the instance after you send a message will prevent you from receiving a reply, and that you need to listen on the same connection as you use to issue the commands.

    As for the filter command, it allows you to specify which device delta events you want to listen to. However unless the Unicode issue is solved you will not be able to properly call the command.

    Glad you got it working anyhow, I hope this helps.