merdok / homebridge-miot

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

Oven is not working properly in only one mode with param 0 #208

Closed Aekung closed 2 years ago

Aekung commented 2 years ago

Describe the bug After updating the plugin, I found that the oven is not working properly. Every ActionBottons still work. All those cancel, pause, start-cook with params 1 - 3. However, params 0, which is for toast is not working at all.

Expected behavior ActionBottons with params 0 should work just like the rest (from 1 - 3). When pressing, the toast mode should activate according to the Device Metadata.

Your config.json

"actionButtons": [
                        {
                            "action": "oven:start-cook",
                            "name": "toast",
                            "params": [
                                0
                            ]
                        },
                        {
                            "action": "oven:start-cook",
                            "name": "egg tart",
                            "params": [
                                1
                            ]
                        },
                        {
                            "action": "oven:start-cook",
                            "name": "chicken wings",
                            "params": [
                                2
                            ]
                        },
                        {
                            "action": "oven:start-cook",
                            "name": "seafood",
                            "params": [
                                3
                            ]
                        },
                        {
                            "action": "oven:cancel-cooking",
                            "name": "cancel"
                        },
                        {
                            "action": "oven:pause",
                            "name": "pause"
                        }
                    ]

Debug log When activating ActionBottons with param 0, homebridge returns

[08/02/2022, 20:06:09] [homebridge-miot] [Mi Smart Steam Oven] (Protocol) Call 10.46.1.253: action - {"did":"394798560","siid":2,"aiid":1,"in":[]} - {}
[08/02/2022, 20:06:09] [homebridge-miot] [Mi Smart Steam Oven] Error: Error while executing action oven:start-cook with params 0! Invalid response from device. Response: {"code":-4003}

However, when activating other ActionBottons from 1 - 3, the command could execute correctly and homebridge returns

[08/02/2022, 20:09:16] [homebridge-miot] [Mi Smart Steam Oven] (Protocol) Call 10.46.1.253: action - {"did":"394798560","siid":2,"aiid":1,"in":[{"piid":4,"value":2}]} - {}
[08/02/2022, 20:09:16] [homebridge-miot] [Mi Smart Steam Oven] Action oven:start-cook executed! Updating properties!

Screenshots If applicable, add screenshots to help explain your problem.

Additional context My suspect is that there is an error in params code when the value is 0. As you can see, executing with ActionButtons with 0 returns with error without the value after "siid":2,"aiid":1,"in" :[]} - {}

However, when the params value is from 1 - 3, it executes the command correctly with "siid":2,"aiid":1,"in" :[{"piid":4,"value":2}]} - {} I did check and make sure that there are 4 available params for oven:start-cook button. It's from 0 - 3, each represents different mode of the cook.

Can you please check and see what could be the problem?

Thank you and really looking forward to your help.

merdok commented 2 years ago

Oh, yeah... this is certainly a bug from my side! Will fix that in the next update!

Aekung commented 2 years ago

Oh, yeah... this is certainly a bug from my side! Will fix that in the next update!

Noted,

looking forward to the update.

merdok commented 2 years ago

This is now fixed in version 1.0.4