Closed osresearch closed 2 years ago
Login flow done: turn your email and password into a token: https://github.com/osresearch/hcpy/commit/4d5b406b6250c7d45af7bee4204e141c438af378
Next up: turn that token into a bearer token that can be used to authenticate the websocket to the cloud servers and request the device configurations.
And we can now perform the whole OAuth flow, fetch account information and device descriptions. No more rooted android required! https://github.com/osresearch/hcpy/commit/b852cfd2b8bbf519d3c2226dd928e360b74cab44
@CRTified can you try with your account to see if it works for you too? I'm eager to see what comes out of the coffee maker.
Yes, it seems to work:
Received access token
fetching https://prod.reu.rest.homeconnectegw.com/api/iddf/v1/iddf/SIEMENS-TI9558X1DE-$MACADDRESS
Connecting with hc2mqtt
yelds the following output, where the first unknown response contains some data that I can't interpret (so I censored it partially):
[nix-shell:~/git/hub/hcpy]$ ./hc2mqtt config.json
2022-02-19 21:22:32.830057 CON: ws://192.168.10.8:80/homeconnect
2022-02-19 21:22:32.880348 Unknown {'sID': 2158429787, 'msgID': 376618400, 'resource': '/ci/authentication', 'version': 2, 'action': 'RESPONSE', 'data': [{'response': '6HS2vap-SOMERANDOMDATA-z5k'}]}
2022-02-19 21:22:32.889128 {'error': 404, 'resource': '/iz/info'}
2022-02-19 21:22:32.891273 {'error': 404, 'resource': '/ni/info'}
2022-02-19 21:22:33.605565 {'LastSelectedBeverage': 8217, 'LocalControlActive': False, 'PowerSupplyError': 'Off', 'DripTrayNotInserted': 'Off', 'DripTrayFull': 'Off', 'WaterFilterShouldBeChanged': 'Off', 'WaterTankEmpty': 'Off', 'WaterTankNearlyEmpty': 'Off', 'BrewingUnitIsMissing': 'Off', 'SelectedProgram': 0, 'MacchiatoPause': '5Sec', 'ActiveProgram': 0, 'BeverageCountdownWaterfilter': 48, 'BeverageCountdownCalcNClean': 153, 'RemoteControlStartAllowed': True, 'EmptyDripTray': 'Off', 'BeverageCountdownDescaling': 153, 'EmptyDripTrayRemoveContainer': 'Off', 'BeverageCounterRistrettoEspresso': 177, 'AllowBackendConnection': True, 'BeverageCounterHotWater': 37351, 'RemindForMilkAfter': 'Off', 'BeverageCounterFrothyMilk': 22, 'BeverageCounterCoffeeAndMilk': 1077, 'CustomerServiceRequest': 'Off', '4645': 0, 'CoffeeMilkOrder': 'FirstCoffee', 'BackendConnected': True, 'BeverageCounterCoffee': 21, 'Enjoy': 'Off', 'UserMode': 'Barista', 'PlaceEmptyGlassUnderOutlet': 'Off', 'WaterTankNotInserted': 'Off', 'PlaylistRunning': False, 'BeverageCounterPowderCoffee': 9, 'DemoModeActive': False, 'CleanBrewingUnit': 'Off', 'WaterHardness': 'Medium', 'CloseDoor': 'Off', 'EmptyMilkTank': 'Off', 'SpecialRinsing': 'Off', 'AllowConsumerInsights': False, 'SwitchOffAfter': '01Hours15Minutes', '4681': 0, 'LastSelectedCoffeeWorldBeverage': 20514, 'BrightnessDisplay': 7, 'CleanMilkTank': 'Off', 'NotEnoughWaterForThisKindOfBeverage': 'Off', 'ChildLock': False, '4666': 0, 'Language': 'De', 'MilkContainerConnected': 'Off', 'SoftwareUpdateAvailable': 'Off', 'LeaveProfilesAutomatically': True, 'RemoveWaterFilter': 'Off', 'OperationState': 'Inactive', 'BeverageCounterHotMilk': 9, '4362': 0, 'MilkTubeRemoved': 'Off', 'DeviceIsToCold4C': 'Off', 'SystemHasRunDry': 'Off', 'DeviceShouldBeDescaled': 'Off', 'PowerState': 'Standby', 'DeviceShouldBeCleaned': 'Off', 'DeviceShouldBeCalcNCleaned': 'Off', 'BeanContainerEmpty': 'Off', 'MilkStillOK': 'Off', 'CoffeeOutletMissing': 'Off', 'MilkReminder': 'Off', 'RefillEmptyWaterTank': 'Off', 'RefillEmptyBeanContainer': 'Off', 'UnderOverVoltage': 'Off', 'NotEnoughPomaceCapacityForThisKindOfBeverage': 'Off', 'AdjustGrindSetting': 'Off', 'InsertWaterFilter': 'Off', 'FillDescaler': 'Off', 'CleanFillWaterTank': 'Off', 'PlaceContainerUnderOutlet': 'Off', 'SwitchOffPower30sekBackOn': 'Off', 'ThrowCleaningDiscInTheDrawer': 'Off', 'RemoveMilkContainer': 'Off', 'RemoveContainerUnderOutlet': 'Off', 'MilkContainerRemoved': 'Off', 'ServiceProgramFinished': 'Off', 'DeviceDescalingOverdue': 'Off', 'DeviceDescalingBlockage': 'Off', 'CustomerServiceConnectionAllowed': False, 'BeverageCountdownCleaning': 38, 'ProcessPhase': 'None'}
publish homeconnect/coffeemaker {"state": "Inactive", "door": null, "remaining": null, "power": "Standby", "lowwaterpressure": null, "aquastop": null, "error": null}
Thanks for confirming it works! It should be much more approachable for other devs now that a rooted android phone is no longer required.
Since we don't want everyone to have to root their android phone to observe the PSK and IV for talking to their devices, we should track the login flow from the app and replicate it in a python tool.