Open lvnilesh opened 1 year ago
I have the same issue. Were you able to find a resolution?
no :(
I have the same problem. I've tried to do some digging, but I'm having trouble accessing the API the code is using. Has anyone tried with postman to see if you are able to get a response?
Sorry for the radio silence everyone! My installation also broke around the same time, and, after some quick checks on their website, it looks like they changed the way their API works, breaking my plugin/API. I (or anyone really) need to use browser debuggers to do some reverse engineering to figure out how their new API works and change the code to work with it. Some of the changes look good (more RESTful and easier to work with), but I haven't had the time to really dig in yet. If anyone has started, I'd be more than willing to help.
I am getting 405 Method Not Allowed when using Method: POST, however GET is working.
I'm definitely willing to help, but lack experience in this area (usually write self-contained react apps with my own backend). Not used to digging into an API with no documentation. Any suggestions where I should get started?
I have made some progress:
The new API is at https://api.smartcielo.com/web/login as opposed to https://home.cielowigle.com/auth/login.
I've found a POST for login, which I have working. It's fairly simple.
There is a GET for Devices and GET for Appliance List. All of these are working for me right now on Postman.
Major problem I'm having, when I change temperatures from the web app I'm not seeing any in the "Network" activity in my Chrome dev tools. I honestly don't even know how that's possible, so I'm probably missing something.
OK, more progress. I have determined that there is an API for login and getting appliance/device lists, however it appears to be using a web socket for all controls.
The web socket looks like this for a change temperature command:
Websocket response (status update, which also is periodically/randomly sent):
Nice work! What else is needed then? Also, do I see an option here to turn off the LED using this API? That would be amazing!
The code needs to be altered, which I've begun digging into. Unfortunately I'm not sure how the npm ws package functions (I've never messed with web sockets).
@isaac-webb , are you familiar with this part of things?
The new web socket is at: wss://apiwss.smartcielo.com/websocket/?sessionId=<yourSessionId>&token=<yourToken>
Both <yourSessionId>
and <yourToken>
come from response to a simple POST https request like this:
const loginUrl = new URL("https://api.smarcielo.com/web/login"); const loginPayload = { agent: this.#agent, headers: { authority: "api.smartcielo.com", accept: "application/json, text/plain, */*", "accept-language": "en-US,en;q=0.9", "cache-control": "no-cache", "content-type": "application/json; charset=UTF-8", origin: "https://home.cielowigle.com", pragma: "no-cache", referer: "https://home.cielowigle.com/", "x-api-key": <notPostingHere>, }, body: { user: { userId: username, password: password, mobileDeviceId: "WEB", deviceTokenId: "WEB", appType: "WEB", appVersion: "1.0", timeZone: "America/Los_Angeles", mobileDeviceName: "chrome", deviceType: "WEB", ipAddress: ip, isSmartHVAC: 0, locale: "en", }, }, method: "POST", }; const response = await fetch(loginUrl, loginPayload);
That's where I am so far. I have also found some cookie stuff, but I'm still not entirely sure how that aspect works...
I have it working with the exception of the #pingSocket()
function! It appears all the cookie stuff is unnecessary with the new code, so I removed all of it. I'm trying to discover if the ping function is really just a refresh token function.
Still having some issues with #pingSocket, it disconnects and reconnects but other than that it works! I would be willing to submit a PR from my fork if @isaac-webb would like, but it would be nice to get some help figuring out the ping/disconnect issue first. Give it a shot! I named it homebridge-cielo
, so it should come up in a homebridge search.
My repo is https://github.com/ryanfroese/homebridge-smartcielo
@ryanfroese did you publish it to NPM? It's unclear to me how to install from GitHub in homebridge
Thanks Ryan! I was able to get it installed and configured and I see the command getting sent but nothing happens to the unit. Can I provide any information that might be helpful?
@friism , I have published it on NPM. It still has some issues, which I will be working on when I have time. Namely, it closes the web socket, and the #pingSocket function needs to be altered.
@jfarlow12 , curious. It's working on my end, but I have Cielo Breez Plus thermostats. Also, mine only works for a time before disconnecting, then it works again when reseting the hub. Still a websocket closing issue. I'll keep playing with it. For your issue, we may have to look into the logs, but unfortunately the code doesn't seem to throw errors if a web socket message isn't formatted correctly, etc. This will also take some further work.
Hopefully someone else can jump in to look at the code, since my time is fairly limited these days.
@ryanfroese no worries at all. I appreciate you getting this far! I’m using the Mr Cool mini splits. Maybe there is a code difference but it seems to use the same vendor/technology on the back-end. I can login to the web portal and adjust there so maybe I need to change up the url it’s posting?
It does work from the smart Cielo app which I think is where you are getting the info from right?
@ryanfroese I don't see your package on npm though? https://www.npmjs.com/search?q=homebridge-smartcielo I'm asking since that's where the homebridge UI installs from
@friism you can find it from the UI in homebridge. This is the one that I added.
Great, got it installed - same as @jfarlow12 the plugin doesn't work with my mrcool setup either (the plugin works and doesn't error, but the settings on the mini split don't actually change)
@jfarlow12 , if you go to "accessories" in the homebridge UI, does it show the thermostats? How familiar are you with code, and running something on the CLI?
Either of you can try following the "Sample Code Execution" under https://github.com/ryanfroese/node-cielo. If you have node installed already, you can just type those 4 commands into your CLI, and it should send some test commands to your thermostat. You'll need the Mac Address of your thermostat. Oh, and don't forget the Mac Address must be all upper case and with no colons, etc. when you're configuring.
Mine is working, though disconnecting once per hour then reconnecting. It still needs some work/cleanup to be "polished", hoping to have time in a couple weeks.
Hey @ryanfroese ill give it a shot. I’m decent at the code so I’ll let you know in the next day or two. I do see the thermostat in the accessories and when I change the temp it sends the command the same way as in HomeKit but still doesn’t actually change. Thanks!
@jfarlow12 , great. Let me know if it gives you any info, or works, when you do that. I'm crossing my fingers that we at least get some info as to what is different in your situation than mine.
Alright, so it looks like it connected in the log, but nothing happens on the mini-split itself. Here is a screenshot of the message and the demo code. Let me know if I can provide anything else!
Alright, I'm guessing that "off, cool, high, 62, 72" are the current settings for your mini split. So it's connecting successfully, and pulling its current status. It's also showing that the status isn't changing after each command is sent. This means your messages aren't being accepted by their API in the websocket (though it looks like the websocket is successful).
I formatted the websocket messages by inspecting how their web app was formatting them, but I'm not sure which parts of it were unique (like the API-X key). If you know how to do this, I think we can get somewhere: access the developer tools in chrome, then click the network, then click "session", then click a control on to control your device. Let me know what the message is, should be able to copy paste here?
Here's an example captured with Safari with my mr cool system
{"action":"actionControl","macAddress":"E8DB84875E8B","deviceTypeVersion":"BI03","fwVersion":"2.5.3,2.5.0","actionSource":"WEB","applianceType":"AC","applianceId":1663,"actionType":"power","actionValue":"on","connection_source":1,"token":"...","actions":{"power":"on","mode":"heat","fanspeed":"low","temp":"75","swing":"auto","turbo":"off","light":"off","oldPower":"on"},"mid":"chrome-1678810007","application_version":"1.0.0","ts":1678810242} 1678810242.5261207
{action: "actionControl", macAddress: "E8DB84866B26", deviceTypeVersion: "BI03",…} action : "actionControl" actionSource : "WEB" actionType : "power" actionValue : "on" actions : {power: "on", mode: "heat", fanspeed: "auto", temp: "72", swing: "pos3", turbo: "off", light: "off",…} applianceId : 1663 applianceType : "AC" application_version : "1.0.0" connection_source : 1 deviceTypeVersion : "BI03" fwVersion : "2.5.3,2.5.0" macAddress : "E8DB84866B26" mid : "chrome-1678810334" token : "" ts : 1678810630
When I get a chance (hopefully soon), I'll comb through that and see if it's formatted differently than mine.
awesome thanks @ryanfroese!
I also just purchased a Smart Cielo thermostat to test out your same setup rather than the Mr Cool unit directly. Hopefully this will be a good datapoint as well. It should be here in a couple of days.
Just got the Smart Cielo lite today and configured it in home bridge and this is what I received.
Hey @ryanfroese! Not sure if you had a chance to look this over or if there is anything I can test for you. Like I said, I did get a smart Cielo thermostat but it’s still not working. Which model do you have?
@jfarlow12 , yep I need to return to this - hopefully this next week! Work has been hectic. I will have a bit more time especially the week after next.
Thanks for your help! I'm not sure the particular model, I'll look into that a bit more ASAP
I totally get it! No worries at all. Thanks for all your work on this.
I will still return to this, but I just poked around a bit this evening, and it appears they changed the API key. If they do that frequently, I'll have to make a way to put the API key into the config... I'm working on re-working that part. I had hard-coded the API key into this for expediency.
Anyone else have any idea if that' just bad luck, or if the API key may change often?
Hello. Any progress? I downloaded the plugin today and it errors out. My error appears different though. I guess it doesn't matter until the API key issue is resolved? Here's my error anyhoo...
/usr/local/lib/node_modules/homebridge-mrcool/node_modules/node-mrcool/MrCool.js:413
return cookieArray.map((element) => element.split(';')[0]).join(';');
^
TypeError: Cannot read properties of undefined (reading 'map')
at MrCoolAPIConnection.#getCookiesFromResponse (/usr/local/lib/node_modules/homebridge-mrcool/node_modules/node-mrcool/MrCool.js:413:28)
at MrCoolAPIConnection.#getApplicationCookies (/usr/local/lib/node_modules/homebridge-mrcool/node_modules/node-mrcool/MrCool.js:237:44)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at MrCoolAPIConnection.establishConnection (/usr/local/lib/node_modules/homebridge-mrcool/node_modules/node-mrcool/MrCool.js:117:36)
at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-mrcool/src/platform.ts:57:7)
[6/30/2023, 1:05:32 PM] [homebridge-mrcool] Child bridge process ended
[6/30/2023, 1:05:32 PM] [homebridge-mrcool] Process Ended. Code: 1, Signal: null
@ryanfroese I was able to issue commands to my Mr. Cool devices by sending the correct deviceTypeVersion
; see https://github.com/ryanfroese/node-cielo/pull/1 for the changes.
@Taik what are installation instructions to use your branch of node-cielo with the plugin?
@Taik , thank you I just approved your PR and opened up "issues" on node-cielo#1. They seemed to have made another change to the API shortly after I refactored for their API - but it may be minor.
Woah! It works on my mrcool multi-zone setup
Woah! It works on my mrcool multi-zone setup
@friism How did you manage to get it to work?
Woah! It works on my mrcool multi-zone setup
@friism How did you manage to get it to work?
@arharp The latest version of homebridge-cielo
(v1.1.5) should contain the library changes; see here.
@arharp yup, to @Taik 's point I just installed and configured the latest version
I have tried for days to get this to work. I am sure its me....can someone please help
Mac Pro Ventura
[10/26/2023, 8:32:38 PM] [homebridge-cielo] Launched child bridge with PID 6872
[10/26/2023, 8:32:38 PM] Registering platform 'homebridge-cielo.cielo'
[10/26/2023, 8:32:38 PM] [homebridge-cielo] Loaded homebridge-cielo v1.1.5 child bridge successfully
[10/26/2023, 8:32:38 PM] Loaded 0 cached accessories from cachedAccessories.0E5AA137548F.
[10/26/2023, 8:32:39 PM] Homebridge v1.6.1 (HAP v0.11.1) (homebridge-cielo) is running on port 57293.
TypeError: Cannot read properties of undefined (reading 'user')
at /usr/local/lib/node_modules/homebridge-cielo/node_modules/node-smartcielo-ws/Cielo.js:264:52
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at CieloAPIConnection.#getAccessTokenAndSessionId (/usr/local/lib/node_modules/homebridge-cielo/node_modules/node-smartcielo-ws/Cielo.js:260:23)
at CieloAPIConnection.establishConnection (/usr/local/lib/node_modules/homebridge-cielo/node_modules/node-smartcielo-ws/Cielo.js:119:5)
at HomebridgeAPI.
Haven't been able to spend more time on this, but looks like they added a required reCaptcha step during login, which is why auth step fails.
Just recently been trying to integrate Cielo also to my home project. I've stumbled upon multiple different repos, but havn't gotten any of them to work. Latest ones probably fail as mentioned above, because they have introduced captcha.
I wonder would it be possible to:
adb forward
Unfortunately I don't have now time to test it out, but will let you know if I progress some day.
Tried to get this working and it just crashes and forces home bridge to reboot over and over just like all the other versions.
Yup, I believe it's basically dead at this point (due to their changes). I had it working for a whopping 3 months before they changed their API. Unfortunate!
If anyone comes up with a solution, submit a PR and I will approve. For now I don't have time to dissect the new API and take the lead on this one.
I wish I knew enough to take a look, but I'm more of a mechanical person and code is a mystery.
Thanks for the update. I installed and restarted homebridge.
I notice that homebridge-mrcool.MrCool starts, and crashes. And then repeats.