sopelj / hass-ember-mug-component

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

Ember Tumbler liquid level never shows 0% even when state is empty and there is indeed no liquid left #43

Closed dshokouhi closed 10 months ago

dshokouhi commented 11 months ago

Description

Just observing the sensor state, I understand its a raw value from the cup however, we can see the flat lines where the cup was supposed to be at 0% but it never reaches that level. Here are some screenshots for 24 hour usage. I used the cup 2 times so it should've read 0% 3 times. My hope is that we can maybe make some sense of the jumps and what the graph should look like to see if we can "stabilize" it more?

One thing I did notice is that once the state is empty it doesnt seem to update liquid level anymore so that might be a starting place?

The number is strange too as it jumps and doesn't rest at what appears to be the lowest value, which in some cases may make more sense like earlier my cup was about 1/2 full and it registered that (eventually) then it jumped back to 100% 🙃 Maybe more research is needed here but would be curious to see what the other models do.

image

I also graphed the raw liquid level in case it helps

image

and here is the state of the tumbler

image

The cooling state is the start of the first beverage

What I Did

n/a

Logs / Errors

If possible/applicable, please enable logging, reproduce the issue and include any related errors below. This greatly helps with debugging and is much appreciated. (If you aren't sure how to enable it, please see the debugging section in the README)

no errors observed
sopelj commented 11 months ago

Hey! I'm definitely up for making some changes or accepting changes if you have some ideas.

For the zero, that is a bit strange. Does this only happen with the Tumbler? Perhaps the minimum level is different. Is the Tumbler perfectly dry? Sometimes just humidity causes the device to think it isn't empty. Usually the heat in the mug evaporates it when empty though.

However, on the stability front, I don't know how one would go about it. This is the state reported by the device. It is hard to make assumptions on whether it is correct or not.

For example for the liquid level, when you drink the level sometimes goes back to full as you tilt the device to drink, but we can't differentiate this temporary spike from someone refilling their mug. Yes, once at empty it does seem to calm down, but I think that is more because of power saving on the device side than it being more accurate. The sensor in the device is not very accurate either.

On the state sensor side, I don't see all the states, but it seems pretty normal. It will often alternate between heating and cooling to maintain the temperature. This is the expected behaviour. Since the liquid is often hotter than the desired temperature this is often the first state. However that does not cover colder liquids being added where it might heat. For automations, I use an event from "empty" to any of filling, heating or cooling. A binary sensor of "In use" or something could easily be created if needed.

dshokouhi commented 10 months ago

Does this only happen with the Tumbler?

Thats a good question, was hoping another user with a different device may chime in as this is the only Ember device I have

Perhaps the minimum level is different

thats my current suspicion...so far it seems 20% is the lowest but sometimes thats not the case it may read 30 or 40 or even 100% while the state is empty. I even noticed the number changing when I take the lid off the mug, not quite sure how that sensors works under the hood lol.

Is the Tumbler perfectly dry? Sometimes just humidity causes the device to think it isn't empty. Usually the heat in the mug evaporates it when empty though.

yup I pat dry it to make sure its completely dry and the value never seems to change. Thats at least the correlation I made is that once the state is empty the raw liquid level no longer changes. Do you see that on your end?

However, on the stability front, I don't know how one would go about it. This is the state reported by the device. It is hard to make assumptions on whether it is correct or not.

I am 100% with you on that, raw values are indeed raw values. I was hoping other users may chime in on what behavior they have noticed with these values. At least for me they are somewhat correct and somewhat incorrect lol. LIke the mug is 16oz but adding 6oz of liquid will still register 100% lol. Hard to make sense of it for sure.

For example for the liquid level, when you drink the level sometimes goes back to full as you tilt the device to drink, but we can't differentiate this temporary spike from someone refilling their mug. Yes, once at empty it does seem to calm down, but I think that is more because of power saving on the device side than it being more accurate. The sensor in the device is not very accurate either.

yea this was my thought as well since I use the lid with the Tumbler sometimes liquid gets stuck near the top which may account for that difference I am seeing, however sometimes when I take the lid off and theres liquid left teh device thinks its empty and stops maintaining heat.

On the state sensor side, I don't see all the states, but it seems pretty normal. It will often alternate between heating and cooling to maintain the temperature. This is the expected behaviour. Since the liquid is often hotter than the desired temperature this is often the first state. However that does not cover colder liquids being added where it might heat. For automations, I use an event from "empty" to any of filling, heating or cooling. A binary sensor of "In use" or something could easily be created if needed.

For the most part yes, sometimes when its empty I do see it jumping to Unknown for hours at a time but after I add liquid it changes. Haven't quite figured out how that works but definitely the scenario you mention works.

sopelj commented 10 months ago

Thats a good question, was hoping another user with a different device may chime in as this is the only Ember device I have

I get that. I only have a mug myself right now. So it's hard to debug others.

thats my current suspicion...so far it seems 20% is the lowest but sometimes thats not the case it may read 30 or 40 or even 100% while the state is empty. I even noticed the number changing when I take the lid off the mug, not quite sure how that sensors works under the hood lol. yup I pat dry it to make sure its completely dry and the value never seems to change. Thats at least the correlation I made is that once the state is empty the raw liquid level no longer changes. Do you see that on your end?

Yeah, that's really weird. I can confirm that mine, even if it can be sometimes unreliable, does indeed go down to zero when empty. My liquid level seems to go to 0 around the same time as it shows "empty". Often when I take the last sip, it will briefly heat up and then dry itself out and then indicate empty. I suppose it doesn't update after that, but it hard to tell if that's because it stops updating or because it is indeed empty.

image

However, yours seems to have a low point at like 3 or 4, but it's standard "empty" seems to be closer to 12. I'm not sure why that is since it's dry as you say. In beta 0.9.0-4 I had tried setting the min to 15 for the tumbler, but that won't really work as it does go below that sometimes and that will make it negative so I think I'll have to revert that. I don't know what the sensor is either and short of breaking the device there isn't really a way to know. I assume it's some sort of capacitive water level sensor embedded in the walls. But I have no idea how it is calibrated or used internally. All we can do is try to understand the reported values.

I am 100% with you on that, raw values are indeed raw values. I was hoping other users may chime in on what behavior they have noticed with these values. At least for me they are somewhat correct and somewhat incorrect lol. LIke the mug is 16oz but adding 6oz of liquid will still register 100% lol. Hard to make sense of it for sure.

Yes, I don't think this sensor was really designed to indicate a precise level, but probably serves mainly just to detect is there is liquid in the mug. My mug will register "100%" just over halfway. I don't think the sensor goes up very high. It's definitely not representative of the actual "full" quantity of the mug and I don't think it was designed for that.

yea this was my thought as well since I use the lid with the Tumbler sometimes liquid gets stuck near the top which may account for that difference I am seeing, however sometimes when I take the lid off and theres liquid left teh device thinks its empty and stops maintaining heat.

Oh yeah, I can see how that would affect it. It would definitely keep the humidity inside. Hmm, that's a bit weird. I don't know why it would be programmed to do that. But that's definitely something out of control of this integration.

For the most part yes, sometimes when its empty I do see it jumping to Unknown for hours at a time but after I add liquid it changes. Haven't quite figured out how that works but definitely the scenario you mention works.

That's good that the "state" value is fairly reliable. I suggest using that for most automations. A side from perhaps level < 30 or something to see if you're nearing the end of your drink, but definitely not precise values. Oh interesting. I've never seen the "unknown" state. Does the "raw state" indicate 0? Perhaps this is indicative of deep sleep. Is the battery low or is it charging?

dshokouhi commented 10 months ago

In beta 0.9.0-4 I had tried setting the min to 15 for the tumbler, but that won't really work as it does go below that sometimes and that will make it negative so I think I'll have to revert that.

So a few things. I do see negative values and also it no longer reads 100% when the raw liquid level is 30, it now reads 50% after the latest changes

image

I've never seen the "unknown" state. Does the "raw state" indicate 0? Perhaps this is indicative of deep sleep. Is the battery low or is it charging?

I am not sure next time it hits that state I'll comment back

sopelj commented 10 months ago

Oh weird, ok, thanks for the info! I have removed that. So it should be back to the original behaviour in beta 5.

Thanks!

dshokouhi commented 10 months ago

Oh interesting. I've never seen the "unknown" state. Does the "raw state" indicate 0?

ok finally was able to catch it, yes it shows raw state as 0

image

Is the battery low or is it charging?

everytime I have seen it, fully charged sitting on the charger just like it currently is

in fact it looks like as soon as it reported 100% it went to unknown strange.

image

Let me know if you would like more data. In terms of the actual issue we can close this if you like :)

sopelj commented 10 months ago

Oh interesting. I've never seen the "unknown" state. Does the "raw state" indicate 0?

ok finally was able to catch it, yes it shows raw state as 0

Awesome, thanks for checking! I've never seen it on my device so I wasn't sure what it does.

Is the battery low or is it charging?

everytime I have seen it, fully charged sitting on the charger just like it currently is

in fact it looks like as soon as it reported 100% it went to unknown strange.

Let me know if you would like more data. In terms of the actual issue we can close this if you like :)

Oh cool, thanks! Uhm, if you remove it from the charger does it change from unknown to something else? If so, we could could display state "0" as "Fully Charged" if we are on the charger. Perhaps it internally does something like throttle charging or something.

I've created a new issue for this #44 and we can continue there for that part, but I'll close this issue as suggested. Thanks!