merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
395 stars 63 forks source link

Mi Gateway 2 #258

Closed xrust83 closed 2 years ago

xrust83 commented 2 years ago

image

Device model lumi.gateway.v3

Device name Mi Gateway 3

Does the device require a MiCloud connection? Do not know

Anything special about the device? [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Missing siid or piid for gateway:guard-mode property! Cannot create! [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Missing siid or piid for light:on property! Cannot create! [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Initializing device services [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Device services: [ "gateway", "alarm", "light", "motion-sensor" ] [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Initializing device properties [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Device properties: [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Initializing device actions [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Device not supported! Using a generic device with limited properties! Consider requesting device support! [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Initializing accessory! [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Accessory successfully initialized! [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Registering 1 accessories! [11/04/2022, 10:14:24] [miot] [Mi Gateway 2] Everything looks good! Initiating property polling!

[11/04/2022, 10:14:25] [miot] [Mi Gateway 2] Device found: lumi.gateway.v3 [11/04/2022, 10:14:25] [miot] [Mi Gateway 2] Setting up miot device! [11/04/2022, 10:14:25] [miot] [Mi Gateway 2] Device requires MiCloud! Trying to connect! [11/04/2022, 10:14:25] Loaded 0 cached accessories from cachedAccessories.04CF8CA9D72E.

The problem may be due to the mac address. it starts with 0 ... (04CF8CA9D72E) where some plugins reject this 0 and then the device does not work. There was a whole series of such devices

merdok commented 2 years ago

Gateways are generally not supported by the plugin, nothing to do with the MAC address. What do you want to use the device for?

If you need access to the light, alarm or motion sensor from the device then you can create yourself a custom accessory and add your own properties frommte device which you want(see README). More info about that in #222 where some already uses a gateway like that.

xrust83 commented 2 years ago

I need Alarm, radio, light bulb, light sensor

merdok commented 2 years ago

Yeah then simply as stated above, set the device as custom accessory and add yourself all the properties which you need! They will then show up in HomeKit.

xrust83 commented 2 years ago

I tried to make settings from post # 222 buttons are declared, but no action

merdok commented 2 years ago

You have to check the spec for your device to know what properties exists and what name or ids they have. Simply copy paste will not work since every device is different. Use that issue just a reference on how to proceed. To get the spec for your device, go here and enter your device model https://merdok.github.io/miotspec/ This will present you with a list of all available properties.

xrust83 commented 2 years ago

I also reached this stage, but for example the guard does not expose options 1, 2, 3, 4 as in the example

Знімок екрана 2022-04-11 о 20 39 01

https://github.com/merdok/homebridge-miot/issues/222#issuecomment-1046061207

merdok commented 2 years ago

I just explained to you that every device is different and the supported features unfortunately differ. This is something i cannot change since this is done by the manufacturer. Your device simply does not support multiply values for that property. In your case it is either on or off.

xrust83 commented 2 years ago

You could help me create a json for my device with all possible parameters

merdok commented 2 years ago

Everything is well documented and you should use that info to create yourself your own configuration, if I would just create configs for all people then i could not do anything else 😅 Anyway i make a exception for you since it is only a few on your device:

          "propertyControl": [
            {
              "property": "2.0",
              "name": "Guard Mode"
            },
            {
              "property": "3.1",
              "name": "Alarm"
            },
            {
              "property": "3.2",
              "name": "Alarm Volume"
            },
            {
              "property": "4.0",
              "name": "Light"
            }
          ],
          "propertyMonitor": [
            {
              "property": "5.1",
              "name": "Illumination"
            }
          ]

Oh and you can also set the customAccessory to true

xrust83 commented 2 years ago

Thank you. My mistake was in setting the custom parameter true. I added this cond and the result is the following, the light sensor and volume work fine, and those parameters that do not have parameters "propertyControl": [ { "property": "2.0", "name": "Guard Mode" }, { "property": "3.1", "name": "Alarm" }, { "property": "4.0", "name": "Light" } ], IMG_4922

display buttons but switching them does not affect anything.

Thanks for the help, I just experimented only on the alarm, and since it doesn't work I didn't get to the other buttons

merdok commented 2 years ago

Then you need to post some log from when you try to use the not working alarm button.

xrust83 commented 2 years ago

[12/04/2022, 10:21:14] [miot] [Mi Gateway 2] Successfully set property alarm:alarm to value true! Response: [{"did":"133588992","siid":3,"piid":1,"code":0,"exe_time":0}] [12/04/2022, 10:21:18] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:21:18] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:21:18] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:21:20] [miot] [Ночник] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:21:20] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:21:20] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: true", "alarm:volume: 33", "motion-sensor:illumination: 0" ] [12/04/2022, 10:21:24] [miot] [Mi Gateway 2] Set alarm:alarm property request! RAW: {"did":"133588992","siid":3,"piid":1,"value":false} [12/04/2022, 10:21:24] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":1,"value":false}]} [12/04/2022, 10:21:26] [miot] [Mi Gateway 2] Successfully set property alarm:alarm to value false! Response: [{"did":"133588992","siid":3,"piid":1,"code":0,"exe_time":0}] [12/04/2022, 10:21:28] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:21:28] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:21:28] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:21:32] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":0} [12/04/2022, 10:21:32] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":0}]} [12/04/2022, 10:21:33] [miot] [Mi Gateway 2] Poll failed 1 times! [12/04/2022, 10:21:33] [miot] [Mi Gateway 2] Poll failed! Error: FetchError: network timeout at: https://api.io.mi.com/app/miotspec/prop/get [12/04/2022, 10:21:34] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 0! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:21:38] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:21:38] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:21:38] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:21:39] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":33} [12/04/2022, 10:21:39] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":33}]} [12/04/2022, 10:21:41] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:21:41] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: true", "alarm:volume: 0", "motion-sensor:illumination: 0" ] [12/04/2022, 10:21:41] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 33! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:21:48] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:21:48] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:21:48] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:21:51] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:21:51] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: false", "alarm:volume: 33", "motion-sensor:illumination: 0" ] [12/04/2022, 10:21:58] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":0} [12/04/2022, 10:21:58] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":0}]} [12/04/2022, 10:21:58] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:21:58] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:21:58] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:22:00] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:22:00] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: false", "alarm:volume: 33", "motion-sensor:illumination: 0" ] [12/04/2022, 10:22:07] [miot] [Mi Gateway 2] Set alarm:alarm property request! RAW: {"did":"133588992","siid":3,"piid":1,"value":true} [12/04/2022, 10:22:07] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":1,"value":true}]} [12/04/2022, 10:22:08] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:22:08] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:22:08] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:22:09] [miot] [Mi Gateway 2] Successfully set property alarm:alarm to value true! Response: [12/04/2022, 10:22:11] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:22:11] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: true", "alarm:volume: 0", "motion-sensor:illumination: 0" ] [12/04/2022, 10:22:13] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":33} [12/04/2022, 10:22:13] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":33}]} [12/04/2022, 10:22:13] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":100} [12/04/2022, 10:22:13] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":100}]} [12/04/2022, 10:22:15] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 100! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:22:18] [miot] [Mi Gateway 2] FetchError: network timeout at: https://api.io.mi.com/app/miotspec/prop/set [12/04/2022, 10:22:18] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:22:18] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:22:18] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2} [12/04/2022, 10:22:20] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":25} [12/04/2022, 10:22:20] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":25}]} [12/04/2022, 10:22:20] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:22:20] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: false", "alarm:volume: 100", "motion-sensor:illumination: 0" ] [12/04/2022, 10:22:21] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 25! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:22:21] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":29} [12/04/2022, 10:22:21] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":29}]} [12/04/2022, 10:22:23] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 29! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:22:24] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":28} [12/04/2022, 10:22:24] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":28}]} [12/04/2022, 10:22:25] [miot] [Mi Gateway 2] Property alarm:volume seems to have already the value: 29. Set not needed! Skipping... [12/04/2022, 10:22:26] [miot] [Mi Gateway 2] Set alarm:volume property request! RAW: {"did":"133588992","siid":3,"piid":2,"value":30} [12/04/2022, 10:22:26] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/set - {"params":[{"did":"133588992","siid":3,"piid":2,"value":30}]} [12/04/2022, 10:22:26] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 28! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:22:27] [miot] [Mi Gateway 2] Successfully set property alarm:volume to value 30! Response: [{"did":"133588992","siid":3,"piid":2,"code":0,"exe_time":0}] [12/04/2022, 10:22:28] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:22:28] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:22:28] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:22:29] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:22:30] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: false", "alarm:volume: 30", "motion-sensor:illumination: 0" ] [12/04/2022, 10:22:38] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:22:38] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:22:38] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:22:40] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:22:40] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: false", "alarm:volume: 30", "motion-sensor:illumination: 0" ] [12/04/2022, 10:22:48] [miot] [Mi Gateway 2] Splitting properties into chunks. Number of chunks: 1. Chunk size: 14 [12/04/2022, 10:22:48] [miot] [Mi Gateway 2] Chunks: [ [ "alarm:alarm", "alarm:volume", "motion-sensor:illumination" ] ] [12/04/2022, 10:22:48] [miot] [Mi Gateway 2] (MiCloud) Encrypted request https://api.io.mi.com/app/miotspec/prop/get - {"params":[{"did":"133588992","siid":3,"piid":1},{"did":"133588992","siid":3,"piid":2},{"did":"133588992","siid":5,"piid":1}]} [12/04/2022, 10:22:50] [miot] [Mi Gateway 2] Error while parsing response from device for property motion-sensor:illumination. Response: {"did":"133588992","siid":5,"piid":1,"code":-704220043,"exe_time":0} [12/04/2022, 10:22:50] [miot] [Mi Gateway 2] Device properties updated: [ "alarm:alarm: false", "alarm:volume: 30", "motion-sensor:illumination: 0" ]

