bropat / ioBroker.eusec

This ioBroker adapter allows to control Eufy security devices by connecting to the Eufy cloud servers.
MIT License
132 stars 17 forks source link

ERROR_INVALID_PARAM (-110) #37

Closed MattHodge closed 3 years ago

MattHodge commented 3 years ago

Hi There,

I setup the eufy-security plugin (version 0.0.9) in ioBroker following this tutorial: https://blog.fuzzymistborn.com/controlling-eufy-security-devices-with-iobroker/

I can see all the status of my camera and home base successfully (Homebase 2 + eufyCam 2C).

image

When I try and set data, for example the guard_mode, the value fails to be set, with ioBroker showing the following error log:

2020-12-29 11:08:04.232 - info: eufy-security.0 (13227) state eufy-security.0.T8XXXXXXXXXXXX.station.guard_mode changed: 1 (ack = false)
2020-12-29 11:08:04.233 - debug: eufy-security.0 (13227) Station.setGuardMode(): P2P connection to station T8XXXXXXXXXXXX present, send command mode: 1.
2020-12-29 11:08:04.234 - debug: eufy-security.0 (13227) Station.setGuardMode(): Using CMD_SET_PAYLOAD...
2020-12-29 11:08:04.235 - debug: eufy-security.0 (13227) EufyP2PClientProtocol._sendCommand(): sequence: 0 command_type: 1350 channel: 255 retries: 0 message_states.size: 1
2020-12-29 11:08:04.243 - debug: eufy-security.0 (13227) EufyP2PClientProtocol.handleMsg(): ACK - received from host 10.13.37.21:18042 for datatype DATA sequence 0
2020-12-29 11:08:04.275 - debug: eufy-security.0 (13227) EufyP2PClientProtocol.handleMsg(): DATA - received from host 10.13.37.21:18042 - Processing DATA with sequence 0...
2020-12-29 11:08:04.276 - debug: eufy-security.0 (13227) Station.onCommandResponse(): station: T8XXXXXXXXXXXX command_type: 1224 channel: 255 return_code: ERROR_INVALID_PARAM (-110)
2020-12-29 11:08:04.277 - error: eufy-security.0 (13227) EufySecurity.stationP2PCommandResult(): Station: T8XXXXXXXXXXXX command CMD_SET_ARMING failed with error: ERROR_INVALID_PARAM (-110)
# trimmed the data object
2020-12-29 11:08:04.278 - debug: eufy-security.0 (13227) EufyP2PClientProtocol.handleData(): Result data for command received - message: {"sequence":0,"command_type":1350,"nested_command_type":1224,"channel":255,"data":{"type":"Buffer","data":[209,0,0,0,88,90,89,72,70,5,128,0,0,0,1,0,255,0,0,0,123,34,97,99,99,....]},"retries":1,"acknowledged":true,"return_code":-1,"timeout":{"_idleTimeout":-1,"_idlePrev":null,"_idleNext":null,"_idleStart":19351,"_onTimeout":null,"_repeat":null,"_destroyed":true}} result: ERROR_INVALID_PARAM (-110)
2020-12-29 11:08:04.278 - debug: eufy-security.0 (13227) EufyP2PClientProtocol.handleData(): commandId: 
# I trimmed the msg string
CMD_SET_PAYLOAD (1350) - result: ERROR_INVALID_PARAM (-110) - msg: f1d00098d1000000585a5948XXXXXXXXX

I can send the full data and msg strings, just wasn't sure if they contained secrets so trimmed them.

Appreciate your work on this integration! 👍

tofrie commented 3 years ago

Der selber Fehler tritt bei mir auf. Ein Downgrade auf 0.0.8 funktioniert leider nicht.

MattHodge commented 3 years ago

Thanks for the quick turn around!

I tried the new version 0.1.1 and recreated my Eufy Security adapter just to be sure.

I still get the same error message as my initial post.

tofrie commented 3 years ago

Same here...

