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

Luminance Sensor Values #40

Open
CarlosMaxiwatt opened this issue May 11, 2021 · 4 comments
Open

Luminance Sensor Values #40

CarlosMaxiwatt opened this issue May 11, 2021 · 4 comments

Comments

@CarlosMaxiwatt
Copy link

I have a Luminance Light Sensor Mijia Zigbee 3.0 and a Xiaomi Motion Sensor. connected to Xiaomi Multi-mode Smart Gateway 2020 Wifi Zigbee Hub Brige.

When I run "mihome.miCloudProtocol.getDevices" , returned me both sensors (for example "AAAAAAAA" and "BBBBBBB" id, mac, etc). But now I want to get the values of both sensors. I think I must to use something similar to "mihome.miCloudProtocol.miioCall( "AAAAAAAA" , method )". But I don't know which Method is to get the Luminance value, or the last motion value. I don't know where I can find the methods of each device.

Tahnk you.

@Pittini
Copy link
Contributor

Pittini commented May 11, 2021

Maybe here are some helpful links to determine the methods: https://gist.github.com/Pittini/1a333de9d0d5397c0a01e4fa127995c1

@CarlosMaxiwatt
Copy link
Author

CarlosMaxiwatt commented May 11, 2021

Hello Pittini. Thank you very Much. I tried according to your Document. But I can't still understand.

According to node-mihome documentation:
await mihome.miCloudProtocol.miioCall(deviceId, method, params, options); // call miio method with params via cloud protocol

So I tried something like this:
mihome.miCloudProtocol.miioCall("255742660", "miot-spec-v2" )

And returned null.

What I'm doing Wrong? Which one is correctly?:
mihome.miCloudProtocol.miioCall("255742660", "miot-spec-v2" )
or
mihome.miCloudProtocol.miioCall("255742660", "http://miot-spec.org/miot-spec-v2/instances?status=all" )

No one retunr values.

My Code:

mihome.miCloudProtocol.login(username, password).then(response => { //Works fine
});
mihome.miCloudProtocol.getDevices(null, options).then(devices => { //Works fine, one of the ID devices is 255742660
console.log(response);
});
mihome.miCloudProtocol.miioCall("255742660", "http://miot-spec.org/miot-spec-v2/instances?status=all" ).then(devices => {
console.log(response); //Always return NULL
});

@Pittini
Copy link
Contributor

Pittini commented May 11, 2021

The Links are just for finding out which properties/methods a device have. Your device has to be here: https://github.com/maxinminax/node-mihome/tree/master/lib/devices . If not, you cant control or get values exept the base info like ip model, etc.
I don't know your skill level, but maybe my old testcode can help you to understand. Thats the smallest version, the actual one is much bigger for use with the iobroker smarthome system.

@CarlosMaxiwatt
Copy link
Author

Hello @Pittini . Thank you a lots for your time. I didn't found neither the Zigbee Gateway, neither Light Sensor Mijia Zigbee.

Furthermore, your old test at this moment isn't avaliable.

But according to your info, this soud be the correct way? For example, if I have a model 'lumi.sensor_motion.aq2' with ID '255742660':

mihome.miCloudProtocol.miioCall("255742660", "getBattery() " ).then(devices => {
console.log(response);

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

2 participants