Code Monkey home page Code Monkey logo

homebridge-valetudo-xiaomi-vacuum's People

Contributors

greatestview avatar maciej-rutkowski-intive avatar onfoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homebridge-valetudo-xiaomi-vacuum's Issues

crash during cleanup

TypeError: this.sendJSONRequest(...).then(...).catch(...).finally is not a function
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at ValetudoXiaomiVacuum.startCleaning (/mnt/usb/homebridge/homebridge-valetudo-xiaomi-vacuum/index.js:287:25)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at emitMany (events.js:147:13)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at Characteristic.On.emit (events.js:224:7)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at Characteristic.On.Characteristic.setValue (/usr/lib/node/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:321:10)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at Bridge. (/usr/lib/node/homebridge/node_modules/hap-nodejs/lib/Accessory.js:880:22)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at Array.forEach ()
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at Bridge.Accessory._handleSetCharacteristics (/usr/lib/node/homebridge/node_modules/hap-nodejs/lib/Accessory.js:820:8)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at emitMany (events.js:147:13)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at HAPServer.emit (events.js:224:7)
Thu May 2 18:00:50 2019 daemon.err homebridge[5439]: at HAPServer._handleCharacteristics (/usr/lib/node/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:972:10)

Seeing four 'Vacuum' buttons in Home app, nothing else?

Hi - I just installed this plugin, but the Home app is just showing four 'Vacuum' power buttons -- there's no way that I can see to tell them apart, so I could tap one and find that it's "return to base" or it could be "start vacuuming". Is there some config / option that I'm missing?

(Thanks for the work you have put into this plugin!)

Does this support selecting rooms?

I’m planning to root my S50, however, I’m used to use the rooms switches in the HK which really comes in handy (I just have to ask Siri to clean room X which is much faster than going to the MiApp). However, I don’t see in the docs here any reference to room support, do you have any plans? Thank you.

support for Valetudo zones and "go to locations"

I want to ask if you would consider support for cleaning of zones and "go to locations" defined in Valetudo.
Valetudo provides a great UI to define Zones and "Goto Locations". Having them available in Homekit would allow to ask Siri to "clean the living room" for example.
I have realized this for now with a workaround via the plugin "homebridge-http" that makes just a put request to the API. Please see my config-examples below:

With this switch I can ask Siri to clean the living-room (Zone-ID "-2"). I retrieved the IDs via developer mode of a WebBrowser from /api/zones:

{
            "accessory": "HTTP-SWITCH",
            "name": "Putze das Wohnzimmer",
            "switchType": "stateless",
            "timeout": 5000,
            "onUrl": {
                "url": "http://192.168.10.245/api/start_cleaning_zones_by_id",
                "method": "PUT",
                "body": "[-2]",
                "headers": {
                    "Content-Type": "application/json"
                }
            }
},

With this switch I can ask the vacuum to got to a dedicated coordinate. I use this in a scene to drive the vacuum triggered by a schedule to the trash bin. I retrieved the coordinates via developer mode of a WebBrowser from /api/spots:

{
            "accessory": "HTTP-SWITCH",
            "name": "Gehe zum Mülleimer",
            "switchType": "stateless",
            "timeout": 5000,
            "onUrl": {
                "url": "http://192.168.10.245/api/go_to",
                "method": "PUT",
                "body": {
                    "x": 2402,
                    "y": 2288
                },
                "headers": {
                    "Content-Type": "application/json"
                }
            }
},

incompatible with Valetudo 0.6.1 / status-update fails

Just updated to Valetudo 0.6.1 and suddenly the plugin is no longer working. At a first glance, the status-update seems to be broken. The URL has changed from /api/current_state to /api/state and I assume the message has changed as well, because there are now parsing-issues. (I have modified the URL in index.js for testing)
Valetudo returns now something like:
[{"__class":"StatusStateAttribute","metaData":{},"value":"cleaning","flag":"none"},{"__class":"FanSpeedStateAttribute","metaData":{},"value":"max"},{"__class":"BatteryStateAttribute","metaData":{},"level":97,"flag":"discharging"},{"__class":"PersistentMapSettingStateAttribute","metaData":{},"value":"enabled"},{"__class":"LatestCleanupStatisticsAttribute","metaData":{},"type":"area","value":2550},{"__class":"LatestCleanupStatisticsAttribute","metaData":{},"type":"duration","value":21}]
(I guess the whole class-thing is new)

