Skip to content
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

Mihome vaccum widget not fully working #27

Open
mswiege opened this issue Dec 31, 2018 · 1 comment
Open

Mihome vaccum widget not fully working #27

mswiege opened this issue Dec 31, 2018 · 1 comment

Comments

@mswiege
Copy link

mswiege commented Dec 31, 2018

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
Copy link
Author

mswiege commented Dec 31, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant