google / python-lakeside

Apache License 2.0
45 stars 18 forks source link

Eufy Vacuum #16

Closed mjcumming closed 5 years ago

mjcumming commented 5 years ago

Wondering what it would take to support the Eufy WiFi vacuum. The device is found when calling get_devices and it shows..

[{'address': '72.50.197.174', 'code': '', 'type': 'T2117', 'name': 'QueenVac', 'id': '62840462807d3a36feb7'}]

mitchellrj commented 5 years ago

There's a local TuyAPI on port 6668. Getting the local key is a pain, but can be done from your Android device.

I've been able to get the status of the device and trigger cleaning via the API.

mitchellrj commented 5 years ago

e.g.

{ devId: 'my_dev_id',
  dps:
   { '1': true,
     '2': false,
     '3': 'forward',
     '5': 'Nosweep',
     '15': 'Charging',
     '101': false,
     '102': 'No_suction',
     '103': false,
     '104': 60,
     '106': 'no_error' } }

Key/Values for status / commands:

mitchellrj commented 5 years ago

There's a decent Python TuyAPI library: clach04/python-tuya, but this is very different to the protobuf used by this library. I suggest any TuyAPI implementation be done as part of a separate library.

mitchellrj commented 5 years ago

Sample code for the Node-based tuyapi library:

const TuyAPI = require('tuyapi');
const device = new TuyAPI({id: 'MY DEVICE ID',key: 'MY SECRET KEY',ip:'VACUUM LAN IP'});
let stateHasChanged = false;

device.on('connected', () => {console.log('Connected to device!');});
device.on('disconnected', () => {console.log('Disconnected from device.');});
device.on('error', error => {console.log('Error!', error);});
device.on('data', data => {
    console.log('Data from device:', data);
    console.log(`Boolean status of default property: ${data.dps['1']}.`);
    // Set default property to opposite
    if (!stateHasChanged){
        device.set({set: !(data.dps['1'])});
        stateHasChanged = true;
    }
});

device.connect();

// start cleaning
device.set({multiple:true,data:{'5':'auto'}}).then(() => console.log('device was changed')));
mjcumming commented 5 years ago

@mitchellrj thank you the link and notes!

jymbob commented 5 years ago

There's a local TuyAPI on port 6668. Getting the local key is a pain, but can be done from your Android device.

I've been able to get the status of the device and trigger cleaning via the API.

Can you give any more hints than "it's a pain"? Does it involve pairing the vac with the Tuya app, or can it be done from within the Eufy ecosystem?

mitchellrj commented 5 years ago

The Eufy app logs it out at various points, you can capture it from there with adb logcat. There may be a simpler way but that's the way I got it.

On Fri, 12 Apr 2019, 11:27 jymbob, notifications@github.com wrote:

There's a local TuyAPI on port 6668. Getting the local key is a pain, but can be done from your Android device.

I've been able to get the status of the device and trigger cleaning via the API.

Can you give any more hints than "it's a pain"? Does it involve pairing the vac with the Tuya app, or can it be done from within the Eufy ecosystem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/python-lakeside/issues/16#issuecomment-482524463, or mute the thread https://github.com/notifications/unsubscribe-auth/AABD47W7XHYYGKK34ZTL443PQBP2NANCNFSM4HCPO6OA .

mitchellrj commented 5 years ago

I've got a basic Python library and demo program working now: https://github.com/mitchellrj/eufy_robovac

I'll be working on fleshing this out more over the next few weeks.

mjcumming commented 5 years ago

I've got a basic Python library and demo program working now: https://github.com/mitchellrj/eufy_robovac I'll be working on fleshing this out more over the next few weeks.

looks great - just need a way to find the local key from iOS.....

mitchellrj commented 5 years ago

More detailed steps on using logcat:

  1. Close the app on your mobile device
  2. Connect the device to your laptop and enable USB debugging
  3. Run adb logcat -e 'tuya.m.my.group.device.list' (assumes you have already installed the Android debug tools)
  4. Launch the Eufy Home app
  5. The output lines contain JSON, you're looking for the values of localKey (16 character hex string) and devId (20 character hex string).
Charly-Man commented 4 years ago

@mitchellrj

unfortunately i can't find the localkey. I installed BlueStacks as an emulator on my MAC, but I don't know how I can read the localkey from the installed EUFYHOME app via a terminal emulator. Can you help?

Translated with Google translater, come from Germany

aboyher commented 4 years ago

More detailed steps on using logcat:

  1. Close the app on your mobile device
  2. Connect the device to your laptop and enable USB debugging
  3. Run adb logcat -e 'tuya.m.my.group.device.list' (assumes you have already installed the Android debug tools)
  4. Launch the Eufy Home app
  5. The output lines contain JSON, you're looking for the values of localKey (16 character hex string) and devId (20 character hex string).

Could the 'tuya.m.my.group.device.list' part have changed? I'm getting no output from adb using this, but i can see 'tuya' and 'eufy' get a lot of traffic. Also, not seeing any localkey or devid.

dohlin commented 4 years ago

@aboyher you need to use Eufy app version 2.3.2. Something has changed with newer versions of the app.

lemon8haasi commented 3 years ago

Hello, could someone help me to get the local key and dev ID of my Eufy G10 Hybrid. What I've done so far - as no android device available. Bluestacks installed and enabled Android Debug Bridge. Installed Eufy Home 2.3.2 in Bluestacks Installed Logcat in Bluestacks If I start Logcat and start Eufy to clean I'm stiffing some messages but nothing looks like a 16 character or 20 character hex string....

jasonkarns commented 2 years ago

Is it known which of the device id and/or local key are affected by email/password changes? I would guess that device ID does not change when creds change, but that local key does... but I'm just guessing. Does anyone already know and can confirm one way or the other?