Best,
Andreas

Multiple parsing errors Unexpected token < in JSON at position 0 with plugin v0.1.5 and Valetudo re v.0.10.5

Hi.

Installed just released v0.1.5 with legacy mode set to true with Valetudo RE 0.10.5 and same errors appears.

`[3/4/2021, 5:10:31 PM] [ValetudoXiaomiVacuum] Error parsing firmware info: SyntaxError: Unexpected token < in JSON at position 0

[3/4/2021, 5:10:31 PM] [ValetudoXiaomiVacuum] Error parsing firmware info: SyntaxError: Unexpected token < in JSON at position 0

[3/4/2021, 5:10:36 PM] [homebridge-valetudo-xiaomi-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

[3/4/2021, 5:10:36 PM] [homebridge-valetudo-xiaomi-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

[3/4/2021, 5:10:36 PM] [homebridge-valetudo-xiaomi-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

[3/4/2021, 5:10:36 PM] [homebridge-valetudo-xiaomi-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'Status Low Battery' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

[3/4/2021, 5:10:36 PM] [homebridge-valetudo-xiaomi-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'Battery Level' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

[3/4/2021, 5:10:36 PM] [homebridge-valetudo-xiaomi-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'Charging State' didn't respond at all!. Please check that you properly call the callback! See https://git.io/JtMGR for more info.

[3/4/2021, 5:10:42 PM] [ValetudoXiaomiVacuum] Error parsing firmware info: SyntaxError: Unexpected token < in JSON at position 0

[3/4/2021, 5:10:42 PM] [ValetudoXiaomiVacuum] Failed to get volume: SyntaxError: Unexpected token < in JSON at position 0

[3/4/2021, 5:10:42 PM] [ValetudoXiaomiVacuum] Failed to get volume for Mute: SyntaxError: Unexpected token < in JSON at
position 0`

spot cleaning?

Hi there,
i see there is an option to spot-clean. but how is that supposed to work?

Cheers and thanks!

Error parsing current status info: SyntaxError: Unexpected token < in JSON at position 0

Hello,

unfortunately the plugin returns the following error for my s50 robot with valetudo:
Error parsing current status info: SyntaxError: Unexpected token < in JSON at position 0

I think it is because I use rand256 customized Valetudo-version.
https://github.com/rand256/valetudo
Can somebody help my to get rid of that error? I guess I have to change something in the plugin, because there seems to be a difference in the "current status"?

Thank you!

Error parsing current status info: SyntaxError: Unexpected token < in JSON at position 0

Hi,
I installed the plugin and created an accessory using the following code:
"accessories": [
{
"name": "Bello",
"ip": "192.168.XXX.XXX",
"accessory": "ValetudoXiaomiVacuum"
}
]

After that I got the following error message: "Error parsing current status info: SyntaxError: Unexpected token < in JSON at position 0"
Valetudo is reachable and the vacuum shows up in the home app but only 'Find Bello' is working. The rest is not responsive. I tried changing the order in the json file but (as expected) it did not change anything.
Thanks in advance for your help.

Pause?

Hello everyone,
How can I insert a “pause” button or use a plugin to move the robot to pause?
If I stop the robot using the start button, it stops completely.

Thanks in advance.

[suggestion] cleaning mode

one thing to add is a way to control the cleaning mode: vacuum/mop and the power level associated with it. My first idea would be to add a fan mode which can be controlled but this is tricky as the user needs to remember which percent of the fan corresponds to which cleaning mode. Another idea would be to have switches for cleaning and mopping. Still you somehow need to control the power levels for vacuuming...
Mopping is tricky as it is missing from valetudo. It's an additional mode during which the vacuum moves slower.
I modified valetudo as follows:

var fanspeeds = { 38: "Quiet", 60: "Balanced", 75: "Turbo", 100: "Max", 105: "Mop" };

