-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC polling for 'switch' widget in 'RPC request persistent ' looks like doesn't work #211
Comments
If you need more information about this issue, please let me know, and I'll send movie with example. |
Actively polling the RPC client side is not what the RPC request persistent feature does. The behaviour is exactly like expected, the only thing that this feature changes is that if the device is not connected the request is saved in the database instead and sent as soon as the device is connected. The 2000ms in that case is the time in that the widget expects a response, and if it gets one everything is good, if it doesn't the RPC expires is deleted from the database and the widget times out. I hope this clears any misunderstanding. |
Ok. Thank you for explanation. Mathew, I have open question - how to poll remote device state from widget side? Example of possible case:
The question - how to poll ESP32 from web side in some time interval for status static VAR for LED, because if we push real button then web widget button should change state too. (if WEB page will be reloaded widget will send GET RPC request, and will get properly LED state. But it is not convinient to reload page permanently from user side ) |
I don't think that can be directly done with an RPC widget, because it is not meant for that use case. RPC is meant for methods that are called by the cloud and "can" return a value. Either you change the underlying JavaScript code so that it sends the Get Request repeadetly, implementing your wanted polling, but that doesn't seem really efficient. Or alternatively you use Shared Attributes, which are meant for your use case. These are attributes that the device can send and change, and the server read, but the server can also change them and the device can be informed if they change on the server side. To do that you need to first change the rule chain so that it transforms some attributes into shared attributes. Then the device can simply subscribe to changes for those attributes if the server changes them and send these attributes like it would any other client side attributes. Afterwards the server can display that shared attribute in a widget, there are already preexisting widgets for that. Now if you change the value from the cloud the value on the device should be updated as well and if you change the value on the device, and then upload the changed value as an attribute it will also be shown on the cloud. I hope this explanations helps somewhat. Alternatively I would recommend asking in the main repository as this is not an issue or feature request with the MQTT SDK. |
On ThingsBoard website for 'switch' widget - if feature 'RPC request persistent' enabled it doesn't poll client side with the GET method. Please check it on your side. Client can be polled with the GET method just once - in the case if you'll reload ThingsBoard web page.
The text was updated successfully, but these errors were encountered: