VeSync Binding not working

I am on openHAB 4.3.3 and installed the VeSync binding to integrate a new air purifier in my smart home. The bridge has been defined in a .things file and the credentials are correctly provided (checked more than double with the VeSync app), but the binding throws a configuration error to check login credentials.
I searched for the problem and found that users from home assistant are reporting issues currently as well, pointing to a changed process in VeSync due to the location settings in the VeSync app (using Germany as location here).
Anybody experienced similar issues or any hint what to do?

What’s the model?

It is a Core300S - the problem is shown already for the bridge, before detecting or setting up the air purifier itself.

Well, time to go Local only my friend :slight_smile:

Check my post about installing esphome on the 400s, I tried to go into detail there. →

There’s a PR up now too:

It wasn’t that hard at all.

Thanks for the info - but unfortunately I am only an IT nerd, not an electrical DIY freak… :slight_smile:
… means, my question is still open for me… :wink:

You could open a GitHub issue with this request. Please add a trace log of the binding that shows what is going on.
From there it might be possible to determine the cause or add support.

2 Likes

FYI the electricity involved is the same as when you plug a usb pen on an usb port. You may be scaring yourself out of a perfectly good solution for nothing :smiley:

Thank you - created an issue on Github: [VeSync] Bridge configuration error login Ā· Issue #19127 Ā· openhab/openhab-addons Ā· GitHub

I wonder if app version is too low Ā· Issue #13 Ā· mickgiles/homebridge-tsvesync Ā· GitHub is the same issue? The log you posted in the issue doesn’t contain enough detail to confirm. If it is just the appVersion being too log, https://smedley.id.au/tmp/org.openhab.binding.vesync-5.1.0-SNAPSHOT.jar might work.

Is there any way to create a set of test credentials I could use to debug this?

I looked into the homebridge issue, it could be related but I don’t know how to confirm. The log I posted on GitHub is the result from TRACE.

Installing the 5.1.0 snapshot jar did not fix the problem.
I send you the test credentials via PM.
Thank you - Dirk

OK confirming the response received is:

{ā€œtraceIdā€:ā€œ1756502574749ā€,ā€œcodeā€:-11012022,ā€œmsgā€:ā€œapp version is too lowā€,ā€œmoduleā€:null,ā€œstacktraceā€:null,ā€œresultā€:null}

Investigating now…

1 Like

OK so I now understand what needs to change, I just need a couple of clear hours to make the changes.

1 Like

Same at my openHAB system.

Thanks Paul, if I can support or help just reach out :slight_smile:

Manuel

Thanks, will hopefully spend some time on this over the weekend

1 Like

Currently hackery, but I have login working, need to fix device parsing. I see what’s wrong, the initial login returns an authorizeCode which needs to be exchanged for a token. Will get back to this when I can. The returned string is like:

{"traceId":"1757207710797","code":0,"msg":"request success","result":{"accountID":"19699034","avatarIcon":"https://image.vesync.com/defaultImages/user/avatar_nor.png","nickName":"username","mailConfirmation":true,"registerSourceDetail":null,"registerAppVersion":"VeSync 5.6.73","registerTime":"2025-08-29 14:20:26","verifyEmail":"username@domain.com","accountLockTimeInSec":null,"bizToken":null,"mfaMethodList":null,"authorizeCode":"xxxxxxxxxxxxxxxxxxxxx","emailUpdateToSame":"notUpdate","userType":"1"}}

Once ā€˜working’ need to add code to help it determine which host to use (based on region) - ie https://smartapi.vesync.com or https://smartapi.vesync.eu

1 Like

you can just add a field to fill out by binding configuration if you are EU or US :slight_smile: will be the easiest way

There are more countries than just US and EU - AU :slight_smile:

There are bigger problems to address before tacking the country code side, I need to figure out the right parameters to exchange the authorizeCode for a token, what I tried on Sunday complained about an invalid parameter :frowning:

I probably need to install pyvesync and add some debug to print the parameters it’s using for the api call.

import asyncio
import logging
import ssl
import certifi
import aiohttp
from pyvesync import VeSync

# Userdata for the VeSync-accouint
EMAIL = "user"
PASSWORD = "password"
REGION = "eu"  # "us", "eu" or "cn"

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("pyvesync")
logger.setLevel(logging.DEBUG)

async def main():
    ssl_context = ssl.create_default_context(cafile=certifi.where())

    async with aiohttp.ClientSession(
        connector=aiohttp.TCPConnector(ssl=ssl_context)
    ) as session:
        manager = VeSync(EMAIL, PASSWORD, REGION, session=session)

        try:
            await manager.login()
            print("āœ… Login success")

            # GerƤte abrufen
            await manager.update()
            print("Found devices:")
            for d in manager.devices:
                print(f"- {d.device_name} ({d.device_type})")

        except Exception as e:
            print("āŒ Login unsuccess:", e)

asyncio.run(main())

Thanks, but that doesn’t help understand what parameters VeSync() is passing to the API.

More hacks Ā· psmedley/openhab-addons@42a555f Ā· GitHub has the current call to exchange a authorizeCode for a token, but I get an invalid parameters error - so there’s either a missing or incorrect json parameter.

If i know right, the madatory fields are

{
  "email": "your_email@example.com",
  "password": "your_password",
  "method": "login"
}

but the mobile app is sending:

{   
    "email": "your_email@example.com",   
    "password": "your_password",   
    "method": "login",   
    "timeZone": "Europe/Berlin",   
    "acceptLanguage": "en",   
    "appVersion": "2.0.0",   
    "phoneBrand": "java-client",   
    "phoneOS": "android" 
} 

In practice, VeSync seems to be quite finicky.

If it helps you i can try doing a trace with wireshark when I run the python script