ioBroker / ioBroker.vis.cordova

Cordova APP for ioBroker.vis
Other
16 stars 7 forks source link

Mihome vaccum widget not fully working #27

Open mswiege opened 5 years ago

mswiege commented 5 years ago

The main button to start/pause the vacuum is not working in the app. Instead of triggering the action it updates the "state" to "true" (which of course doesn't do anything meaningful).

I tried to debug it myself in the mihome widget but as I can't get a new html into the app for testing I have to open an issue here.

Here is what I have seen so far: The widget has this onClick funktion:

       onclick: function (el, isRunning) {
            var oid = $(el).data('oid');
            if (oid) {
                var val = $(el).data('value');
                if (val) {
                    vis.setValue(oid, parseInt(val));
                } else {
                    if ($(el).data('type') === 'state') {
                        if (isRunning) {
                            vis.setValue($(el).data('pause'), true);
                        } else {
                            vis.setValue($(el).data('start'), true);
                        }
                    } else {
                        if ($(el).data('type') === 'home' && isRunning) {
                            // pause first to send back to the dock;
                            vis.setValue($(el).data('pause'), true);
                        }
                        vis.setValue(oid, true);
                    }
                }
            }
        }

The button that has the issue has the HTML attribute data-type='state' and no data-value attribute. That should mean that the onClick function should go into the else branch of if(val) because there is no data-value and after that into the true part of the 'state' check. But instead it eather executes vis.setValue(oid, parseInt(val)); or vis.setValue(oid, true); but it's unclear to me how this could happen (if the app uses the most up-todate version of the widget).

What also ist wrong (perhaps related) is that the app always shows the button blue highlighted which means that the widget assumes the vaccuum is running even if it doesn't. So there also seems to be an issue with the "isRunning()" function.

Both these issues only happen in the app, in a browser all works as expected.

mswiege commented 5 years ago

I just looked into the APK file and have seen that the app uses an outdated widget html file, so most likely all that needs to be done to fix this is rebuild the app with the current version. Sadly I didn't manage to build the app by myself.