sopelj / hass-ember-mug-component

Ember Mug Integration for Home Assistant
MIT License
116 stars 4 forks source link

Feature request: Ability to disable/enable heating #46

Closed d-rez closed 9 months ago

d-rez commented 10 months ago

Description

First of all thanks for writing this component!

I've noticed that other mug apps like Ember Supreme and https://github.com/zopieux/mugctl allow to disable/enable heating and that you've implemented cold_no_control and warm_no_control states, however there's (seemingly?) no option to disable heating in the component. I was wondering if there's already a way to do this or if that's something you were looking at implementing sometime in the future?

This could be useful for certain automations or cases where the (empty) mug randomly decides to heat itself up for no good reason (had that happen once or twice)

Thanks!

sopelj commented 10 months ago

Interesting! It seems like that project sets the target temperature to 0 to "turn it off". The only issue with doing something like a "Switch" to turn it on or off is that the "Target Temperature" would be set to 0 and the value would need to be stored elsewhere until it is turned on again. That might be a confusing behavior, but is definitely doable. Just a question of how best to implement it. Another option is using the "presets" requested in #45. Creating one for "Off" with a value of zero would work too.

sopelj commented 9 months ago

I have tested setting it to 0 and it does seem to disable the heating. As test I created a switch entity in the branch feature/test-temp-control-switch and it does seem to work well. The only issue is the target temp needs to be stored somewhere else as it can't be stored in the mug and it needs to persist across reboots in case you restart home assistant when it's off. Only way I have found so far is to store it in a file. It's not very clean, but it works.

image

Currently, the Target Temp sensor will show the saved value instead of zero, but changing it to something else will re-enable temperature control. I'm not sure if that's the best behavior, but that's what it is right now. I'm open to ideas.

image

sopelj commented 9 months ago

This has been incorperated in release 1.0.0 so I'm going to close this, but feel free to open a new issue if it is not to your liking or you would like to suggest other things. Thanks!