ajmarks / gekitchen

Python SDK for GE smart appliances
MIT License
51 stars 35 forks source link

Hot water not showing up for fridge #3

Open DigitalBites opened 3 years ago

DigitalBites commented 3 years ago

First: Thank you for building this, its really amazing! I was going to start something similar but found your work.

I have a GE Cafe fridge (currently installed) that has a hot water dispenser that through the SmartHQ app i can heat/turn on to a specified temp, or schedule. I was hoping there was at least a way to turn it on to a defined temp via this API and also the custom_component so I don't need to use the app.

I did see the hex codes related to hot water but they don't show up in the custom_compoent and maybe its because there are some missing bits. What info can I provide to help address this? I'm happy to sniff traffic from the app or provide any other info if needed. Wasn't sure if it was something simple or a bit more complex w/o digging deeper into the code you've written.

Thanks for your work!

ajmarks commented 3 years ago

I actually started work on that at one point, but ran into two issues:

  1. I couldn't find a good HA platform to map it to. I'm already super-hackily using the water heater component for the fridge and oven, but it's not really ideal for the hot water dispenser. I'm open to suggestions there though.
  2. I don't have a fridge with a water heater myself, so it's hard to test.

If you wanted to add something, it would largely come down to:

  1. Adding an _encode_hot_water_status function to match _decode_hot_water_status and registering it in ERD_ENCODERS
  2. Calling async_set_erd_value/async_get_erd_value to manipulate it.

Now, if we really want to make everything like a million times better, we should refactor all of those bytes to NamedTuple encode/decode methods to be in the NamedTuple objects themselves, and then update Appliance.{encode/decode}_erd_value to use those. Which, now that I think of it, is a refactor I should totally try to do this week.

DigitalBites commented 3 years ago

Thanks for the response!

I like the idea on the refactoring. After I posted the couldn't help myself so i did see the commented out section in the HA component to enable the HW reporting as well as some missing pieces you mentioned above. I also used your example to call just this API in debug and it had some valuable output as well. I should be able to compare the output with what shows in the SmartHQ app and start to understand the various states/ERDs that i would need when you trigger the various modes and then start to toss those into a decode/encoding method.

My one idea on the hot water use could be as simple as a service call w/ a parameter to set a temp and a switch to indicate status or request... I think that would depend of those are combined values as part of a single request in the API or need to be managed separately, as like you said, there are no other really out of the box cards that would work. This is also not ideal...

I'll try to do that at least some time this week as my house is under construction so its a bit of a dusty mess right now.

ajmarks commented 3 years ago

Yeah, definitely. Right now it should be pretty straightforward to do it in code (see for example how I hacked together bake modes and temp for ovens in HA). The trick is finding a good front-end component for it. I guess, worst case, we could hackily call it a light and map the brightness and on/off somehow...

DigitalBites commented 3 years ago

OK! I had a few minutes today and started the library up in debug mode and captured some of the state changes when hitting buttons for the Hot water on the fridge. It appears to send periodic updates out as it's heating... and idle. The app on my phone reflected the same info as the debug data as well.

Ice maker status, filter status and ice control

DEBUG    Setting ErdCode.ICE_MAKER_BUCKET_STATUS to FridgeIceBucketStatus(state_full_fridge=<ErdFullNotFull.FULL: '01'>, state_full_freezer=<ErdFullNotFull.NA: 'NA'>, is_present_fridge=True, is_present_freezer=False, total_status=<ErdFullNotFull.FULL: '01'>)
DEBUG    Setting ErdCode.WATER_FILTER_STATUS to ErdFilterStatus.GOOD
DEBUG    Setting ErdCode.ICE_MAKER_CONTROL to IceMakerControlStatus(status_fridge=<ErdOnOff.ON: '01'>, status_freezer=<ErdOnOff.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.NOT_HEATING: '00'>, time_until_ready=datetime.timedelta(0), current_temp=72, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_SET_TEMP to 0

I then started to heat the water to 90F to see the states change.... FYI - I didn't see the ErdCode.HOT_WATER_SET_TEMP variable update/change, maybe this needs to be polled when we flip to heating status.


DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.HEATING: '01'>, time_until_ready=datetime.timedelta(0, 3600), current_temp=71, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.HEATING: '01'>, time_until_ready=datetime.timedelta(0, 2700), current_temp=71, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.HEATING: '01'>, time_until_ready=datetime.timedelta(0, 900), current_temp=86, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.READY: '02'>, time_until_ready=datetime.timedelta(0), current_temp=90, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.NOT_HEATING: '00'>, time_until_ready=datetime.timedelta(0), current_temp=73, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)
DEBUG    Setting ErdCode.HOT_WATER_STATUS to HotWaterStatus(status=<ErdHotWaterStatus.NOT_HEATING: '00'>, time_until_ready=datetime.timedelta(0), current_temp=72, tank_full=<ErdFullNotFull.FULL: '01'>, brew_module=<ErdPresent.NA: 'FF'>, pod_status=<ErdPodStatus.NA: 'FF'>)

I'll dig into this a bit more in a bit.. Just wanted to share some of the data I collected so far.

ajmarks commented 3 years ago

This is fantastic, thanks