UniPiTechnology / evok

API of Unipi controllers
http://www.unipi.technology
Apache License 2.0
101 stars 39 forks source link

EVOK WebSocket inconsistences #71

Closed StevenBrs closed 4 weeks ago

StevenBrs commented 5 years ago

Prerequisites

Log files needed

No reflection of this issue in log files ; all necessary processes running

Description

WebSocket answers are not consistent

Steps to Reproduce

Setup : M203 with EVOK installed on raspbian + xS10 extension with hard-set serial settings

1a. Throw a message to the websocket to switch-on LED1 on M203 unit (or LED2, 3 and 4) 2a. Throw a message to the websocket to switch on Relay 2_01 on M203 unit 3a. Throw a message to the websocket to switch-on LED2, 3 or 4 on xS10 extension (not LED1)

Expected behavior: [What you expected to happen]

1b. WS Answer : {"glob_dev_id": 1, "dev": "led", "circuit": "1_01", "value": 1} 2b. WS Answer : {"modes": ["Simple"], "relay_type": "physical", "value": 1, "glob_dev_id": 1, "dev": "relay", "circuit": "2_01", "pending": false, "mode": "Simple"} 3b. WS Answer : {"glob_dev_id": 1, "dev": "led", "circuit": "UART_1_02", "value": 1}

Actual behavior: [What actually happened]

1b. All OK: Led is switched on, and the new status is published on the websocket 2b. Relay is switched on, but all statusses for all relays in that group are published, causing an overload of messages on the websocket, creating other problems (especially when switching multiple relays at the same time) 3b. LED is switched on, no new status-message is received from WebSocket, new state is not reflected in controlling software

Also see bullet-point 2 of this forum post : https://forum.unipi.technology/topic/766/evok-websocket-bugs-problems

StevenBrs commented 5 years ago

I forget about the "full" command in my expected behavior description.

"set" command: should just do what was asked (turn on led/relay/...) "full" command should do "set" + publish new state on the websocket, preferable only for the mentioned output and not the whole group

wimstockman commented 4 years ago

Found a small bug in the websocket "full" command. It returns a dictionary rather then a list containing a dictionary so if you are processing all the incoming message as a list you miss the "full" messages. I will sent a pull request to fix it. and update my websocket examples. kind regards

martytriska commented 4 years ago

Yes, you are right. There is a bug in ws return value format for Unipi1.x. Since the fix is an api-changing modification, it will be introduced in the following major version release.

kratochvil01 commented 1 month ago

This problem is solved in Evok v3.