merdok commented 2 years ago

I think there might be some kind of an issue with properties which have id 0, can you please try "gateway:guard-mode" instead of "2.0" and "light:on" instead of "4.0"

merdok commented 2 years ago

Please post a debug log from the homebridge startup where this device is getting initialized, I need to see what is happening there and why the properties are skipped...

xrust83 commented 2 years ago

homebridge.log.txt

merdok commented 2 years ago

Well, yeah so as i suspected. The properties have id 0 which currently my plugin detects as invalid since i actually never saw a device which has 0 as id and never thought it might be possible. I would need to fix that in the code, i think i can do that in the next update, so for now you will not be able to use those features.

merdok commented 2 years ago

Should now be fixed in version 1.1.1

xrust83 commented 2 years ago

homebridge.log (1).txt

merdok commented 2 years ago

Try version 1.1.2

xrust83 commented 2 years ago

homebridge.log-3.txt

merdok commented 2 years ago

Please try version 1.1.3 :)

xrust83 commented 2 years ago

good news. two new Guard Mode and Light switches have appeared. offensive working Light coil is an LED ring, without the ability to adjust the brightness and color. guard mode controls the security system. turns everything on and off well. Alarm and buzzer without reaction image

I have more questions. guard mode turns alarms on and off, it's a great fad to add to home automation. can there be an alarm: alarm trigger in breaking the alarm when you turn it on I have to turn on the Alarm! on the gateway, if so it would be great, as the basic security system mi gateway and aqara hub can not activate the alarm with external sensors not xiao not connected to these hubs. the alarm call switch will allow to assign to the alarm trigger any sensor of a door of a window, the movement, etc. any manufacturer about thrown through the homebridge.

merdok commented 2 years ago

Very good :) You can add the alarm:alarm to the propertyMonitor section and se the excepted value to true, that way you will get a presence sensor which will trigger whenever the value is turned on and you can create an automation based on that.