Ui-template fully kiosk browser update problem dashboard 2

Hi,

I have some problem with a UI-template (with v-progress-linear).
I have an old Samsung Galaxy Tab A with fully kiosk browser.
It does update normally all controls except this UI-template.
I must say, that loading the page in Chrome on the tablet does update this control also.
So it's possible a problem of fully kiosk browser ?,
but why all other controls work as expected?
Maybe i made something wrong in this control?
(I am new to html,css and javascript programming)

thanks
Thomas

    <div>
    <v-progress-linear  class="my-progress-class" 
        label="Batterie"
        min="0" 
        max="100" 
        height="40"
        bg-color="grey"
        bg-opacity="0.5"
        :color="getColor(value)"
        v-model=calcvalue>
         <template v-slot:default="{ value }">
          <strong>{{ this.value }} W</strong>
        </template>
    </v-progress-linear>
    </div>
</template>


<script>

    /*
        <strong>{{ Math.abs(Math.floor(value)) }} W</strong>
*/


    export default {
        data() {
            // define variables available component-wide
            // (in <template> and component functions)
            return {
                count: 0
            }
        },
        watch: {
            // watch for any changes of "count"
            count: function () {
                if (this.count % 5 === 0) {
                    this.send({payload: 'Multiple of 5'})
                }
            }
        },
        computed: {
            // automatically compute this variable
            // whenever VueJS deems appropriate
            calcvalue: function () {
                // return this.value*100/2500
                return msg.payload*100/2500
            }
        },
/*        
        methods: {
            // expose a method to our <template> and Vue Application
            increase: function () {
                this.count++
            }
        },
*/        
        methods: {
        // add a function to determine the color of the progress bar given the row's item
            getColor: function (value) {
                if (value<0) {
                     return 'red'
                } else{
                    return 'green'
                }
            },
            getValue: function (value) {
                return Math.abs(value*100/2500)
            }
        },
       
        mounted() {
            // code here when the component is first loaded
        },
        unmounted() {
            // code here when the component is removed from the Dashboard
            // i.e. when the user navigates away from the page
        }
    }
     
</script>
<style>
    /* define any styles here - supports raw CSS */
    /* color: red;*/
    /* background-color: blue-grey-lighten-3;*/
    .my-progress-class {

    }
</style>

Hi,

update

Seems to be not only a fully kiosk browser problem.
I tested the same on chrome on my smart phone, also there the
linear gauge freezes after some time.
The values in the textbox get updated (every 30s).
When I refresh the page, the gauges get in sync again and work for some time.

in the nodered log I found the following entries ?

4 Apr 15:23:49 - [info] [ui-base:My Dashboard] Disconnected fMs0YjwMNeTzy6BpAAFr due to transport close
4 Apr 15:32:39 - [info] [ui-base:My Dashboard] Disconnected WANTPvRWlObTOG5iAAFt due to transport close
4 Apr 15:38:53 - [info] [ui-base:My Dashboard] Disconnected bVzk3-Z9HUb2dU29AAFw due to transport close
4 Apr 15:43:22 - [info] [ui-base:My Dashboard] Disconnected Oj0e5bnk3XiQnIoAAAFy due to transport error
4 Apr 15:51:19 - [info] [ui-base:My Dashboard] Disconnected JNWTRP2f2liPt9NfAAF0 due to transport close
4 Apr 15:54:39 - [info] [ui-base:My Dashboard] Disconnected SFu1CQ5vuG8eN_tlAAF5 due to transport close
4 Apr 16:01:17 - [info] [ui-base:My Dashboard] Disconnected 0rDEAvU7U9rtKZElAAF8 due to ping timeout
4 Apr 16:02:33 - [info] [ui-base:My Dashboard] Disconnected HDrvuScWZvs6-tbwAAF- due to transport close
4 Apr 16:03:03 - [info] [ui-base:My Dashboard] Disconnected CIzMvpC6OpFT1G-NAAGA due to transport close
4 Apr 16:03:38 - [info] [ui-base:My Dashboard] Disconnected QjOU9bJJpoGQDLH9AAF2 due to ping timeout
4 Apr 16:52:08 - [info] [ui-base:My Dashboard] Disconnected G_I2ZO8vOxjApA39AAGC due to transport close