[2020-12-29] 16:59:01.658 - info: eufy-security.0 (23719) state eufy-security.0.T8010N23202xxxxx.station.guard_mode changed: 0 (ack = false)

2020-12-29 16:59:01.660 - debug: eufy-security.0 (23719) Station.setGuardMode(): P2P connection to station T8010N23202xxxxx present, send command mode: 0. 2020-12-29 16:59:01.661 - debug: eufy-security.0 (23719) Station.setGuardMode(): Using CMD_SET_PAYLOAD... 2020-12-29 16:59:01.662 - debug: eufy-security.0 (23719) EufyP2PClientProtocol._sendCommand(): sequence: 1 command_type: 1350 channel: 255 retries: 0 message_states.size: 1 2020-12-29 16:59:01.672 - debug: eufy-security.0 (23719) EufyP2PClientProtocol.handleMsg(): ACK - received from host 192.168.178.43:16707 for datatype DATA sequence 1 2020-12-29 16:59:01.697 - debug: eufy-security.0 (23719) EufyP2PClientProtocol.handleMsg(): DATA - received from host 192.168.178.43:16707 - Processing DATA with sequence 1... 2020-12-29 16:59:01.699 - debug: eufy-security.0 (23719) Station.onCommandResponse(): station: T8010N23202xxxxx command_type: 1224 channel: 255 return_code: ERROR_INVALID_PARAM (-110) 2020-12-29 16:59:01.700 - error: eufy-security.0 (23719) EufySecurity.stationP2PCommandResult(): Station: T8010N23202xxxxx command CMD_SET_ARMING failed with error: ERROR_INVALID_PARAM (-110) 2020-12-29 16:59:01.701 - debug: eufy-security.0 (23719) EufyP2PClientProtocol.handleData(): Result data for command received - message: {"sequence":1,"command_type":1350,"nested_command_type":1224,"channel":255,"data":{"type":"Buffer","data":[209,0,0,1,88,90,89,72,70,5,128,0,0,0,1,0,255,0,0,0,123,34,97,99,99,111,117,110,116,95,105,100,34,58,34,99,97,97,54,50,54,56,48,56,100,97,51,56,53,48,51,57,53,50,49,100,50,100,51,55,53,53,48,50,48,99,101,51,100,50,55,54,99,99,50,34,44,34,99,109,100,34,58,49,50,50,52,44,34,109,86,97,108,117,101,51,34,58,48,44,34,112,97,121,108,111,97,100,34,58,123,34,109,111,100,101,95,116,121,112,101,34,58,48,44,34,117,115,101,114,95,110,97,109,101,34,58,34,116,111,98,105,97,115,102,114,105,101,100,114,105,99,104,34,125,125]},"retries":1,"acknowledged":true,"return_code":-1,"timeout":{"_idleTimeout":-1,"_idlePrev":null,"_idleNext":null,"_idleStart":44560,"_onTimeout":null,"_repeat":null,"_destroyed":true}} result: ERROR_INVALID_PARAM (-110) 2020-12-29 16:59:01.702 - debug: eufy-security.0 (23719) EufyP2PClientProtocol.handleData(): commandId: CMD_SET_PAYLOAD (1350) - result: ERROR_INVALID_PARAM (-110) - a msg: `f1d00098d1000001585a594846058400000001Xxxxxxx

bropat commented 3 years ago

@MattHodge, @tofrie

Thanks for the quick feedback :) Could you please tell me your station software version?

tofrie commented 3 years ago

System 2.1.4.4h Subsystem 1.3.0.9

bropat commented 3 years ago

System 2.1.4.4h Subsystem 1.3.0.9

The same version I have and it works for me. What could be the difference...

tofrie commented 3 years ago

0.0.8 lief ohne Probleme. Seit dem Update klappt es nicht mehr. Ich habe es auch mit einer Neuinstallation probiert... leider erfolglos.

MattHodge commented 3 years ago
System 2.1.4.4h
Subsystem 1.3.0.9

🤔

bropat commented 3 years ago

I double checked everything including the original Eufy App source:

public static void setArming(String str, MediaAccountInfo mediaAccountInfo, int i) {
        QueryStationData b = d.a().b(mediaAccountInfo.mHubSn);
        if ((b != null && a.a().a("new_instance_vision_as", b.main_sw_version) && !b.isIntegratedDeviceBySn()) || (b != null && b.isSoloCams())) {
            sendP2PRequest(str, mediaAccountInfo.mHubSn, new P2PRequest(CommandType.APP_CMD_SET_ARMING, new SwitchModeEntity(i, b.a().g().nick_name)));
            return;
        }
        ZMediaCom zMediaCom = new ZMediaCom(mediaAccountInfo.mInitStr, mediaAccountInfo.mDidStr, mediaAccountInfo.mHubSn);
        zMediaCom.msgType = 10;
        zMediaCom.mValueStr = b.a().d(mediaAccountInfo.mHubSn);
        zMediaCom.mCommandType = CommandType.APP_CMD_SET_ARMING;
        zMediaCom.mValue = i;
        zMediaCom.transaction = str;
        ZMediaManager.getInstance().putMsg(zMediaCom);
    }

I don't understand why it works for me and not for you guys. I'm thinking of implementing a fallback for when the new method fails to use the old one. But it would be better to understand why the new method does not work in your case...

bropat commented 3 years ago

@MattHodge, @tofrie

Did you use the Eufy administrator account with ioBroker adapter or another account? If you haven't used the administrator account, please run the test again with it.

Let me know if it works.

PS: Don't worry, if it works I will find a solution. :)

tofrie commented 3 years ago

I‘m working with with my admin account. I tried to delete all logins and established a new connection but it doesn’t work.

MattHodge commented 3 years ago

I‘m working with with my admin account. I tried to delete all logins and established a new connection but it doesn’t work.

Same with me.

Also switched to using 2FA as well, same error.

bropat commented 3 years ago

@MattHodge and/or @tofrie

I would suggest we do a live session where we troubleshoot the problem together. I could do it today at 9.30 PM GMT+1. Let me know :)

tofrie commented 3 years ago

Sorry, ich bin beruflich noch eingespannt :(

MattHodge commented 3 years ago

Hey just saw this, defiantly keen to try. I am in the same time zone as you it seems. Not sure how to directly contact you but my email / Twitter / LinkedIn is listed on the side panel of my blog: https://hodgkins.io/

tofrie commented 3 years ago

I restarted the adapter, restarted the station and re-established all connections. Is it maybe the version of node.js? We all installed the same version on the station. Which system does your iobroker run on? Maybe this is the fault?

bropat commented 3 years ago

@MattHodge I will contact you in the next few days.

@tofrie I don't think it is the node.js version, because the response ERROR_INVALID_PARAM (-110) comes directly from the station via the P2P interface. I think the problem is how the P2P command CMD_SET_PAYLOAD is issued by the adapter. I remember that this adapter was created by reverse engineering and thus some errors or misinterpretations are easily possible ;)

The best we can do to understand where the problem is, is to provisionally invite me with my account to your Eufy account, so I can directly debug the Eufy app, including the network traffic. But I would do that in a live session so you can be right there and remove my account at the end.

tofrie commented 3 years ago

is there a way to install version 0.0.8?

bropat commented 3 years ago

@tofrie

is there a way to install version 0.0.8?

Yes, you can run the following command from the command line:

iobroker url https://github.com/bropat/ioBroker.eufy-security/tarball/0.0.8

bropat commented 3 years ago

@MattHodge, @tofrie

Should be fixed with latest version (0.1.3). Let me know :)

tofrie commented 3 years ago

@bropat works perfect for me! I will continue to watch it today. Thanks for your good work.

MattHodge commented 3 years ago

Thanks @bropat ! New version works great.

Really appreciate your efforts!!