ollo69 / ha-smartthinq-sensors

HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
Apache License 2.0
1.15k stars 159 forks source link

[BUG] Refrigerator: No value update on sensor.refrigerator_refrigerator_temp & sensor.sensor.refrigerator_freezer_temp #76

Closed leap-r closed 4 years ago

leap-r commented 4 years ago

Describe the bug Values for the following sensors are not updated:

Expected behavior Values should be updated upon change.

Environment details:

Additional context If I manually set the state for another temperature, after a couple of seconds it returns to the previous set temperature (5ºC Fridge; -21ºC Freezer). The temperature that is set on LG's ThinQ app is 7ºC and -15ºC.

If I set the temperature using the LG ThinQ app, the refrigerator and freezer temperature are updated on the App and on the Refrigerator itself, but not on HA.

Hope this helps.

Thanks

KTibow commented 4 years ago

Does restarting HA force update of the sensors? What do you get if you use wideq?

leap-r commented 4 years ago

Hey,

Restarting does not force an update on the sensors. Have not used wideq but will try it out.

Thanks

ollo69 commented 4 years ago

Only temperature are not updated? The other attribute are correct? Can you provide me the json file with refrigerator information? The link to download it is shown in the HA log during HA startup.

leap-r commented 4 years ago

Hey,

The binary sensor for the door works - does have a bit of lag but I figure this is due to their API.

I was unable to find the link to the json file on /config/home-assistant.log. The only information regarding smartthinq_sensors is the following:

17:05:30 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for smartthinq_sensors which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

Should I look elsewhere?

Thanks

ollo69 commented 4 years ago

This component is cloud polling so data is updated every 30 seconds. In the log file you just see warning message or also info? The information is displayed at info level, so you should change the log level in configuration.yaml if the message is not displayed.

leap-r commented 4 years ago

Hey,

Thank you for that info. I've changed the log level and have downloaded the json

Hope this helps.

Thanks

ollo69 commented 4 years ago

Hi, I dowload the JSON file but is equal to other that I have, so nothing different from what was already implemented. I have a couple of question:

1) you said;

If I manually set the state for another temperature, after a couple of seconds it returns to the previous set temperature

What does it means that you try to change the state of the sensor in HA? In this case this does not make sense, the sensor is not able to change the value on the refrigerator, it is read only.

2) Than you said:

If I set the temperature using the LG ThinQ app, the refrigerator and freezer temperature are updated on the App and on the Refrigerator itself, but not on HA.

Can you provide me a screenshot of all the attribute of the main sensor? This should also cointains the temperature values.

KTibow commented 4 years ago

I think he meant that he used the set state button in developer tools.

ollo69 commented 4 years ago

Yes, is what I also understood, probably expecting that the values are updated on the refrigerator. Obviosly it is not possible.

leap-r commented 4 years ago

Yes, is what I also understood, probably expecting that the values are updated on the refrigerator. Obviosly it is not possible.

Hey,

I did try to update the value via developer tools, only expecting to have the sensor.refrigerator_temp & sensor.refrigerator_freezer_temp updated on Home Assistant. I'm able to change those values, but only momentarily (couple of seconds), then it returns to the previous state.

  1. Than you said:

If I set the temperature using the LG ThinQ app, the refrigerator and freezer temperature are updated on the App and on the Refrigerator itself, but not on HA.

Can you provide me a screenshot of all the attribute of the main sensor? This should also cointains the temperature values.

Main sensor (sensor.refrigerator):

model: 2REB1GLVB1___-BF mac_address: '(removed for github)' refrigerator_temp: '5' freezer_temp: '-20' temp_unit: °C door_open_state: 'off' smart_saving_mode: 'Off' smart_saving_state: 'Off' eco_friendly_state: 'On' ice_plus_state: 'Off' fresh_air_filter_state: '-' water_filter_used_month: '0' friendly_name: Refrigerator icon: 'mdi:fridge-outline'

Screenshot from LG ThinQ App: Screenshot_20200823-172822 (1)

Hope this helps.

Thanks

ollo69 commented 4 years ago

Fine,

my suspect is that there are an issue in conversion from measure unit, but I need some log from you to analyze it. You should add the following line in configuration.yaml:

logger:
  default: info
  logs:
    custom_components.smartthinq_sensors: debug

than reboot HA and send me the log file that should contain debug info so that I can analyze the values that the component is receiving. Please before posting log file remove your personal information, the first line of the log will contain your access token.

leap-r commented 4 years ago

Fine,

my suspect is that there are an issue in conversion from measure unit, but I need some log from you to analyze it. You should add the following line in configuration.yaml:

logger:
  default: info
  logs:
    custom_components.smartthinq_sensors: debug

than reboot HA and send me the log file that should contain debug info so that I can analyze the values that the component is receiving. Please before posting log file remove your personal information, the first line of the log will contain your access token.

Hey,

Ok, debug info here

Let me know if you need anything else.

Thanks for helping.

ollo69 commented 4 years ago

Loking at the log and JSON info file, the component is showing the correct values:

