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

Unknown device named ###### model WYSMTOD16A #223

Open
Frederic-SABU opened this issue Jan 15, 2024 · 19 comments
Open

Unknown device named ###### model WYSMTOD16A #223

Frederic-SABU opened this issue Jan 15, 2024 · 19 comments

Comments

@Frederic-SABU
Copy link

I really like the pyvesync library which would allow me to retrieve info in python from my smart outdoor plugs.
The model is GreenSun HSCB-SMT-EU.
pyvesync logs properly to the vesync APIbut the model is not recognized.
Is there anything I should try to retrieve info from this model ?
Alternatively would you be able to recommend a vesync smart plug available in Europe that would work. None of the Etkcity products seem to be available.
Thks.

@webdjoe
Copy link
Owner

webdjoe commented Jun 29, 2024

The only thing I can suggest is to capture packets and build into library. I am happy to assist you with the process

@Flobul
Copy link

Flobul commented Dec 2, 2024

All those sockets are treated via this endpoint and payload:

https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
{
    "appVersion": "VeSync 4.3.40",
    "phoneBrand": "Jeedom-VeSync",
    "phoneOS": "Jeedom-VeSync",
    "traceId": "1733083741506",
    "acceptLanguage": "fr",
    "timeZone": "Europe\/Brussels",
    "accountID": "XXXX",
    "token": "XXXX",
    "method": "bypassV2",
    "debugMode": true,
    "deviceRegion": "EU",
    "cid": "XXXX",
    "configModule": "ZY_WFBO_OTL_WYSMTOD16A_UN",
    "payload": {
        "data": [],
        "method": "getOutletStatus",
        "source": "APP"
    }
}
{
    "traceId": "1733083743506",
    "code": 0,
    "msg": "request success",
    "module": null,
    "stacktrace": null,
    "result": {
        "traceId": "1733083743506",
        "code": 0,
        "result": {
            "enabled": true,
            "voltage": 234.9955291748047,
            "energy": 0.00041502082778,
            "power": 5.35991096496582,
            "current": 0.02284645661711
        }
    }
}

@jmplonka
Copy link

@Flobul : seems to work at least for JeeDom issue #134553 - how was it implemented there?

@Flobul
Copy link

Flobul commented Jan 19, 2025

Hey.
After some digging, I found another way to get all datas from this socket.

method 'getProperty' with payload: "powerSwitch_1","realTimeVoltage","realTimePower","electricalEnergy","protectionStatus","voltageUpperThreshold","currentUpperThreshold","scheduleNum","powerSave","powerProtection","powerUpperThreshold","inchings","aways"

@jmplonka
Copy link

jmplonka commented Jan 20, 2025

@Flobul : what are the methods for

  • get energy (weekly, monthly and yearly)
  • switch the plug on / off
    Thank you for sharing the logs.

At least "get_details()" is working BIG_GRIN

@Flobul
Copy link

Flobul commented Jan 20, 2025

getOutletStatus is not used for this socket on the app to maintain status. Got lucky it worked here, but values are slightly different from this other way =>
But getProperty is. This is the status method sent continually by the app:

{
  "appVersion": "VeSync 5.1.60 build7",
  "phoneBrand": "iPad Air",
  "phoneOS": "iOS12.5.4",
  "traceId": "1733433302338",
  "acceptLanguage": "fr",
  "timeZone": "Europe\/Brussels",
  "accountID": "XXXXXX",
  "token": "XXXXXXXXXXXXXX",
  "method": "bypassV2",
  "debugMode": true,
  "cid": "XXXXXXXXXXXX",
  "configModule": "ZY_WFBO_OTL_WYSMTOD16A_UN",
  "configModel": "ZY_WFBO_OTL_WYSMTOD16A_UN",
  "payload": {
    "data": {
      "properties": ["powerSwitch_1", "realTimeVoltage", "realTimePower", "electricalEnergy", "protectionStatus", "voltageUpperThreshold", "currentUpperThreshold", "scheduleNum"]
    },
    "method": "getProperty",
    "source": "APP"
  },
  "userCountryCode": "FR"
}

@jmplonka
Copy link

get_property is working:

realTimeVoltage = 236.9227294921875
realTimePower = 37.89560317993164
electricalEnergy = 0.20144282673142
protectionStatus = normal
voltageUpperThreshold = 265
currentUpperThreshold = 17
scheduleNum = 26
powerSave = {'enable': 0, 'triggerUpperThreshold': 0}
powerProtection = {'enable': 0, 'triggerType': 'overUpper', 'upperThreshold': 0}
powerUpperThreshold = 4080
inchings = []
aways = []

@jmplonka
Copy link

@Flobul : but setProperty is not working for 'powerSwitch_1' to switch plug on / off?!?

@jmplonka
Copy link

jmplonka commented Jan 20, 2025

Is there a how-to for capturing traffic of vesync app? Didn't succeed until yet.
MacOS, iPhone, WireShark available
frida approach wasn't successful yet with emulated "Pixel3A XL"

@Flobul
Copy link

Flobul commented Jan 20, 2025

@Flobul : but setProperty is not working for 'powerSwitch_1' to switch plug on / off?!?

Works with setSwitch with payload : 'enabled'

@Flobul
Copy link

Flobul commented Jan 20, 2025

Is there a how-to for capturing traffic of vesync app? Didn't succeed until yet. MacOS, iPhone, WireShark available frida approach wasn't successful yet with emulated "Pixel3A XL"

iPad jailbreaked, ssl-kill-switch3 installed, mitmproxy on my Mac.
Up and running.

@jmplonka
Copy link

something is wrong with:

        body['payload'] = {
            'method': 'setSwitch',
            'source': 'APP',
            'data': {'enabled': 1},
        }

@Flobul
Copy link

Flobul commented Jan 21, 2025

something is wrong with:

        body['payload'] = {
            'method': 'setSwitch',
            'source': 'APP',
            'data': {'enabled': 1},
        }

Add {'id': 0, 'enabled': true}

@jmplonka
Copy link

@Flobul : Thank you!
Now I can get Details and toggle switch see fork
Screenshot will follow.

@jmplonka
Copy link

jmplonka commented Jan 21, 2025

how can I update a single file or install the repo to HomeAssistant?

@jmplonka
Copy link

@Flobul : one thing is not working - get energy by period

        body['payload'] = {
            'method': 'getEnergyHistory',
            'source': 'APP',
            'data': {
                'fromDay': int(from_day.timestamp()),
                'toDay'  : int(till_day.timestamp()),
            }
        }

returns code = -1

@Flobul
Copy link

Flobul commented Jan 22, 2025

@Flobul : one thing is not working - get energy by period

        body['payload'] = {
            'method': 'getEnergyHistory',
            'source': 'APP',
            'data': {
                'fromDay': int(from_day.timestamp()),
                'toDay'  : int(till_day.timestamp()),
            }
        }

returns code = -1

Yeah, it doesn't work on every devices.

@Flobul
Copy link

Flobul commented Jan 22, 2025

how can I update a single file or install the repo to HomeAssistant?

I don't use this or homeassistant. 🤗

@jmplonka
Copy link

Well, than I‘m done.
Will prepare the pull request, so @cdnninja can update the HA part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants