GithubHelp home page GithubHelp logo

Comments (6)

aholstenson avatar aholstenson commented on May 26, 2024

If you check the message property of the error what does it say? I The code -5001 is invalid argument.

If the humidifier is similar to the air purifiers the led brightness is actually a number. The air purifiers use 0 = bright, 1 = dim, 2 = off.

from miio.

ben423423n32j14e avatar ben423423n32j14e commented on May 26, 2024

You are correct the current LED status on my unit is: 2

I still receive the error message when attempting to send the command through miio.

The only commands I can't send are to those with the additional _ in the name.

set_led_b

return device.call('set_power', ['on']) works fine

from miio.

aholstenson avatar aholstenson commented on May 26, 2024

The humidifier might do something special here. Could you run your code while setting the environment flag DEBUG to miio*? Something like this: DEBUG=miio* node pathtoscript.js

You should get lots of debug information about data sent and received, the bit from where you can see some JSON with your call until you get some other JSON as a reply can help with figuring out what's going wrong.

from miio.

ben423423n32j14e avatar ben423423n32j14e commented on May 26, 2024

This is interesting, 2 is the current known state of the LED from the device status, yet it rejected it:

miio.device.[192.168.0.95] -> (2) {"id":1,"method":"set_led_b","params":["2"]}
miio.device.[192.168.0.95] <- Message: `{"error":{"code":-5001,"message":"invaild_arg"},"id":1}

from miio.

ben423423n32j14e avatar ben423423n32j14e commented on May 26, 2024

BINGO, got it working :)

return device.call('set_led_b', [JSON.parse('2')])

I'll update the humidifier doc once I've tested the remaining options.

from miio.

aholstenson avatar aholstenson commented on May 26, 2024

Alright! Looks like you were sending a string when the device wants a number. Most of the Mi devices are picky about that.

In the current master there is some new documentation and a device implementation to make interacting with the humidifier easier. Such as being able to call device.setLedBrightness('off') instead of using call directly.

When you know what the other options do you can open an issue and describe what you found or try to add it to the implementation in lib/devices/humidifier.js.

from miio.

Related Issues (20)

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.