merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
364 stars 62 forks source link

Hot to get all properties from cloud for hhcc.plantmonitor.v1 device via miot cloud command? #551

Closed mrmaximas closed 7 months ago

mrmaximas commented 7 months ago

Subj. Thanks!

merdok commented 7 months ago

Enter your device model here http://www.merdok.org/miotspec/

mrmaximas commented 7 months ago

Sorry, I mean how to read the current values directly from the cloud.

merdok commented 7 months ago

You have to use the miot cli to request the values from the cloud for specific properties.

mrmaximas commented 7 months ago

You have to use the miot cli to request the values from the cloud for specific properties.

I don't understand the miot cloud command format, I couldn't find a manual how to request for specific value of specific device. please give me an example of such a command for request soil ec (2.2) for device ID: blt.3.1bl3btnhc5g00 http://www.merdok.org/miotspec/?model=hhcc.plantmonitor.v1

merdok commented 7 months ago

An example for a local request would be: miot send <IP> -t <TOKEN> get_properties '[{"siid":2,"piid":2}]' For cloud you would need to send the same request over the cloud cli tools

mrmaximas commented 7 months ago

An example for a local request would be: miot send <IP> -t <TOKEN> get_properties '[{"siid":2,"piid":2}]' For cloud you would need to send the same request over the cloud cli tools

thanks, but i need example of command for getting same properties form the cloud. by the way my BLE devices does not have IP.

merdok commented 7 months ago

As mentioned, the same command applies to the cloud cli tools. You can type in the command in the terminal empty and it will show guide and show you on how to login and send the command.

mrmaximas commented 7 months ago

@NVR ~ % miot send 192.168.1.124 -t 46a999eaff49a308eb5b5f9f765e58 get_properties '[{"siid":2,"piid":5}]' INFO Connecting to device at 192.168.88.124 INFO Device found! Sending command: get_properties [{"siid":2,"piid":5}] SUCCESS Response from device -> [{"did":"333830665","siid":2,"piid":5,"code":0,"value":1}]

@NVR ~ % miot cloud 192.168.1.124 -t 46a999eaff49a308eb5b5f9f765e58 get_properties '[{"siid":2,"piid":5}]' @NVR ~ % what i do wrong?

merdok commented 7 months ago

Did you even type miot cloud in the terminal and read the description there?

Anyway, the command should look like: miot cloud get-props '[{"siid":2,"piid":2,"did":"<DID>"}]' where DID is the deviceId of the device which you are trying to get the properties from, you can use miot cloud list-devices to get a list of device including their device ids

mrmaximas commented 7 months ago

It's works Thank You! @NVR ~ % miot cloud get-props '[{"siid":2,"piid":1,"did":"blt.3.1abh1244d2ee56"}]' INFO Executing get_properties command over MiCloud country cn with params [{"siid":2,"piid":1,"did":"blt.3.1abh1244d2ee56"}] - timeout: 10000 SUCCESS Response from MiCloud -> [{"did":"blt.3.1abh1244d2ee56","iid":"0.2.1","siid":2,"piid":1,"value":87,"code":0,"updateTime":1701202460,"exe_time":0}] @NVR ~ % miot cloud get-props '[{"siid":2,"piid":2,"did":"blt.3.1abh1244d2ee56"}]' INFO Executing get_properties command over MiCloud country cn with params [{"siid":2,"piid":2,"did":"blt.3.1abh1244d2ee56"}] - timeout: 10000 SUCCESS Response from MiCloud -> [{"did":"blt.3.1abh1244d2ee56","iid":"0.2.2","siid":2,"piid":2,"value":1043,"code":0,"updateTime":1701202190,"exe_time":0}] @NVR ~ % miot cloud get-props '[{"siid":2,"piid":3,"did":"blt.3.1abh1244d2ee56"}]' INFO Executing get_properties command over MiCloud country cn with params [{"siid":2,"piid":3,"did":"blt.3.1abh1244d2ee56"}] - timeout: 10000 SUCCESS Response from MiCloud -> [{"did":"blt.3.1abh1244d2ee56","iid":"0.2.3","siid":2,"piid":3,"value":63,"code":0,"updateTime":1701202490,"exe_time":0}] @NVR ~ % miot cloud get-props '[{"siid":3,"piid":2,"did":"blt.3.1abh1244d2ee56"}]' INFO Executing get_properties command over MiCloud country cn with params [{"siid":3,"piid":2,"did":"blt.3.1abh1244d2ee56"}] - timeout: 10000 SUCCESS Response from MiCloud -> [{"did":"blt.3.1abh1244d2ee56","iid":"0.3.2","siid":3,"piid":2,"value":17.8,"code":0,"updateTime":1701202239,"exe_time":0}]

mrmaximas commented 7 months ago

@merdok it's possible to get multiple values at ones via miot cloud get-props command?

mrmaximas commented 7 months ago

@merdok it's possible to get multiple values at ones via miot cloud get-props command?

found issue with miot cloud list-devices command - ble devices not listed. while I successfully retrieve their data miot cloud device-info blt.3.1abh8or5se800 INFO Getting info for device with id blt.3.1abh8or5se800 from country cn... SUCCESS Got device info from MiCloud { "did": "blt.3.1abh8or5se800", "token": "xxxxxx", "longitude": "0.0", "latitude": "0.0", "name": "Tradeskancya", "pid": "6", "localip": "xxxx", "mac": "C4:7C:8D:6D:4C:B0", "ssid": "", "bssid": "", "parent_id": "", "parent_model": "", "show_mode": 1, "model": "hhcc.plantmonitor.v1", "adminFlag": 1, "shareFlag": 0, "permitLevel": 16, "isOnline": true, "desc": "Humidity: 41%", "extra": { "isSetPincode": 0, "pincodeType": 0, "fw_version": "1.0.1_318", "needVerifyCode": 0, "isPasswordEncrypt": 0 }, "prop": { "4104": "29" }, "uid": 6226444545, "pd_id": 152, "password": "", "p2p_id": "", "rssi": 0, "family_id": 0, "reset_flag": 0 } Screenshot 2023-12-05 at 20 11 36

merdok commented 7 months ago

Yes it is possible,{"siid":2,"piid":2,"did":"<DID>"} is one section you can add multiple of those comma separated.

About the micloud list devices, yeah i guess i had an filter for that initially because those were not working, i guess that can be removed now! Thanks for reminding me😅

merdok commented 7 months ago

Ah, there is already a flag for that, you should try -> miot cloud list-devices --showAll=true that should show all the devices

mrmaximas commented 7 months ago

Ah, there is already a flag for that, you should try -> miot cloud list-devices --showAll=true that should show all the devices

it's works, thanks! have you another secret keys? ;)