I have two Cummins Cloud Connect Generators that I would love to be able to see the status of and could use a little guidance/help with the API to make an integration (or AppDaemon module). They normally support IOS and Android Apps and a web site (https://connectcloud.cummins.com/). They utilize Microsoft B2C for all their authentication and then a few AWS JSON calls to actually pull the data.
By using MITM proxy I have been able to figure out most of it except figuring out how to actually authenticate with Microsoft B2C to get the Bearer token used in the actual API calls.
The calls to B2C are what I am struggling with… When you go to the website/app it gives you a login/password… that logs in via B2C gets an oauth2 token → bearer token which is used to call the APIs on AWS below. The login URL is
https://powercommand.b2clogin.com/powercommand.onmicrosoft.com/b2c_1a_powercommand_combined_signin/oauth2/v2.0/authorize?client_id=17d3c24c-be5b-4bef-a43f-b7d77f5b5e25&redirect_uri=https%3A%2F%2Fda-pcc-auth-production.auth.us-east-1.amazoncognito.com%2Foauth2%2Fidpresponse&scope=https%3A%2F%2Fpowercommand.onmicrosoft.com%2Fawsprod%2Fuser_impersonation+openid+profile&response_type=code&state=SOMELONGCODE
I could use help figuring out how to streamline the oauth2 login so I can get and maintain the bearer token to call the APIs.
The two calls to AWS are bellow… these are easier to handle
Any help appreciated
-Eric
AWS Calls
https://mobile-prod.aws.powercommandcloud.com/api/dashboard/v1/mobile/Sites/Personal
which returns (an array of your equipment, in my case 2, but I shortened to just show 1)
[
{
"Sites": [
{
"AccountId": "XXXXX",
"Address": {
"City": "Hellertown",
"Id": "XXXXX",
"Label": null,
"Latitude": XXXXX,
"Line1": "XXXXX",
"Line2": null,
"Longitude": XXXXX,
"State": "XXXXX",
"ZipCode": "XXXXX"
},
"Assets": [
{
"Description": "Engine Model: QSG\nKilowatts (kW): 20kW\nFrequency: 60Hz\n",
"DeviceId": "XXXXX",
"Id": XXXXX",
"Kind": "ArrowUnit",
"Model": "Stealth",
"Name": "Genset",
"SerialNumber": null,
"Status": 8
}
],
"Description": "Site for Generator One generator",
"Id": "XXXXX",
"Location": null,
"Name": "Genset 1",
"Status": 8
}
],
"Status": 8
}
]
Then it calls
https://mobile-prod.aws.powercommandcloud.com/api/dashboard/v1/mobile/Sites/GetAssets?id=GeneratorIDFromFirstCall
which returns a large JSON object with the information for the Generator.