EVOK and websockets



  • Hi,

    I am running raspbian jessie recently and I cannot figure out websockets. I can not change relay states trough websocket connection (whic has state connected, aslo if I use websockets as input it works)

    I created simple flow (which gives me trouble):

    [{"id":"c19d5eed.d773c","type":"inject","z":"a5e9eb30.633008","name":"unipiR2on","topic":"unipiR2on","payload":"{\"dev\":\"relay\", \"circuit\":\"2\", \"value\":\"1\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":372,"y":338,"wires":[["d9c4b8fa.078788","af5dc7d8.1bc2e8"]]},{"id":"bad348d9.50a668","type":"inject","z":"a5e9eb30.633008","name":"unipiR2off","topic":"unipiR2off","payload":"{\"dev\":\"relay\", \"circuit\":\"2\", \"value\":\"0\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":382.9000434875488,"y":480.5667152404785,"wires":[["d9c4b8fa.078788","af5dc7d8.1bc2e8"]]},{"id":"d9c4b8fa.078788","type":"debug","z":"a5e9eb30.633008","name":"","active":true,"console":"false","complete":"payload","x":696.0477447509766,"y":179.5238332748413,"wires":[]},{"id":"af5dc7d8.1bc2e8","type":"websocket out","z":"a5e9eb30.633008","name":"","server":"d4a09910.dd7638","client":"","x":778.8095528738838,"y":395.23812430245533,"wires":[]},{"id":"d4a09910.dd7638","type":"websocket-listener","z":"","path":"ws://127.0.0.1/ws","wholemsg":"false"}]
    

  • administrators

    @lukec Please try to add also a paramater "cmd":"set" to the message and le me know. I have to update the example since the API has changed a little bit.



  • True, if "cmd":"set" addet to json string, ws command works.

    Reliability of ws is not as expected - bmo it is beter to use http post methods.

    ps.
    Can you please tell what are other commands in cmd?