rossmann-engineering / Collibellex-Thingsboard-Widgets

Widget Library for Thingsboard
MIT License
163 stars 71 forks source link

Failed to get value from Slider #13

Closed Ifousoft closed 1 year ago

Ifousoft commented 1 year ago

Using slider.json, I failed to get selected value from the slider. RPC is called, but the JSON document sent in parameter is empty. I tested my code with other sliders like your new rounded slider and it works very well.

Is there a bug in this horizontal slider ? How could I solve that ?

Thanks!

rossmann-engineering commented 1 year ago

Hi, are you using the slider or the round slider? I tested both and it seems to work well for me.

Do you have any additional informations?

Ifousoft commented 1 year ago

I tested round slider, and I get JSON response but with Slider (classic one). No JSON, the 'data' parameter is empty/0 ...

rossmann-engineering commented 1 year ago

I am sorry, I am not able to reproduce your issue. It seems to work fine for me.

image image
Ifousoft commented 1 year ago

I use the ThingsBoard library. I put the same RPC method for the both sliders.

RPC_Response SetValueHeureConsigne(const RPC_Data &data)

Using round slider, I got the debug: [TB] Callback onMQTTMessage from topic: (v1/devices/me/rpc/request/28) [TB] Received RPC: [TB] SetValueHeureConsigne [TB] Calling RPC: [TB] SetValueHeureConsigne [TB] params [TB] 50

And I access to the "data" parameter from my RPC call back. data.as() gets me 50.

But using horizontal slider, I got the right debug: [TB] SetValueHeureConsigne [TB] params [TB] 34

but the data.as() return me always 0...

As this is the same code, same RPC call... I assume there is a little difference between the both slider that don't work in a case...

Could you please check ?

Thanks!

rossmann-engineering commented 1 year ago

I use the ThingsBoard library. I put the same RPC method for the both sliders.

RPC_Response SetValueHeureConsigne(const RPC_Data &data)

Using round slider, I got the debug: [TB] Callback onMQTTMessage from topic: (v1/devices/me/rpc/request/28) [TB] Received RPC: [TB] SetValueHeureConsigne [TB] Calling RPC: [TB] SetValueHeureConsigne [TB] params [TB] 50

And I access to the "data" parameter from my RPC call back. data.as() gets me 50.

But using horizontal slider, I got the right debug: [TB] SetValueHeureConsigne [TB] params [TB] 34

but the data.as() return me always 0...

As this is the same code, same RPC call... I assume there is a little difference between the both slider that don't work in a case...

Could you please check ?

Thanks!

I think with Thingsboard library you mean the Gateway? I am not very familiar with the Thingsboard Gateway. What does the Function data.as() do?

Ifousoft commented 1 year ago

Sorry, I used Thingsboard for platformio to develop on ESP32. This creates an abstraction on MQTT for thingsboard. The data.as() provides the output of the widget. What I don't understand is that with the same function call attached to the widgets slider or round slider, I got the value from rounded slider and no value from slider. Then, I assume there is a difference in the behaviour of the boths sliders.

rossmann-engineering commented 1 year ago

I looked more in details, and the only difference I saw, is that the Roundslider was sending the setvalue request as response to getValue. However I changed that now and please test that on you side.

Ifousoft commented 1 year ago

More tests: Using New slider, when I change the value on the web page, I got the following traces. Both sliders new one and rounded one are connected on the same variable and on the same RPC procedure "SetValueTour". I then don't understand why it is working with the rounded one and not with the second one... even new version...

Traces:

[TB] Callback onMQTTMessage from topic: (v1/devices/me/rpc/request/30) [TB] Received RPC: [TB] SetValueTour [TB] Calling RPC: [TB] SetValueTour [TB] params [TB] 41 ---- Set value Slider Value: 0

When I do the same with round slider I got: [TB] Callback onMQTTMessage from topic: (v1/devices/me/rpc/request/31) [TB] Received RPC: [TB] SetValueTour [TB] Calling RPC: [TB] SetValueTour [TB] params [TB] 34 ---- Set value Slider Value: 34

rossmann-engineering commented 1 year ago

But you get the 41 as a response from the widget, isn't it?

Ifousoft commented 1 year ago

Yes but from the rounded value I find it with my code (34) in the second case rather than with the slider where the rpc internal can receive 41 but not my internal rpc code... Then why? And how-to...? Where can I find the code executed to send back the value to have a look? Thanks

rossmann-engineering commented 1 year ago

;-). One more time. Try now.

rossmann-engineering commented 1 year ago

Any news?

rossmann-engineering commented 1 year ago

Closed due to inactivity, should be work now