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

Wireless Switch not working in homebridge but shown on logs #314

Open
semih-akbas opened this issue May 22, 2023 · 1 comment
Open

Wireless Switch not working in homebridge but shown on logs #314

semih-akbas opened this issue May 22, 2023 · 1 comment

Comments

@semih-akbas
Copy link

Hi, my homebridge-mi-aqara installation is working just fine, however despite showing up on the accessories, it is not updating the state on accessories list. Below, you can find the logs when I physically clicked, long pressed and double clicked the device. Why is it not updating in the homebridge UI like it does for other accessories.

[22/05/2023, 21:32:54] [MiAqaraPlatform] [DEBUG][Revc]{"cmd":"report","model":"switch","sid":"158d00018b49c1","short_id":31625,"data":"{"status":"click"}"}
[22/05/2023, 21:32:56] [MiAqaraPlatform] [DEBUG][Revc]{"cmd":"report","model":"switch","sid":"158d00018b49c1","short_id":31625,"data":"{"status":"long_click_press"}"}
[22/05/2023, 21:32:57] [MiAqaraPlatform] [DEBUG][Revc]{"cmd":"report","model":"switch","sid":"158d00018b49c1","short_id":31625,"data":"{"status":"long_click_release"}"}
[22/05/2023, 21:32:59] [MiAqaraPlatform] [DEBUG][Revc]{"cmd":"report","model":"switch","sid":"158d00018b49c1","short_id":31625,"data":"{"status":"double_click"}"}

@semih-akbas
Copy link
Author

semih-akbas commented May 23, 2023

I think I've found the root cause. If I check the MotionSensorParser class, parserAccessories method, as seen in the code below, the event is advertised with the callbacks to the upper levels. However, this routine does not exist for any ButtonParsers. @YinHangCode I hope this helps.


if(that.platform.ConfigUtil.getAccessorySyncValue(deviceSid, that.accessoryType)) {
                if (motionDetectedCharacteristic.listeners('get').length == 0) {
                    motionDetectedCharacteristic.on("get", function(callback) {
                        var command = '{"cmd":"read", "sid":"' + deviceSid + '"}';
                        that.platform.sendReadCommand(deviceSid, command).then(result => {
                            var value = that.getMotionDetectedCharacteristicValue(result, null);
                            if(null != value) {
                                callback(null, value);
                            } else {
                                callback(new Error('get value fail: ' + result));
                            }
                        }).catch(function(err) {
                            that.platform.log.error(err);
                            callback(err);
                        });
                    });
                }
            }

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

1 participant