Is suspect this is the same issue as Page not updating when left in background on Android · Issue #444 · FlowFuse/node-red-dashboard · GitHub.

Interesting, though, that your text widgets continue to receive updates, I need to recheck mine to see if I also see that.

Does yours recover if you switch to a different dashboard page and back again?

yes, switching to another page and back, make the gauges work for some time.

I think that confirms that it is the same issue. It seems to be related to Widget state not updated after network disconnection and recovery · Issue #620 · FlowFuse/node-red-dashboard · GitHub which is basically the same issue triggered by a temporary network failure.

It is in the Up Next category on the activity tracker so hopefully it won't be too long. There are a lot of things on the Up Next list though and only a limited amount of manpower available. That manpower is of the highest quality, however, so do not despair :slight_smile:

Thanks for the explanation,
what is a little bit confusing is the fact, that the textbox works correctly ?
my ui-template is correct ? :thinking:
despite it, thanks for this great work on dashboard 2 :smiley:

You are right, there seems to be more subtlety to the problem than I thought. I am going to carry out some more experiments to try and tie it down a bit tighter. Hopefully that will give the developers more clues about what is going on.

2 Likes

In fact it seems the problem you are seeing (which I have also been seeing) is not quite the problem described in that issue, but is specifically related to ui-template nodes. I had been conflating the two issues.

What I am seeing if that after a period of not interacting with the device, or if the dashboard is left in the background and then restored, that ui-template nodes stop receiving messages. If your device is connected by WiFi then it can be triggered by switching the WiFi off for 20 seconds and then back on again. I will open a new issue for this and post the link here.

Issue opened ui-template nodes not receiving messages after network disconnection/recovery. · Issue #747 · FlowFuse/node-red-dashboard · GitHub

Hi
only a guess

I try to test smaller refresh rates, problem was with 30sec update rate of the ui-template

By reading the code some doubts: UITemplate.vue line 183 -> this.$socket.off(`msg-input:${this.id}`)
Listening is applied via data-tracker on setup but is it even for same scope?

Don't know much about the magic of vue but just reading the code which seems a bit off.

I have identified a crude work around which seems to work for me (though it has not been intensively tested yet so not guaranteed under all circumstances). It forces a page refresh when a client re-connects.

[{"id":"4f18b8e4184480ed","type":"ui-control","z":"8fde719260b2c325","name":"","ui":"04ee189a49c54f22","events":"all","x":120,"y":580,"wires":[["d1df98110878717d"]]},{"id":"d1df98110878717d","type":"switch","z":"8fde719260b2c325","name":"Connection?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"connect","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":580,"wires":[["40a640c42724fd98"]]},{"id":"bb1dd58f34d597e5","type":"change","z":"8fde719260b2c325","name":"Blank payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":640,"wires":[["4f18b8e4184480ed"]]},{"id":"40a640c42724fd98","type":"trigger","z":"8fde719260b2c325","name":"Ignore multiple connections within 3 secs to stop loop","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"3","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":580,"y":580,"wires":[["bb1dd58f34d597e5"]]},{"id":"7d37ad627b74f6a7","type":"comment","z":"8fde719260b2c325","name":"Refresh page when a client connects to hide issue #747","info":"","x":260,"y":540,"wires":[]},{"id":"04ee189a49c54f22","type":"ui-base","name":"Dashboard","path":"/dashboard","showPathInSidebar":false,"navigationStyle":"temporary"}]

Should be the same scope, the data tracker will apply it for the Vue component on which it is run, it appends common mounted/unmounted code.

I haven't had a chance to properly investigate this myself - but really appreciate the assists @Colin

So if all other nodes rely fully on data tracker onmount/onunmount, why the template forcibly signs off the socket listening?

Its only disabling it for that widget. Data Tracker provides the common subscribe/unsubscribe functions, but the events themselves are bespoke to each widget as it includes the Widget's ID:

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