How to update data when returning to a tab in dashboard

I have an svg of a fan. When you give it the command to rotate the blades, they do it perfectly, but every time a new payload arrives, it restarts the rotation and this displays a very ugly and undesirable jump. I avoided this by putting a filter so that it does not send repeated payloads if they have the same value and thus the rotation of the blades is clean and continuous until it receives the payload with a different order "off". But this has generated the problem that when the user changes the tab and returns again, despite the fact that the "on" order is still active, the cross no longer turns because the filter prevents the "on" order from being sent again. to the svg, since the command has not effectively changed and is still "on". Some way for it to resubmit the command when returning to the tab and keep the filter to prevent the animation from jumping.
Thank you very much.

If the repeated payloads occur in a specific timeframe I use a trigger node instead of filter node. You need only to decide if the blades should react on the first or the last message .

Sorry, but i dont understand this. The blades are trigger by button on or by calculation by temperature sensor in automatic mode. The problem is than if trigger on and blade rotate then if a go out to other tab, when i back, the blade in svg are stopped, but really the payload is still on.

I'm assuming that your svg is in a template, if you add this then you will get a message each time the tab is opened, which you can use to resend the on / off payload.

<script>
(function() {
    (function(scope) {
        scope.send({payload: "preload"}); // this gets sent when the view is opened in the browser
    })(scope);
})();
</script>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.