`function handleFanspeedButton() {
window.clearTimeout(currentRefreshTimer);

                ons.openActionSheet({
                    title: 'Select power mode',
                    cancelable: true,
                    buttons: [
                        'Quiet',
                        'Balanced',
                        'Turbo',
                        'Max',
                        'Mop',
                        {
                            label: 'Cancel',
                            icon: 'md-close'
                        }
                    ]
                }).then(function (index) {
                    var level;

                    switch (index) {
                        case 0:
                            level = 38;
                            break;
                        case 1:
                            level = 60;
                            break;
                        case 2:
                            level = 75;
                            break;
                        case 3:
                            level = 100;
                            break;
                        case 4:
                            level = 105;
                            break;
                    }

                    if (level) {
                        loadingBarHome.setAttribute("indeterminate", "indeterminate");
                        fanspeedButton.setAttribute("disabled", "disabled");
                        fn.requestWithPayload("api/fanspeed", JSON.stringify({ speed: level }), "PUT", function (err, res) {
                            if (err) {
                                fanspeedButton.removeAttribute("disabled");
                                loadingBarHome.removeAttribute("indeterminate");
                                ons.notification.toast(err, { buttonLabel: 'Dismiss', timeout: 1500 })
                            } else {
                                window.clearTimeout(currentRefreshTimer);
                                window.setTimeout(function () {
                                    updateHomePage();
                                }, 150);
                            }
                        })
                    } else {
                        window.setTimeout(function () {
                            updateHomePage();
                        }, 3000);
                    }
                });
            }`

unhandled error

Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: [Wed May 01 2019 10:25:49 GMT+0300 (EEST)] [Virgil] Error parsing current status info: TypeError: "listener" argument must be a function
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: (node:9442) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'state' of null
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at getStatus (/mnt/usb/homebridge/homebridge-valetudo-xiaomi-vacuum/index.js:258:90)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at callbacks.forEach (/mnt/usb/homebridge/homebridge-valetudo-xiaomi-vacuum/index.js:155:21)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at Array.forEach ()
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at sendJSONRequest.then.catch (/mnt/usb/homebridge/homebridge-valetudo-xiaomi-vacuum/index.js:154:27)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at runMicrotasksCallback (internal/process/next_tick.js:122:5)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at _combinedTickCallback (internal/process/next_tick.js:132:7)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: at process._tickCallback (internal/process/next_tick.js:181:9)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: (node:9442) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
Wed May 1 10:25:49 2019 daemon.err homebridge[9442]: (node:9442) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Make commands configurable

Hi, first of all: Thank you for your amazing work! I’m another niche user of a Xiaomi Robot with Valetudo in Homebridge. :D

One thing I noticed: The commands for cleaning, going home etc. are hard coded. I use voice commands a lot, so I thought it would be nice to make the voice commands configurable, as an option of course. homebridge-xiaomi-roborock-vacuum for example allows device name followed by a custom word, but that order might not make sense with all languages. So what about making the whole command name configurable?

@onfoot, I will attach a pull request and would be happy, if you could merge and publish it!

SyntaxError: Unexpected token N in JSON at position 0

My homebridge log is filled with these errors:

[06/02/2022, 21:56:04] [MyVacuum] Error parsing current status info: SyntaxError: Unexpected token N in JSON at position 0
[06/02/2022, 21:56:13] [MyVacuum] Error parsing firmware info: SyntaxError: Unexpected token N in JSON at position 0

The first line appears every 10 seconds, the second infrequently.

First I tought it might be the same issue as described in #16 (and closed #12, #13, #14, #18), but that happens with Valetudo RE while my vacuum runs Valetudo (without RE).

Any ideas? @onfoot, which version combination is working for you?

Versions:

  • homebridge-valetudo-xiaomi-vacuum: 0.2.0
  • Valetudo 2022.02.01 (same issue on 2022.01)
  • Node: 16.13.1
  • NPM: 8.1.2

UnhandledPromiseRejectionWarning

Just wanted to leave this here so the problem is not forgotten ;)

Did not find the issue in the code myself on first glance but this shows up when I send my vaccum back home:

    at /usr/local/lib/node_modules/homebridge-valetudo-xiaomi-vacuum/index.js:270:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:2238) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2238) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Works like a charm!

Works like a charm with:

  • homebridge 0.4.49
  • node v10.15.3
  • Valetudo 0.3.1
  • Xiaomi Firmware 3.3.9 on Xiaomi MiRobot (Roborock) S502

Great work, thank you very much!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.