pyvesync
pyvesync copied to clipboard
Add support for Smart bulb ESL100MC
It would be great if you could add support for ESL100MC "multicolor" light bulb! Personally i don't care about the "multicolor" option, i just want to be able to switch it on/off
Capture some packets and I'll be happy to add!
@webdjoe
Setting color + brightness:
{ "payload": { "source": "APP", "method": "setLightStatus", "data": { "action": "on", "speed": 0, "green": 169, "brightness": 100, "blue": 177, "red": 255, "colorMode": "color" } }, "phoneOS": "iPadOS 15.2", "acceptLanguage": "en", "phoneBrand": "iPad", "cid": "ABC123***", "configModule": "WiFi_Bulb_MulticolorBulb_US", "token": "ABC123***", "timeZone": "Europe\/Warsaw", "traceId": "ABC123***", "userCountryCode": "PL", "appVersion": "VeSync 3.2.6 build6", "accountID": "ABC123***", "method": "bypassV2" }
@webdjoe
Turning on:
{ "payload": { "source": "APP", "method": "setSwitch", "data": { "id": 0, "enabled": true } }, "phoneOS": "iPadOS 15.2", "acceptLanguage": "en", "phoneBrand": "iPad", "cid": "ABC123***", "configModule": "WiFi_Bulb_MulticolorBulb_US", "token": "ABC123***", "timeZone": "Europe\/Warsaw", "traceId": "ABC123***", "userCountryCode": "PL", "appVersion": "VeSync 3.2.6 build6", "accountID": "ABC123***", "method": "bypassV2" }
@webdjoe
Getting status:
{ "payload": { "source": "APP", "method": "getLightStatus", "data": {} }, "phoneOS": "iPadOS 15.2", "acceptLanguage": "en", "phoneBrand": "iPad", "cid": "ABC123***", "configModule": "WiFi_Bulb_MulticolorBulb_US", "token": "ABC123***", "timeZone": "Europe\/Warsaw", "traceId": "ABC123***", "userCountryCode": "PL", "appVersion": "VeSync 3.2.6 build6", "accountID": "ABC123***", "method": "bypassV2" }
@webdjoe all should POST https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
Thank you, I will work on this. How did you capture packets from the app?
On Thu, Feb 24, 2022 at 4:49 PM michalantoszczuk @.***> wrote:
@webdjoe https://github.com/webdjoe all should POST https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
— Reply to this email directly, view it on GitHub https://github.com/webdjoe/pyvesync/issues/89#issuecomment-1050299309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6JJBRIYN5BS2AGC2OTADTU42RX5ANCNFSM5D4F2QFA . You are receiving this because you were mentioned.Message ID: @.***>
@webdjoe macOS 12 (Apple M1) + VeSync app (from AppStore, version iPad/iPhone) + Charles (https://www.charlesproxy.com). If you need more packets, just tell me.
+1, also have some ESL100MC bulbs :)
Thank you, I will work on this. How did you capture packets from the app? … On Thu, Feb 24, 2022 at 4:49 PM michalantoszczuk @.> wrote: @webdjoe https://github.com/webdjoe all should POST https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2 — Reply to this email directly, view it on GitHub <#89 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6JJBRIYN5BS2AGC2OTADTU42RX5ANCNFSM5D4F2QFA . You are receiving this because you were mentioned.Message ID: @.>
Any news?
@michalantoszczuk I'm working on this now. Can you send the device list return? It should be from the home screen of the app.
@michalantoszczuk Apologies, I meant the api call return of the device list. Also can you send the returns as well. Hard to debug or test without them
@webdjoe anything else?
getHomeInfo:
Request:
:method POST :scheme https :path /cloud/v1/homeManaged/getHomeInfo :authority smartapi.vesync.com accept */* content-type application/json accept-encoding br;q=1.0, gzip;q=0.9, deflate;q=0.8 user-agent VeSync/3.2.42 (com.etekcity.vesyncPlatform; build:12; iOS 15.5.0) Alamofire/5.2.1 accept-language pl-PL;q=1.0, en-PL;q=0.9, de-PL;q=0.8 content-length 357
Response:
{ "traceId": "1659807701719", "code": 0, "msg": "request success", "result": { "roomInfoList": [{ "roomId": 1234567, "roomName": "Backyard", "roomLight": "Part Sun,part Shade", "createTime": 12345678901, "groupList": [], "deviceList": [] }, { "roomId": 1234567, "roomName": "Bedroom", "roomLight": "Part Sun,part Shade", "createTime": 12345678901, "groupList": [], "deviceList": [{ "logicDeviceType": 1, "isOwner": true, "cid": "1234567890qwertyuiopQWERTYUIOP12", "uuid": "a1234567-1234-1abc-12ab-a1b2345c67d8", "macID": null, "subDeviceNo": 0, "subDeviceType": null, "deviceName": "Lampa sypialnia", "deviceImg": "https://image.vesync.com/defaultImages/ESL100MC/icon_color_light_bulb.png", "configModule": "WiFi_Bulb_MulticolorBulb_US", "deviceRegion": "EU", "type": "Wifi-light", "deviceType": "ESL100MC", "authKey": null, "connectionType": "wifi", "currentFirmVersion": "1.0.12", "createTime": 12345678901, "sharedPeople": [], "deviceStatus": "on", "connectionStatus": "online", "mode": null, "speed": null, "extension": null, "deviceProp": null }] }, { "roomId": 1234567, "roomName": "Kitchen", "roomLight": "Part Sun,part Shade", "createTime": 12345678901, "groupList": [], "deviceList": [] }, { "roomId": 1234567, "roomName": "Living Room", "roomLight": "Part Sun,part Shade", "createTime": 12345678901, "groupList": [], "deviceList": [] }, { "roomId": 1234567, "roomName": "Master Bedroom", "roomLight": "Part Sun,part Shade", "createTime": 12345678901, "groupList": [], "deviceList": [] }, { "roomId": 1234567, "roomName": "pokój X", "roomLight": "Part Sun,part Shade", "createTime": 12345678901, "groupList": [], "deviceList": [{ "logicDeviceType": 1, "isOwner": true, "cid": "1234567890qwertyuiopQWERTYUIOP12", "uuid": "a1234567-1234-1abc-12ab-a1b2345c67d8", "macID": null, "subDeviceNo": 0, "subDeviceType": null, "deviceName": "Pokój X lampa ", "deviceImg": "https://image.vesync.com/defaultImages/ESL100MC/icon_color_light_bulb.png", "configModule": "WiFi_Bulb_MulticolorBulb_US", "deviceRegion": "EU", "type": "Wifi-light", "deviceType": "ESL100MC", "authKey": null, "connectionType": "wifi", "currentFirmVersion": "1.0.12", "createTime": 12345678901, "sharedPeople": [], "deviceStatus": "on", "connectionStatus": "online", "mode": null, "speed": null, "extension": null, "deviceProp": null }] }, { "roomId": 0, "roomName": null, "roomLight": null, "createTime": null, "groupList": [], "deviceList": [] }] } }
@michalantoszczuk Thank you, I also need the "getting status" return from the server. The return json from the set status calls have code: 0
correct?
example:
{ "traceId": "123", "code": 0, "msg": "request success", "result": { "traceId": "123", "code": 0, "result": { "action": "on", "brightness": 100, "colorMode": "color", "speed": 0, "red": 255, "green": 1, "blue": 0 } } }
@webdjoe have you maybe had a chance to add this bulb? :)
Hey @michalantoszczuk @aigimig Please check out PR #149 . I added support for the ESL100MC. Not able to test but based off your captures should be close
@sdrapha Please check out #149 and make sure I didn't break any of your methods for Valceno bulbs. I tried to maintain consistency and compatibility with your code.
@sdrapha Please check out #149 and make sure I didn't break any of your methods for Valceno bulbs. I tried to maintain consistency and compatibility with your code.
I'll take a look a it once I get a chance to sit down at the computer, maybe later in the night.
hi, thanks for your work @webdjoe! I had a look at the latest release and have one problem. The on/off function seems to be working fine but setting the color/brightness has no effect on the bulb despite the 'success' response. Any ideas?
Code:
device.display()
device.turn_on()
device.display()
device.set_rgb_color(255, 0, 0)
device.set_brightness(1)
device.display()
Debug mode output:
Device Name:.................. Lamp
Model: ....................... ESL100MC
Subdevice No: ................ None
Status: ...................... off
Online: ...................... online
Type: ........................ Wifi-light
CID: ......................... CID_redacted_CID
UUID: ........................ UUID_redacted_UUID
Brightness: .................. 43 %
ColorHSV: .................... hue: 0.0, saturation: 0.0, value: 54.0,
ColorRGB: .................... hue: 0.0, saturation: 0.0, value: 54.0,
ColorMode: ................... color
2022-11-03 14:59:34,309 - DEBUG - =======call_api=============================
2022-11-03 14:59:34,310 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api
2022-11-03 14:59:34,310 - DEBUG - API call URL:
https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
2022-11-03 14:59:34,310 - DEBUG - API call headers:
{"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"}
2022-11-03 14:59:34,310 - DEBUG - API call json:
{"timeZone": "Europe/Warsaw", "acceptLanguage": "en", "accountID": "1234567", "token": "token_redacted", "appVersion": "2.8.6", "phoneBrand": "iPad", "phoneOS": "iPadOS 15.2", "traceId": "1667483974", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "CID_redacted_CID", "configModule": "WiFi_Bulb_MulticolorBulb_US", "payload": {"source": "APP", "method": "setSwitch", "data": {"id": 0, "enabled": true}}}
2022-11-03 14:59:35,035 - DEBUG - API response:
{'traceId': '1667483974', 'code': 0, 'msg': 'request success', 'module': None, 'stacktrace': None, 'result': {'traceId': '1667483974', 'code': 0}}
2022-11-03 14:59:35,052 - DEBUG - =======call_api=============================
2022-11-03 14:59:35,052 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api
2022-11-03 14:59:35,052 - DEBUG - API call URL:
https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
2022-11-03 14:59:35,052 - DEBUG - API call headers:
{"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"}
2022-11-03 14:59:35,052 - DEBUG - API call json:
{"timeZone": "Europe/Warsaw", "acceptLanguage": "en", "accountID": "1234567", "token": "token_redacted", "appVersion": "2.8.6", "phoneBrand": "iPad", "phoneOS": "iPadOS 15.2", "traceId": "1667483975", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "CID_redacted_CID", "configModule": "WiFi_Bulb_MulticolorBulb_US", "payload": {"method": "setLightStatus", "source": "APP", "data": {"action": "on", "speed": 0, "red": 255, "green": 0, "blue": 0, "colorMode": "color"}}}
Device Name:.................. Lamp
Model: ....................... ESL100MC
Subdevice No: ................ None
Status: ...................... on
Online: ...................... online
Type: ........................ Wifi-light
CID: ......................... CID_redacted_CID
UUID: ........................ UUID_redacted_UUID
Brightness: .................. 43 %
ColorHSV: .................... hue: 0.0, saturation: 0.0, value: 54.0,
ColorRGB: .................... hue: 0.0, saturation: 0.0, value: 54.0,
ColorMode: ................... color
2022-11-03 14:59:35,789 - DEBUG - API response:
{'traceId': '1667483975', 'code': 0, 'msg': 'request success', 'module': None, 'stacktrace': None, 'result': {'traceId': '1667483975', 'code': 11000000}}
2022-11-03 14:59:35,791 - DEBUG - =======call_api============================= 2022-11-03 14:59:35,791 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api 2022-11-03 14:59:35,791 - DEBUG - API call URL: https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2 2022-11-03 14:59:35,791 - DEBUG - API call headers: {"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"} 2022-11-03 14:59:35,791 - DEBUG - API call json: {"timeZone": "Europe/Warsaw", "acceptLanguage": "en", "accountID": "1234567", "token": "token_redacted", "appVersion": "2.8.6", "phoneBrand": "iPad", "phoneOS": "iPadOS 15.2", "traceId": "1667483975", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "CID_redacted_CID", "configModule": "WiFi_Bulb_MulticolorBulb_US", "payload": {"method": "setLightStatus", "source": "APP", "data": {"action": "on", "speed": 0, "brightness": 1}}} 2022-11-03 14:59:36,505 - DEBUG - API response: {'traceId': '1667483975', 'code': 0, 'msg': 'request success', 'module': None, 'stacktrace': None, 'result': {'traceId': '1667483975', 'code': 11000000}}
Device Name:.................. Lamp
Model: ....................... ESL100MC
Subdevice No: ................ None
Status: ...................... on
Online: ...................... online
Type: ........................ Wifi-light
CID: ......................... CID_redacted_CID
UUID: ........................ UUID_redacted_UUID
Brightness: .................. 1 %
ColorHSV: .................... hue: 0.0, saturation: 100.0, value: 100.0,
ColorRGB: .................... hue: 0.0, saturation: 100.0, value: 100.0,
ColorMode: ................... color
@aigimig the display() method was wrong, and I created a PR to fix that. But, what about the physical bulb itself, does it change color or is that also broken? because that would be an separate issue from the display method I put the fix for. I had a quick look at the code and didn't find anything obvious out of place. but I don't have a esl100mc myself to test it.
only thing I noticed from your debug output:
{"method": "setLightStatus", "source": "APP", "data": {"action": "on", "speed": 0, "red": 255, "green": 0, "blue": 0, "colorMode": "color"}}}
there is no "brightness" key on that payload. maybe that is the issue.
the captured call from @michalantoszczuk does include the brightness key:
{ "source": "APP", "method": "setLightStatus", "data": { "action": "on", "speed": 0, "green": 169, "brightness": 100, "blue": 177, "red": 255, "colorMode": "color" }
@sdrapha The bulb only changes colors when controlled from the official VeSync app. When controlled by the pyvesync lib, only turn on/off works but not the color or brightness. I noticed the 'brightness' difference too and tried to add it in debug mode but it made no difference - no effect on the bulb itself. @michalantoszczuk maybe you can have a look and confirm whether it works for you or if the setLightStatus has changed?
There are a few possible issues - userCountryCode
, debugMode
and brightness
in the request. Let me make adjustments and I'll start a new branch. @aigimig, are you based in the EU?
@aigimig Can you try testing this branch? https://github.com/sdrapha/pyvesync/tree/patch-2 I added an empty brightness key, to the calls that only changes the colors
Do you know how to clone the git, and setup an virtual env on python to do that? the CONTRBUTING.md has some instruction on how to do that, so you can test the current code directly, without waiting for a release, the only difference would be the git clone address, where you would git clone https://github.com/sdrapha/pyvesync/tree/patch-2
instead
If it works I do a PR with that change
@webdjoe yes, EU @sdrapha I will check tonight and let you know
The result is still the same. The response is 'success' but the bulb's color/brightness does not change. I also tried modifying timezone, region and even app version to match what I've got on my phone but that did not change anything.
Code:
device.display()
device.turn_on()
device.display()
device.set_rgb_color(255, 0, 0)
device.set_brightness(1)
device.display()
Debug mode output:
Device Name:.................. Lamp
Model: ....................... ESL100MC
Subdevice No: ................ None
Status: ...................... off
Online: ...................... online
Type: ........................ Wifi-light
CID: ......................... CID_redacted_CID
UUID: ........................ UUID_redacted_UUID
Brightness: .................. 43 %
ColorHSV: .................... hue: 0.0, saturation: 0.0, value: 54.0,
ColorRGB: .................... red: 138.0, green: 138.0, blue: 138.0,
ColorMode: ................... color
2022-11-04 17:56:47,986 - DEBUG - =======call_api=============================
2022-11-04 17:56:47,986 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api
2022-11-04 17:56:47,986 - DEBUG - API call URL:
https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
2022-11-04 17:56:47,986 - DEBUG - API call headers:
{"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"}
2022-11-04 17:56:47,986 - DEBUG - API call json:
{"timeZone": "Europe/Warsaw", "acceptLanguage": "en", "accountID": "1234567", "token": "token_redacted", "appVersion": "2.8.6", "phoneBrand": "SM N9005", "phoneOS": "Android", "traceId": "1667581007", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "CID_redacted_CID", "configModule": "WiFi_Bulb_MulticolorBulb_US", "payload": {"source": "APP", "method": "setSwitch", "data": {"id": 0, "enabled": true}}}
2022-11-04 17:56:48,733 - DEBUG - API response:
{'traceId': '1667581007', 'code': 0, 'msg': 'request success', 'module': None, 'stacktrace': None, 'result': {'traceId': '1667581007', 'code': 0}}
2022-11-04 17:56:48,733 - DEBUG - =======call_api=============================
2022-11-04 17:56:48,733 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api
2022-11-04 17:56:48,733 - DEBUG - API call URL:
https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
2022-11-04 17:56:48,733 - DEBUG - API call headers:
{"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"}
2022-11-04 17:56:48,733 - DEBUG - API call json:
{"timeZone": "Europe/Warsaw", "acceptLanguage": "en", "accountID": "1234567", "token": "token_redacted", "appVersion": "2.8.6", "phoneBrand": "SM N9005", "phoneOS": "Android", "traceId": "1667581008", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "CID_redacted_CID", "configModule": "WiFi_Bulb_MulticolorBulb_US", "payload": {"method": "setLightStatus", "source": "APP", "data": {"action": "on", "speed": 0, "brightness": "", "red": 255, "green": 0, "blue": 0, "colorMode": "color"}}}
Device Name:.................. Lamp
Model: ....................... ESL100MC
Subdevice No: ................ None
Status: ...................... on
Online: ...................... online
Type: ........................ Wifi-light
CID: ......................... CID_redacted_CID
UUID: ........................ UUID_redacted_UUID
Brightness: .................. 43 %
ColorHSV: .................... hue: 0.0, saturation: 0.0, value: 54.0,
ColorRGB: .................... red: 138.0, green: 138.0, blue: 138.0,
ColorMode: ................... color
2022-11-04 17:56:49,548 - DEBUG - API response:
{'traceId': '1667581008', 'code': 0, 'msg': 'request success', 'module': None, 'stacktrace': None, 'result': {'traceId': '1667581008', 'code': 11000000}}
2022-11-04 17:56:49,548 - DEBUG - =======call_api============================= 2022-11-04 17:56:49,548 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api 2022-11-04 17:56:49,548 - DEBUG - API call URL: https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2 2022-11-04 17:56:49,548 - DEBUG - API call headers: {"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"} 2022-11-04 17:56:49,548 - DEBUG - API call json: {"timeZone": "Europe/Warsaw", "acceptLanguage": "en", "accountID": "1234567", "token": "token_redacted", "appVersion": "2.8.6", "phoneBrand": "SM N9005", "phoneOS": "Android", "traceId": "1667581009", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "CID_redacted_CID", "configModule": "WiFi_Bulb_MulticolorBulb_US", "payload": {"method": "setLightStatus", "source": "APP", "data": {"action": "on", "speed": 0, "brightness": 1, "red": "", "green": "", "blue": ""}}} 2022-11-04 17:56:50,314 - DEBUG - API response: {'traceId': '1667581009', 'code': 0, 'msg': 'request success', 'module': None, 'stacktrace': None, 'result': {'traceId': '1667581009', 'code': 11000000}}
Device Name:.................. Lamp
Model: ....................... ESL100MC
Subdevice No: ................ None
Status: ...................... on
Online: ...................... online
Type: ........................ Wifi-light
CID: ......................... CID_redacted_CID
UUID: ........................ UUID_redacted_UUID
Brightness: .................. 1 %
ColorHSV: .................... hue: 0.0, saturation: 100.0, value: 100.0,
ColorRGB: .................... red: 255, green: 0, blue: 0,
ColorMode: ................... color
now, the colorMode
key is missing from the set_brightness()
api call.
There are not enough captured calls to study all the possible combinations.
I would assume that the other colorMode that is not "color" would be "white"?
And maybe there are missing needed parameters when we switch between colormodes. That is true in the ValcenoBulbs, and for esl100mc, there are not enough packets captured to see all the different combinations.
yes, the other color mode is 'white'. @michalantoszczuk any chance you could capture some more packets? I don't have access to an iPad
@aigimig I just updated that same previous branch, to include an empty colorMode
key on the api call, when only changing brightness. Please, if you have the opportunity to test that again please. Another scenario I would ask you to tes is, by changing the Color Mode in the vesync app, and then tryng the pyvesync lib, to see if you get different results depending on the current colorMode.