'refState': {'activeSaving': 'OFF', 'atLeastOneDoorOpen': 'CLOSE', 'convertibleTemp': 0.0, 'displayLock': 'UNLOCK', 'dualFridgeMode': 'IGNORE', 'ecoFriendly': 'ON', 'expressFridge': 'OFF', 'expressMode': 'OFF', 'freezerTemp': 6.0, 'freshAirFilter': 'IGNORE', 'fridgeTemp': 3.0, 'monStatus': 'NORMAL', 'sabbathMode': 'OFF', 'smartSavingMode': 'OFF', 'smartSavingRun': 'STOP', 'tempUnit': 'CELSIUS', 'waterFilter': '0_MONTH'}

As you can see fridgeTemp: 3.0 and freezerTemp: 6.0 that mapped with the JSON file means 5° and -20°. What is also surprising me are the value on the app, because 7° and -15° are the minumum temperature available and the default value. Are you sure that this value are correct? May be you should try to reset the fridge and the remove and re-add in the app. Component is showing exacltly what is receiving!!!!

leap-r commented 4 years ago

Hey,

Yes, I'm sure the values (7ºC and -15ºC) are correct. Those values are shown on the refrigerator door and on LG's App. If I change the temperature on the refrigerator door, it will also change on LG's App. The only place where the temperature does not change, in any way, is within Home Assistant. Looks like the API is always receiving the same (wrong) values.

Will try a reboot and add the frige back in the app. Will advise.

Thanks

ollo69 commented 4 years ago

Can you leave the HA log enabled while you change the temperatures on the fridge, to check if something change or not?

leap-r commented 4 years ago

Hey,

So finally, we're on to something :) I believe I've figured out what is happening.

  1. If the fridge/freezer temperature is updated manually, either on the refrigerator door or LG's App, it will trigger an API call with the updated temperature values:

online': True, 'refState': {'activeSaving': 'OFF', 'atLeastOneDoorOpen': 'CLOSE', 'convertibleTemp': 0.0, 'displayLock': 'UNLOCK', 'dualFridgeMode': 'IGNORE', 'ecoFriendly': 'OFF', 'expressFridge': 'OFF', 'expressMode': 'OFF', 'freezerTemp': 3.0, 'freshAirFilter': 'IGNORE', 'fridgeTemp': 4.0, 'monStatus': 'NORMAL', 'sabbathMode': 'OFF', 'smartSavingMode': 'OFF', 'smartSavingRun': 'STOP', 'tempUnit': 'CELSIUS', 'waterFilter': '0_MONTH' Screenshot_20200825-153710

Screenshot from 2020-08-25 15-52-22

  1. If I select ECO Friendly mode, which is an economical mode to trigger a default temperature of 7ºC (Fridge) and -15ºC (Freezer) (json ecoFriendly), the temperatures on the refrigerator door and LG's App are updated, however, they are not updated on the API call. The mode, however, is updated as you can see below:

'online': True, 'refState': {'activeSaving': 'OFF', 'atLeastOneDoorOpen': 'CLOSE', 'convertibleTemp': 0.0, 'displayLock': 'UNLOCK', 'dualFridgeMode': 'IGNORE', 'ecoFriendly': 'ON', 'expressFridge': 'OFF', 'expressMode': 'OFF', 'freezerTemp': 3.0, 'freshAirFilter': 'IGNORE', 'fridgeTemp': 4.0, 'monStatus': 'NORMAL', 'sabbathMode': 'OFF', 'smartSavingMode': 'OFF', 'smartSavingRun': 'STOP', 'tempUnit': 'CELSIUS', 'waterFilter': '0_MONTH' Screenshot_20200825-152611

Screenshot from 2020-08-25 15-53-06

So, it looks like an issue with LG's API not sending the correct temperature when a mode is selected, instead of a manual temperature being set.

Let me know if this makes any sense.

Thanks

ollo69 commented 4 years ago

You are right, I didnt't realize that your fridge was in EcoFrienly mode. But it is not a LG API issue, they probably implement API in this way to be able to remember the temperature set with eco friendly status OFF. I have to implement the logic in the component to set the temperature to the default EcoFriendly values (that are reported in JSON file) when this flag is on. I will inform you when the change will be released.

leap-r commented 4 years ago

Hey,

Brilliant! Thanks for your help!

PS: I know this is a separate issue, but it would be cool if we could retrieve the values for the modes within lovelace ('ecoFriendly', 'expressFridge', 'expressMode'). If you'd like, I can open a new thread as a feature request :D

ollo69 commented 4 years ago

PS: I know this is a separate issue, but it would be cool if we could retrieve the values for the modes within lovelace ('ecoFriendly', 'expressFridge', 'expressMode'). If you'd like, I can open a new thread as a feature request :D

This can be already done in multiple way, for example::

  1. Use platform template to expose attribute as sensor
  2. Use a front-end extension (you can search in HACS) that allow you to directly shou attribute values in lovelace
leap-r commented 4 years ago

Hey,

Awesome! Thanks!

ollo69 commented 4 years ago

I close this issue because it should be fixed and I do not receive any feed-back from 1 month

KTibow commented 4 years ago

@ollo69 You should install the Stale bot.

leap-r commented 4 years ago

Yep, all good! Thanks!