Posts: 270
Threads: 72
Joined: May 2017
Reputation:
0
It's almost perfect, but the fact that LM have to send state change after a command received.
i.e. if they send a on/off command on a light (1/1/1, bim-write tagged), they can't receive the state of light (1/1/100, bim-read tagged) when changed.
They should send an explicit read request to 1/1/100, after the command, instead of receive it automatically.
Can we fix that?
Thank you
Peppe
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
This is already implemented. Ask them to check what messages they are receiving when any of the tagged objects change. Maybe the format has to be different from the NotificationPackage that is used as a reply for the read requests.
Posts: 270
Threads: 72
Joined: May 2017
Reputation:
0
(07.06.2021, 09:59)admin Wrote: This is already implemented. Ask them to check what messages they are receiving when any of the tagged objects change. Maybe the format has to be different from the NotificationPackage that is used as a reply for the read requests.
well, at the moment the problem is only on bim-read-write tagged object: they send the command and that's fine, but they don't get no feedback.
Consider they NEVER send read request: all the informations must be actively sent by LM.
Thank you in advance.
Peppe
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Feedback objects must be tagged the same way or it won't be sent. Ask them to check the websocket communication maybe something is wrong there. You can simply change a tagged object value in LM and the value should be sent over the websocket connection.
Posts: 270
Threads: 72
Joined: May 2017
Reputation:
0
I refert to the case in wich an object have no feedback address, like i.e. a Thermostate Setpoint, or virtual objects, and the feedback comes from the same address I use for command. In those cases the object should be tagged bim-read-write, isn't? But they don't works...
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Maybe the payload format must be different. As I've said ask them to check the websocket communication log. As I don't have any tools to test this further I cannot help without any extra information from their side.
You can log what is being sent over the websocket by modifying the sendobjvalue function in the user library. Make sure to do a full script restart via disable/enable after changing the library.
Code: function sendobjvalue(obj)
local data = json.encode({
payload = {
Type = 'NotificationPackage',
Item = {
Name = obj.name,
State = encodevalue(obj.value, obj.dtype),
Type = obj.dtype,
Editable = obj.editable,
Link = ''
},
TimeStamp = timestamp()
}
})
log(data)
wsclient:send(data)
end
Posts: 270
Threads: 72
Joined: May 2017
Reputation:
0
10.06.2021, 08:26
(This post was last modified: 10.06.2021, 08:33 by gdimaria.)
ok.... I show you the logs:
When I change the setpoint (tagged bim-read-write) from LM the log is:
* string: {"Type":"NotificationPackage","Item":{"Link":"","State":"22.00","Type":"NUMBER:FLOAT","Name":"SetPoint","Editable":2},"TimeStamp":"2021-06-10T08:19:01.857Z"}
When they changes the setpoint from their GUI, we transmit:
* arg: 1 * string: {"Controller":"Items","Action":"Post","ItemName":"SetPoint","ItemState":"28"} * arg: 2 * number: 1 * arg: 3 * nil * arg: 4 * nil * arg: 5 * nil
both are correct, but they receive nothing.
they receive every other state from objects tagged bim-read and can execute every command on objects tagged bim-write.
The mistake is only on bim-read-write objects.
(10.06.2021, 08:26)gdimaria Wrote: ok.... I show you the logs:
When I change the setpoint (tagged bim-read-write) from LM the log is:
* string: {"Type":"NotificationPackage","Item":{"Link":"","State":"22.00","Type":"NUMBER:FLOAT","Name":"SetPoint","Editable":2},"TimeStamp":"2021-06-10T08:19:01.857Z"}
When they changes the setpoint from their GUI, we transmit:
* arg: 1 * string: {"Controller":"Items","Action":"Post","ItemName":"SetPoint","ItemState":"28"} * arg: 2 * number: 1 * arg: 3 * nil * arg: 4 * nil * arg: 5 * nil
both are correct, but they receive nothing.
they receive every other state from objects tagged bim-read and can execute every command on objects tagged bim-write.
The mistake is only on bim-read-write objects.
Pardon, when I change from LM, They receive the feedback.
They receive nothing when change from their dashboard, even the command is correctly execute.
Posts: 270
Threads: 72
Joined: May 2017
Reputation:
0
(10.06.2021, 08:26)gdimaria Wrote: ok.... I show you the logs:
When I change the setpoint (tagged bim-read-write) from LM the log is:
* string: {"Type":"NotificationPackage","Item":{"Link":"","State":"22.00","Type":"NUMBER:FLOAT","Name":"SetPoint","Editable":2},"TimeStamp":"2021-06-10T08:19:01.857Z"}
When they changes the setpoint from their GUI, we transmit:
* arg: 1 * string: {"Controller":"Items","Action":"Post","ItemName":"SetPoint","ItemState":"28"} * arg: 2 * number: 1 * arg: 3 * nil * arg: 4 * nil * arg: 5 * nil
both are correct, but they receive nothing.
they receive every other state from objects tagged bim-read and can execute every command on objects tagged bim-write.
The mistake is only on bim-read-write objects.
(10.06.2021, 08:26)gdimaria Wrote: ok.... I show you the logs:
When I change the setpoint (tagged bim-read-write) from LM the log is:
* string: {"Type":"NotificationPackage","Item":{"Link":"","State":"22.00","Type":"NUMBER:FLOAT","Name":"SetPoint","Editable":2},"TimeStamp":"2021-06-10T08:19:01.857Z"}
When they changes the setpoint from their GUI, we transmit:
* arg: 1 * string: {"Controller":"Items","Action":"Post","ItemName":"SetPoint","ItemState":"28"} * arg: 2 * number: 1 * arg: 3 * nil * arg: 4 * nil * arg: 5 * nil
both are correct, but they receive nothing.
they receive every other state from objects tagged bim-read and can execute every command on objects tagged bim-write.
The mistake is only on bim-read-write objects.
Pardon, when I change from LM, They receive the feedback.
They receive nothing when change from their dashboard, even the command is correctly execute.
Ok, at the end we found the mistake: we have to never send a "write message", but only "read message", even in the case of a feedback after a write command.
that's what we have to send with a bim-read-write object:
* string: {"Type":"NotificationPackage","Item":{"Link":"","State":"22.00","Type":"NUMBER:FLOAT","Name":"SetPoint","Editable":2},"TimeStamp":"2021-06-10T08:19:01.857Z"}
NEVER
* arg: 1 * string: {"Controller":"Items","Action":"Post","ItemName":"SetPoint","ItemState":"28"} * arg: 2 * number: 1 * arg: 3 * nil * arg: 4 * nil * arg: 5 * nil
(That is what they send to write from their dashboard)
So, please, can you help me to modify the library?
THANK YOU SO MUCH!
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
If I understand correctly you want the changed value to be sent back when it's changed from the dashboard. If so then modify the eventhandler function as follows:
Code: function eventhandler(event)
if not wsclient then
return
end
local obj = objsbyid[ event.dstraw ]
if not obj then
return
end
obj.value = busdatatype.decode(event.datahex, obj.datatype)
sendobjvalue(obj)
end
Posts: 270
Threads: 72
Joined: May 2017
Reputation:
0
Yes, that's right!
At last, everything is working well.
Thank you very much for your competence and patience.
BR
Peppe
|